next = strchr(slink, ' ');
while (next != NULL) {
next[0] = '\0';
- udev_device_add_devlink(udev_device, slink, 0);
+ udev_device_add_devlink(udev_device, slink);
slink = &next[1];
next = strchr(slink, ' ');
}
if (slink[0] != '\0')
- udev_device_add_devlink(udev_device, slink, 0);
+ udev_device_add_devlink(udev_device, slink);
} else if (startswith(property, "TAGS=")) {
char tags[UTIL_PATH_SIZE];
char *next;
switch(line[0]) {
case 'S':
util_strscpyl(filename, sizeof(filename), "/dev/", val, NULL);
- udev_device_add_devlink(udev_device, filename, 0);
+ udev_device_add_devlink(udev_device, filename);
break;
case 'L':
udev_device_set_devlink_priority(udev_device, atoi(val));
return 0;
}
-int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique)
+int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink)
{
struct udev_list_entry *list_entry;
list_entry = udev_list_entry_add(&udev_device->devlinks_list, devlink, NULL);
if (list_entry == NULL)
return -ENOMEM;
- if (unique)
- udev_list_entry_set_num(list_entry, true);
return 0;
}
mode_t udev_device_get_devnode_mode(struct udev_device *udev_device);
int udev_device_set_syspath(struct udev_device *udev_device, const char *syspath);
int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode);
-int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink, int unique);
+int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink);
void udev_device_cleanup_devlinks_list(struct udev_device *udev_device);
struct udev_list_entry *udev_device_add_property(struct udev_device *udev_device, const char *key, const char *value);
void udev_device_add_property_from_string_parse(struct udev_device *udev_device, const char *property);
log_debug("update old name, '%s' no longer belonging to '%s'\n",
name, udev_device_get_devpath(dev));
- link_update(dev, name, 0);
+ link_update(dev, name, false);
}
}
node_symlink(udev, udev_device_get_devnode(dev), filename);
/* create/update symlinks, add symlinks to name index */
- udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev)) {
- if (udev_list_entry_get_num(list_entry))
- /* simple unmanaged link name */
- node_symlink(udev, udev_device_get_devnode(dev), udev_list_entry_get_name(list_entry));
- else
- link_update(dev, udev_list_entry_get_name(list_entry), 1);
- }
+ udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
+ link_update(dev, udev_list_entry_get_name(list_entry), true);
}
void udev_node_remove(struct udev_device *dev)
/* remove/update symlinks, remove symlinks from name index */
udev_list_entry_foreach(list_entry, udev_device_get_devlinks_list_entry(dev))
- link_update(dev, udev_list_entry_get_name(list_entry), 0);
+ link_update(dev, udev_list_entry_get_name(list_entry), false);
/* remove /dev/{block,char}/$major:$minor */
snprintf(filename, sizeof(filename), "/dev/%s/%u:%u",
unsigned int value_off;
union {
unsigned int attr_off;
- int devlink_unique;
unsigned int rule_goto;
mode_t mode;
uid_t uid;
case TK_A_OWNER:
case TK_A_GROUP:
case TK_A_MODE:
+ case TK_A_DEVLINK:
case TK_A_NAME:
case TK_A_GOTO:
case TK_M_TAG:
token->key.value_off = add_string(rule_tmp->rules, value);
token->key.attr_off = add_string(rule_tmp->rules, attr);
break;
- case TK_A_DEVLINK:
- token->key.value_off = add_string(rule_tmp->rules, value);
- token->key.devlink_unique = *(int *)data;
- break;
case TK_M_TEST:
token->key.value_off = add_string(rule_tmp->rules, value);
if (data != NULL)
continue;
}
- if (startswith(key, "SYMLINK")) {
- if (op < OP_MATCH_MAX) {
+ if (streq(key, "SYMLINK")) {
+ if (op < OP_MATCH_MAX)
rule_add_key(&rule_tmp, TK_M_DEVLINK, op, value, NULL);
- } else {
- int flag = 0;
-
- attr = get_key_attribute(rules->udev, key + sizeof("SYMLINK")-1);
- if (attr != NULL && strstr(attr, "unique") != NULL)
- flag = 1;
- rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, &flag);
- }
+ else
+ rule_add_key(&rule_tmp, TK_A_DEVLINK, op, value, NULL);
rule_tmp.rule.rule.can_set_name = true;
continue;
}
log_debug("LINK '%s' %s:%u\n", pos,
&rules->buf[rule->rule.filename_off], rule->rule.filename_line);
util_strscpyl(filename, sizeof(filename), "/dev/", pos, NULL);
- udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique);
+ udev_device_add_devlink(event->dev, filename);
while (isspace(next[1]))
next++;
pos = &next[1];
log_debug("LINK '%s' %s:%u\n", pos,
&rules->buf[rule->rule.filename_off], rule->rule.filename_line);
util_strscpyl(filename, sizeof(filename), "/dev/", pos, NULL);
- udev_device_add_devlink(event->dev, filename, cur->key.devlink_unique);
+ udev_device_add_devlink(event->dev, filename);
}
break;
}
EOF
},
{
- desc => "test for whitespace between the operator",
- devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
- exp_name => "true",
- rules => <<EOF
-SUBSYSTEMS=="scsi", KERNEL=="sda1", SYMLINK+="before"
-KERNEL == "sda1" , SYMLINK+ = "true"
-EOF
- },
- {
desc => "ENV{} test",
devpath => "/devices/pci0000:00/0000:00:1f.2/host0/target0:0:0/0:0:0:0/block/sda/sda1",
exp_name => "true",