summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-06-24 18:05:32 +0200
committerKay Sievers <kay.sievers@suse.de>2005-06-24 18:05:32 +0200
commit6bf0ffe8fd312c1e6549cb1721d7a7efeee77185 (patch)
treed05153602e1589a0a519a3d49fed1d44e7188cc9 /udev_rules.c
parentc9b8dbfb652a10d2f1c1b122a3806c21cab87ab4 (diff)
allow rules to be compiled to one binary file
All the rule files can be compiled into a single file, which can be mapped into the udev process to avoid parsing the rules with every event. Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c15
1 files changed, 12 insertions, 3 deletions
diff --git a/udev_rules.c b/udev_rules.c
index 52e0712d35..c416128b62 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -846,7 +846,12 @@ int udev_rules_get_name(struct udevice *udev, struct sysfs_class_device *class_d
dbg("udev->kernel_name='%s'", udev->kernel_name);
/* look for a matching rule to apply */
- list_for_each_entry(rule, &udev_rule_list, node) {
+ udev_rules_iter_init();
+ while (1) {
+ rule = udev_rules_iter_next();
+ if (rule == NULL)
+ break;
+
if (udev->name_set && rule->name_operation != KEY_OP_UNSET) {
dbg("node name already set, rule ignored");
continue;
@@ -1000,9 +1005,13 @@ int udev_rules_get_run(struct udevice *udev, struct sysfs_device *sysfs_device)
struct udev_rule *rule;
/* look for a matching rule to apply */
- list_for_each_entry(rule, &udev_rule_list, node) {
- dbg("process rule");
+ udev_rules_iter_init();
+ while (1) {
+ rule = udev_rules_iter_next();
+ if (rule == NULL)
+ break;
+ dbg("process rule");
if (rule->run_operation == KEY_OP_UNSET)
continue;