chiark / gitweb /
[PATCH] add OPTION="last_rule" to skip any later rule
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Sat, 12 Mar 2005 21:55:08 +0000 (22:55 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:53:17 +0000 (23:53 -0700)
test/udev-test.pl
udev_rules.c
udev_rules.h
udev_rules_parse.c

index c7e1a9d47e7f4d3898f9a070e1e4b7d2853888a1..52c5c8d481832ef12e6715ef2041f714bf974b4e 100644 (file)
@@ -1115,9 +1115,18 @@ EOF
                subsys          => "block",
                devpath         => "/block/sda/sda1",
                exp_name        => "start-udev-root-end",
-               option          => "clean",
                conf            => <<EOF
 BUS="scsi", KERNEL="sda1", NAME="start-%r-end"
+EOF
+       },
+       {
+               desc            => "last_rule option",
+               subsys          => "block",
+               devpath         => "/block/sda/sda1",
+               exp_name        => "last",
+               conf            => <<EOF
+BUS="scsi", KERNEL="sda1", SYMLINK="last", OPTIONS="last_rule"
+BUS="scsi", KERNEL="sda1", NAME="very-last"
 EOF
        },
 );
index cbdf7de3178c27c8fb77cfd8f668e83a0ef970a6..16f23ccb04ebc570fc6b66066ce4f47db378fdf4 100644 (file)
@@ -759,6 +759,12 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d
 
                                break;
                        }
+
+                       if (rule->last_rule) {
+                               dbg("last rule to be applied");
+                               break;
+                       }
+
                }
        }
 
index 71c510bce5d07cfc2c644ace714bb76a99141633..42552cfa410ece68203dfb7abddb905a21eff169 100644 (file)
@@ -43,6 +43,7 @@
 #define FIELD_MODE             "MODE"
 #define FIELD_OPTIONS          "OPTIONS"
 
+#define OPTION_LAST_RULE       "last_rule"
 #define OPTION_IGNORE_DEVICE   "ignore_device"
 #define OPTION_IGNORE_REMOVE   "ignore_remove"
 #define OPTION_PARTITIONS      "all_partitions"
@@ -74,9 +75,10 @@ struct udev_rule {
        char group[USER_SIZE];
        mode_t mode;
 
-       int partitions;
+       int last_rule;
        int ignore_device;
        int ignore_remove;
+       int partitions;
 
        char config_file[PATH_SIZE];
        int config_line;
index 4f431decf57acc6694e32beca9434a7e4048d8b6..f77f3db915758e24200e2d6201c14413572641cc 100644 (file)
@@ -283,6 +283,10 @@ static int rules_parse(struct udevice *udev, const char *filename)
                        }
 
                        if (strcasecmp(temp2, FIELD_OPTIONS) == 0) {
+                               if (strstr(temp3, OPTION_LAST_RULE) != NULL) {
+                                       dbg("last rule to be applied");
+                                       rule.last_rule = 1;
+                               }
                                if (strstr(temp3, OPTION_IGNORE_DEVICE) != NULL) {
                                        dbg("device should be ignored");
                                        rule.ignore_device = 1;