summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-07-25 15:29:14 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-07-25 15:29:14 +0200
commit19096c087f8e1fc9f60ceb948f8be9b179885569 (patch)
treee94d402f9893b1c237104cfe68cbac16d3c825f5
parentfea9b2d2924235a459e888ecd35a8b43093b9542 (diff)
restore behavior of NAME==
-rwxr-xr-xtest/udev-test.pl12
-rw-r--r--udev_rules.c8
2 files changed, 16 insertions, 4 deletions
diff --git a/test/udev-test.pl b/test/udev-test.pl
index a2043080e9..53499d8871 100755
--- a/test/udev-test.pl
+++ b/test/udev-test.pl
@@ -1519,6 +1519,18 @@ KERNEL=="sda1", NAME=="node*", SYMLINK+="link2"
EOF
},
{
+ desc => "NAME compare test 2",
+ subsys => "block",
+ devpath => "/block/sda/sda1",
+ exp_name => "link2",
+ exp_target => "sda1",
+ not_exp_name => "link",
+ rules => <<EOF
+KERNEL=="sda1", NAME=="?*", SYMLINK+="link"
+KERNEL=="sda1", NAME!="?*", SYMLINK+="link2"
+EOF
+ },
+ {
desc => "invalid key operation",
subsys => "block",
devpath => "/block/sda/sda1",
diff --git a/udev_rules.c b/udev_rules.c
index 3674a27d63..e2877abe70 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -948,6 +948,7 @@ static int match_rule(struct udevice *udev, struct udev_rule *rule)
if (match_key("DRIVER", rule, &rule->driver, udev->dev->driver))
goto nomatch;
+ /* match NAME against a value assigned by an earlier rule */
if (match_key("NAME", rule, &rule->name, udev->name))
goto nomatch;
@@ -1273,9 +1274,6 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev)
dbg("udev->dev->devpath='%s'", udev->dev->devpath);
dbg("udev->dev->kernel='%s'", udev->dev->kernel);
- /* use kernel name as default node name */
- strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name));
-
/* look for a matching rule to apply */
udev_rules_iter_init(rules);
while (1) {
@@ -1430,8 +1428,10 @@ int udev_rules_get_name(struct udev_rules *rules, struct udevice *udev)
}
}
- if (!name_set)
+ if (!name_set) {
info("no node name set, will use kernel name '%s'", udev->name);
+ strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name));
+ }
if (udev->tmp_node[0] != '\0') {
dbg("removing temporary device node");