summaryrefslogtreecommitdiff
path: root/udev_rules.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@vrfy.org>2007-07-14 20:44:19 +0200
committerKay Sievers <kay.sievers@vrfy.org>2007-07-14 20:44:19 +0200
commit274da2b23d37f2dd174f765e9cfcc485e4a5a898 (patch)
tree93a296ef8b7674e9265f1dbd11e5da9b8cc915eb /udev_rules.c
parentfb819f5554530dd136d50aa40438e9dbeeceac01 (diff)
add udev_rules_run() to handle RUN list
Diffstat (limited to 'udev_rules.c')
-rw-r--r--udev_rules.c23
1 files changed, 23 insertions, 0 deletions
diff --git a/udev_rules.c b/udev_rules.c
index 9483c2b8f8..a8fd18cf8a 100644
--- a/udev_rules.c
+++ b/udev_rules.c
@@ -238,6 +238,29 @@ static int import_parent_into_env(struct udevice *udev, const char *filter)
return rc;
}
+int udev_rules_run(struct udevice *udev)
+{
+ struct name_entry *name_loop;
+ int retval = 0;
+
+ dbg("executing run list");
+ list_for_each_entry(name_loop, &udev->run_list, node) {
+ if (strncmp(name_loop->name, "socket:", strlen("socket:")) == 0) {
+ pass_env_to_socket(&name_loop->name[strlen("socket:")], udev->dev->devpath, udev->action);
+ } else {
+ char program[PATH_SIZE];
+
+ strlcpy(program, name_loop->name, sizeof(program));
+ udev_rules_apply_format(udev, program, sizeof(program));
+ if (run_program(program, udev->dev->subsystem, NULL, 0, NULL) != 0)
+ if (!name_loop->ignore_error)
+ retval = -1;
+ }
+ }
+
+ return retval;
+}
+
#define WAIT_LOOP_PER_SECOND 50
static int wait_for_sysfs(struct udevice *udev, const char *file, int timeout)
{