- if (!DEVICE(u)->sysfs) {
- Device *first;
-
- if (!(DEVICE(u)->sysfs = strdup(sysfs))) {
- r = -ENOMEM;
- goto fail;
- }
-
- if (!m->devices_by_sysfs)
- if (!(m->devices_by_sysfs = hashmap_new(string_hash_func, string_compare_func))) {
- r = -ENOMEM;
- goto fail;
- }
-
- first = hashmap_get(m->devices_by_sysfs, sysfs);
- LIST_PREPEND(Device, same_sysfs, first, DEVICE(u));
-
- if ((r = hashmap_replace(m->devices_by_sysfs, DEVICE(u)->sysfs, first)) < 0)
- goto fail;
- }
-
- if ((model = udev_device_get_property_value(dev, "ID_MODEL_FROM_DATABASE")) ||
- (model = udev_device_get_property_value(dev, "ID_MODEL"))) {
- if ((r = unit_set_description(u, model)) < 0)
- goto fail;
- } else
- if ((r = unit_set_description(u, path)) < 0)
- goto fail;
-
- if (main) {
- /* The additional systemd udev properties we only
- * interpret for the main object */
- const char *wants, *alias;
-
- if ((alias = udev_device_get_property_value(dev, "SYSTEMD_ALIAS"))) {
- if (!is_path(alias))
- log_warning("SYSTEMD_ALIAS for %s is not a path, ignoring: %s", sysfs, alias);
- else {
- if ((r = device_add_escaped_name(u, alias)) < 0)
- goto fail;
- }
- }
-
- if ((wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS"))) {
- char *state, *w;
- size_t l;
-
- FOREACH_WORD_QUOTED(w, l, wants, state) {
- char *e;