summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-06-05 04:57:03 +0200
committerKay Sievers <kay.sievers@suse.de>2005-06-05 04:57:03 +0200
commitc974742bf4d6d8fab1e1c90e2e57dae0a2f297a1 (patch)
treef283bf62f4b8b63fb001e1f83382c9ac7848447c /udev_rules.c
parenta15f42c46a7b9ceb5850ea4334c95f099ce74a6f (diff)
udev: allow final assignments :=
The use of KEY:=<value> will make the key unchangeable by later rules. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c20
1 files changed, 15 insertions, 5 deletions
diff --git a/udev_rules.c b/udev_rules.c
index 6f82fac841..42509f16ce 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -754,26 +754,34 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d
}
/* apply permissions */
- if (rule->mode != 0000) {
+ if (!udev->mode_final && rule->mode != 0000) {
+ if (rule->mode_operation == KEY_OP_ASSIGN_FINAL)
+ udev->mode_final = 1;
udev->mode = rule->mode;
dbg("applied mode=%#o to '%s'", udev->mode, udev->kernel_name);
}
- if (rule->owner[0] != '\0') {
+ if (!udev->owner_final && rule->owner[0] != '\0') {
+ if (rule->owner_operation == KEY_OP_ASSIGN_FINAL)
+ udev->owner_final = 1;
strlcpy(udev->owner, rule->owner, sizeof(udev->owner));
apply_format(udev, udev->owner, sizeof(udev->owner), class_dev, sysfs_device);
dbg("applied owner='%s' to '%s'", udev->owner, udev->kernel_name);
}
- if (rule->group[0] != '\0') {
+ if (!udev->group_final && rule->group[0] != '\0') {
+ if (rule->group_operation == KEY_OP_ASSIGN_FINAL)
+ udev->group_final = 1;
strlcpy(udev->group, rule->group, sizeof(udev->group));
apply_format(udev, udev->group, sizeof(udev->group), class_dev, sysfs_device);
dbg("applied group='%s' to '%s'", udev->group, udev->kernel_name);
}
/* collect symlinks */
- if (rule->symlink[0] != '\0') {
+ if (!udev->symlink_final && rule->symlink[0] != '\0') {
char temp[PATH_SIZE];
char *pos, *next;
+ if (rule->symlink_operation == KEY_OP_ASSIGN_FINAL)
+ udev->symlink_final = 1;
info("configured rule in '%s[%i]' applied, added symlink '%s'",
rule->config_file, rule->config_line, rule->symlink);
strlcpy(temp, rule->symlink, sizeof(temp));
@@ -808,9 +816,11 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d
udev->name, udev->owner, udev->group, udev->mode, udev->partitions);
}
- if (rule->run[0] != '\0') {
+ if (!udev->run_final && rule->run[0] != '\0') {
char program[PATH_SIZE];
+ if (rule->run_operation == KEY_OP_ASSIGN_FINAL)
+ udev->run_final = 1;
strlcpy(program, rule->run, sizeof(program));
apply_format(udev, program, sizeof(program), class_dev, sysfs_device);
dbg("add run '%s'", program);