- 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;
-
- alias = udev_device_get_property_value(dev, "SYSTEMD_ALIAS");
- if (alias) {
- char *state, *w;
- size_t l;
-
- FOREACH_WORD_QUOTED(w, l, alias, state) {
- char *e;
-
- e = strndup(w, l);
- if (!e) {
- r = -ENOMEM;
- goto fail;
- }
-
- if (!is_path(e)) {
- log_warning("SYSTEMD_ALIAS for %s is not a path, ignoring: %s", sysfs, e);
- free(e);
- } else {
- device_update_unit(m, dev, e, false);
- free(e);
- }
- }
- }
-
- wants = udev_device_get_property_value(dev, "SYSTEMD_WANTS");
- if (wants) {
- char *state, *w;
- size_t l;
-
- FOREACH_WORD_QUOTED(w, l, wants, state) {
- char *e, *n;
-
- e = strndup(w, l);
- if (!e) {
- r = -ENOMEM;
- goto fail;
- }
- n = unit_name_mangle(e);
- if (!n) {
- r = -ENOMEM;
- goto fail;
- }
- free(e);
-
- r = unit_add_dependency_by_name(u, UNIT_WANTS, n, NULL, true);
- free(n);
- if (r < 0)
- goto fail;
- }
- }
- }