summaryrefslogtreecommitdiff
path: root/udev_event.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2005-08-26 21:38:18 +0200
committerKay Sievers <kay.sievers@suse.de>2005-08-26 21:38:18 +0200
commit8f847bb8455f7db8f26893b167fbf8a09cf8f41b (patch)
tree564a15a2896b7162267795053ae83d0b6127ddad /udev_event.c
parentc4ef16f92c56d2f4d8990625212fd27c805425cb (diff)
store ENV{key}="value" exported keys in the database
Just like the IMPORT values are stored in the udev database the exported keys are stored in the udev database. The database is also imported on a remove event before the rules are matched. So it is possible to do: ACTION=="add", KERNEL=="sda", ENV{MY_DEVICE}="1234", RUN+="/bin/logger add $devpath" ACTION=="remove", ENV{MY_DEVICE}=="1234", RUN+="/bin/logger remove $devpath" Signed-off-by: Kay Sievers <kay.sievers@suse.de>
Diffstat (limited to 'udev_event.c')
-rw-r--r--udev_event.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/udev_event.c b/udev_event.c
index 3580ab937f..fae5a46597 100644
--- a/udev_event.c
+++ b/udev_event.c
@@ -91,15 +91,21 @@ int udev_process_event(struct udev_rules *rules, struct udevice *udev)
}
sysfs_close_class_device(class_dev);
} else if (strcmp(udev->action, "remove") == 0) {
+ struct name_entry *name_loop;
+
+ /* get data from db, remove db-entry, delete node */
dbg("node remove");
+ retval = udev_remove_device(udev);
+
+ /* restore stored persistent data */
+ list_for_each_entry(name_loop, &udev->env_list, node)
+ putenv(name_loop->name);
+
udev_rules_get_run(rules, udev, NULL, NULL);
if (udev->ignore_device) {
dbg("device event will be ignored");
return -1;
}
-
- /* get name from db, remove db-entry, delete node */
- retval = udev_remove_device(udev);
}
/* export name of device node or netif */