diff options
author | Lennart Poettering <lennart@poettering.net> | 2010-01-29 02:07:41 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2010-01-29 02:07:41 +0100 |
commit | b08d03ffe58332f590aae5c78a85e4fc0b8588ce (patch) | |
tree | 909fb7436bdd7496761bdcb8c3d13fa989aca584 /device.c | |
parent | 0ae97ec11506cce808232abd0979e20aed2fd625 (diff) |
add mount enumerator
Diffstat (limited to 'device.c')
-rw-r--r-- | device.c | 14 |
1 files changed, 9 insertions, 5 deletions
@@ -33,7 +33,7 @@ static void device_dump(Unit *u, FILE *f, const char *prefix) { prefix, d->sysfs); } -static int device_add_escaped_name(Unit *u, const char *dn) { +static int device_add_escaped_name(Unit *u, const char *prefix, const char *dn, bool make_id) { char *e; int r; @@ -41,10 +41,14 @@ static int device_add_escaped_name(Unit *u, const char *dn) { assert(dn); assert(dn[0] == '/'); - if (!(e = unit_name_escape_path(dn+1, ".device"))) + if (!(e = unit_name_escape_path(prefix, dn+1, ".device"))) return -ENOMEM; r = unit_add_name(u, e); + + if (r >= 0 && make_id) + unit_choose_id(u, e); + free(e); if (r < 0 && r != -EEXIST) @@ -79,7 +83,7 @@ static int device_process_device(Manager *m, struct udev_device *dev) { return -ENOMEM; assert(sysfs[0] == '/'); - if (!(e = unit_name_escape_path(sysfs+1, ".device"))) + if (!(e = unit_name_escape_path("sysfs-", sysfs+1, ".device"))) return -ENOMEM; if (!(u = manager_get_unit(m, e))) { @@ -116,12 +120,12 @@ static int device_process_device(Manager *m, struct udev_device *dev) { } if (dn) - if ((r = device_add_escaped_name(u, dn)) < 0) + if ((r = device_add_escaped_name(u, "node-", dn, true)) < 0) goto fail; first = udev_device_get_devlinks_list_entry(dev); udev_list_entry_foreach(item, first) - if ((r = device_add_escaped_name(u, udev_list_entry_get_name(item))) < 0) + if ((r = device_add_escaped_name(u, "node-", udev_list_entry_get_name(item), false)) < 0) goto fail; if (names) { |