d->state = state;
if (state != old_state)
- log_debug("%s changed %s -> %s",
- UNIT(d)->id,
- device_state_to_string(old_state),
- device_state_to_string(state));
+ log_debug_unit(UNIT(d)->id,
+ "%s changed %s -> %s", UNIT(d)->id,
+ device_state_to_string(old_state),
+ device_state_to_string(state));
unit_notify(UNIT(d), state_translation_table[old_state], state_translation_table[state], true);
}
log_warning("SYSTEMD_ALIAS for %s is not a path, ignoring: %s", sysfs, e);
free(e);
} else {
-
- r = device_add_escaped_name(u, e);
+ device_update_unit(m, dev, e, false);
free(e);
- if (r < 0)
- goto fail;
}
}
}
}
static int device_enumerate(Manager *m) {
- struct epoll_event ev;
int r;
struct udev_enumerate *e = NULL;
struct udev_list_entry *item = NULL, *first = NULL;
assert(m);
if (!m->udev) {
+ struct epoll_event ev;
+
if (!(m->udev = udev_new()))
return -ENOMEM;