add mount enumerator
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user