diff options
author | Kay Sievers <kay.sievers@suse.de> | 2005-07-07 22:32:48 +0200 |
---|---|---|
committer | Kay Sievers <kay.sievers@suse.de> | 2005-07-07 22:32:48 +0200 |
commit | 613ffbeb15e0507581e5037850c1ea5d56cd0928 (patch) | |
tree | be73472996b204997bda81689b9e6b15c9b8273f | |
parent | b2fe4b9ac96c254efa68d747bfb9843c438919a0 (diff) |
fix default-name handling and NAME="" rules
Signed-off-by: Kay Sievers <kay.sievers@suse.de>
-rw-r--r-- | udev.h | 1 | ||||
-rw-r--r-- | udev_rules.c | 7 | ||||
-rw-r--r-- | udev_rules_parse.c | 7 |
3 files changed, 10 insertions, 5 deletions
@@ -55,7 +55,6 @@ struct udevice { enum device_type type; char name[PATH_SIZE]; - int name_set; char devname[PATH_SIZE]; struct list_head symlink_list; int symlink_final; diff --git a/udev_rules.c b/udev_rules.c index 932a5b9c6f..27fb0a89a6 100644 --- a/udev_rules.c +++ b/udev_rules.c @@ -857,6 +857,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s struct sysfs_class_device *class_dev_parent; struct sysfs_device *sysfs_device = NULL; struct udev_rule *rule; + int name_set = 0; dbg("class_dev->name='%s'", class_dev->name); @@ -888,7 +889,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s if (rule == NULL) break; - if (udev->name_set && rule->name.operation != KEY_OP_UNSET) { + if (name_set && rule->name.operation != KEY_OP_UNSET) { dbg("node name already set, rule ignored"); continue; } @@ -970,7 +971,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s /* set name, later rules with name set will be ignored */ if (rule->name.operation != KEY_OP_UNSET) { - udev->name_set = 1; + name_set = 1; strlcpy(udev->name, key_val(rule, &rule->name), sizeof(udev->name)); apply_format(udev, udev->name, sizeof(udev->name), class_dev, sysfs_device); @@ -1008,7 +1009,7 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev, struct s } } - if (udev->name[0] == '\0') { + if (!name_set) { strlcpy(udev->name, udev->kernel_name, sizeof(udev->name)); info("no rule found, will use kernel name '%s'", udev->name); } diff --git a/udev_rules_parse.c b/udev_rules_parse.c index 2add91fa9f..0021ec40be 100644 --- a/udev_rules_parse.c +++ b/udev_rules_parse.c @@ -365,7 +365,12 @@ static int add_to_rules(struct udev_rules *rules, char *line) rule->ignore_remove = 1; } } - add_rule_key(rule, &rule->name, operation, value); + if (value[0] == '\0') { + dbg("name empty device should be ignored"); + rule->name.operation = operation; + rule->ignore_device = 1; + } else + add_rule_key(rule, &rule->name, operation, value); continue; } |