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;
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
typedef enum DeviceState {
DEVICE_DEAD,
DEVICE_AVAILABLE,
- _DEVICE_STATE_MAX
+ _DEVICE_STATE_MAX,
+ _DEVICE_STATE_INVALID = -1
} DeviceState;
struct Device {
DeviceState state;
- /* A single device can be created by multiple sysfs objects */
char *sysfs;
};