summaryrefslogtreecommitdiff
path: root/device.c
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2010-04-10 17:45:14 +0200
committerLennart Poettering <lennart@poettering.net>2010-04-10 18:00:34 +0200
commit6326a423e7d3df2062bf29a4e9710aeecac89411 (patch)
tree5db9bb70a53a6b2e43a67df5db837ef8bc1099af /device.c
parentd2b9fd2bb971b3b7a23acdfa1748d6810629c94c (diff)
device: ignore a couple of 'API' devices
Diffstat (limited to 'device.c')
-rw-r--r--device.c24
1 files changed, 23 insertions, 1 deletions
diff --git a/device.c b/device.c
index 500cd23e27..39375a4258 100644
--- a/device.c
+++ b/device.c
@@ -137,6 +137,28 @@ static int device_find_escape_name(Manager *m, const char *dn, Unit **_u) {
return 0;
}
+static bool devnode_is_api(const char *node) {
+ unsigned i;
+
+ static const char * const table[] = {
+ "/dev/null",
+ "/dev/zero",
+ "/dev/urandom",
+ "/dev/random",
+ "/dev/port",
+ "/dev/oldmem",
+ "/dev/full",
+ "/dev/kmsg",
+ "/dev/mem"
+ };
+
+ for (i = 0; i < ELEMENTSOF(table); i++)
+ if (streq(table[i], node))
+ return true;
+
+ return false;
+}
+
static int device_process_new_device(Manager *m, struct udev_device *dev, bool update_state) {
const char *dn, *names, *wants, *sysfs, *expose, *model;
Unit *u = NULL;
@@ -168,7 +190,7 @@ static int device_process_new_device(Manager *m, struct udev_device *dev, bool u
if (!b)
return 0;
} else
- if (!dn && !names && !wants)
+ if ((!dn || devnode_is_api(dn)) && !names && !wants)
return 0;
/* Ok, seems kinda interesting. Now, let's see if this one