m->meta.load_state != UNIT_LOADED)
return 0;
+ if (is_device_path(s->what))
+ return 0;
+
if (!path_startswith(s->what, m->where))
return 0;
/* Adds in links to the device node that this unit is based on */
- if (!path_startswith(what, "/dev/") && !path_startswith(what, "/sys/"))
+ if (!is_device_path(what))
return 0;
if (!(e = unit_name_build_escape(what+1, NULL, ".device")))
return false;
}
+bool is_device_path(const char *path) {
+
+ /* Returns true on paths that refer to a device, either in
+ * sysfs or in /dev */
+
+ return
+ path_startswith(path, "/dev/") ||
+ path_startswith(path, "/sys/");
+}
+
static const char *const ioprio_class_table[] = {
[IOPRIO_CLASS_NONE] = "none",
[IOPRIO_CLASS_RT] = "realtime",
int path_is_mount_point(const char *path);
+bool is_device_path(const char *path);
+
extern char * __progname;
const char *ioprio_class_to_string(int i);