summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay@vrfy.org>2012-10-08 21:54:39 +0200
committerKay Sievers <kay@vrfy.org>2012-10-08 21:54:39 +0200
commit8a1733871ffe9bfc47958e9056fd53ce216b1802 (patch)
treead1f1aa33f2fcd15e1f194174827119469778db4
parent04eaa66837260d86c27c9121b626ad6219690384 (diff)
udev: remove SYMLINK "unique" option
-rw-r--r--src/libudev/libudev-device.c10
-rw-r--r--src/libudev/libudev-private.h2
-rw-r--r--src/udev/udev-node.c13
-rw-r--r--src/udev/udev-rules.c24
-rwxr-xr-xtest/udev-test.pl9
5 files changed, 16 insertions, 42 deletions
diff --git a/src/libudev/libudev-device.c b/src/libudev/libudev-device.c
index 972ace5d39..08476e6596 100644
--- a/src/libudev/libudev-device.c
+++ b/src/libudev/libudev-device.c
@@ -378,12 +378,12 @@ void udev_device_add_property_from_string_parse(struct udev_device *udev_device,
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;
@@ -503,7 +503,7 @@ int udev_device_read_db(struct udev_device *udev_device, const char *dbfile)
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));
@@ -1505,7 +1505,7 @@ int udev_device_set_devnode(struct udev_device *udev_device, const char *devnode
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;
@@ -1513,8 +1513,6 @@ int udev_device_add_devlink(struct udev_device *udev_device, const char *devlink
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;
}
diff --git a/src/libudev/libudev-private.h b/src/libudev/libudev-private.h
index 30c70e6428..2add8b3577 100644
--- a/src/libudev/libudev-private.h
+++ b/src/libudev/libudev-private.h
@@ -50,7 +50,7 @@ struct udev_device *udev_device_new(struct udev *udev);
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);
diff --git a/src/udev/udev-node.c b/src/udev/udev-node.c
index df4c8f0152..ca536be3f5 100644
--- a/src/udev/udev-node.c
+++ b/src/udev/udev-node.c
@@ -250,7 +250,7 @@ void udev_node_update_old_links(struct udev_device *dev, struct udev_device *dev
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);
}
}
@@ -321,13 +321,8 @@ void udev_node_add(struct udev_device *dev, mode_t mode, uid_t uid, gid_t gid)
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)
@@ -337,7 +332,7 @@ 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",
diff --git a/src/udev/udev-rules.c b/src/udev/udev-rules.c
index 0900928d0b..b3b42fe989 100644
--- a/src/udev/udev-rules.c
+++ b/src/udev/udev-rules.c
@@ -202,7 +202,6 @@ struct token {
unsigned int value_off;
union {
unsigned int attr_off;
- int devlink_unique;
unsigned int rule_goto;
mode_t mode;
uid_t uid;
@@ -1020,6 +1019,7 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
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:
@@ -1039,10 +1039,6 @@ static int rule_add_key(struct rule_tmp *rule_tmp, enum token_type type,
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)
@@ -1496,17 +1492,11 @@ static int add_rule(struct udev_rules *rules, char *line,
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;
}
@@ -2578,7 +2568,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
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];
@@ -2588,7 +2578,7 @@ int udev_rules_apply_to_event(struct udev_rules *rules, struct udev_event *event
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;
}
diff --git a/test/udev-test.pl b/test/udev-test.pl
index e91dda11cf..ef3707e09b 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -935,15 +935,6 @@ KERNEL=="sda1", PROGRAM!="/bin/false", SYMLINK+="nonzero-program"
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",