KERNEL=="sda1", NAME=="wrong*", SYMLINK+="wronglink"
KERNEL=="sda1", NAME=="?*", SYMLINK+="link"
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
},
{
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;
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) {
}
}
- 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");