1
1
mirror of https://github.com/systemd/systemd-stable.git synced 2025-01-11 05:17:44 +03:00

[PATCH] add OPTION="last_rule" to skip any later rule

This commit is contained in:
kay.sievers@vrfy.org 2005-03-12 22:55:08 +01:00 committed by Greg KH
parent e5e322bc62
commit 3b6ed8bb06
4 changed files with 23 additions and 2 deletions

View 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
},
);

View 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;
}
}
}

View 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;

View 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;