summaryrefslogtreecommitdiff
path: root/dev_d.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-11-12 06:20:22 +0100
committerGreg KH <gregkh@suse.de>2005-04-26 22:24:38 -0700
commitaf4b05d4917fdfa55eff3d8d53a830464d8162a1 (patch)
tree352f8b4180c9be6f848c7f69517783b7912c42d3 /dev_d.c
parent13f24d596c5638443ffc7bc48c10a66758335c74 (diff)
[PATCH] make the udev object available to more processing stages
Remove the overwriting of main_argv[] hack and use the values from the udev object. Pass the udev object to call_foreach_file(). In the udevstart case, export SUBSYSTEM and UDEVSTART to the environment.
Diffstat (limited to 'dev_d.c')
-rw-r--r--dev_d.c20
1 files changed, 8 insertions, 12 deletions
diff --git a/dev_d.c b/dev_d.c
index 6e35f55ca2..1108c8cee4 100644
--- a/dev_d.c
+++ b/dev_d.c
@@ -35,13 +35,13 @@
#define DEVD_DIR "/etc/dev.d/"
#define DEVD_SUFFIX ".dev"
-static int run_program(char *name)
+static int run_program(const char *filename, void *data)
{
pid_t pid;
int fd;
- char *argv[3];
+ struct udevice *udev = data;
- dbg("running %s", name);
+ dbg("running %s", filename);
pid = fork();
switch (pid) {
@@ -55,11 +55,7 @@ static int run_program(char *name)
}
close(fd);
- argv[0] = name;
- argv[1] = main_argv[1];
- argv[2] = NULL;
-
- execv(name, argv);
+ execl(filename, filename, udev->subsystem, NULL);
dbg("exec of child failed");
_exit(1);
case -1:
@@ -105,7 +101,7 @@ void dev_d_execute(struct udevice *udev)
temp[0] = '\0';
strcpy(dirname, DEVD_DIR);
strfieldcat(dirname, devname);
- call_foreach_file(run_program, dirname, DEVD_SUFFIX);
+ call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev);
temp[0] = '/';
++temp;
@@ -114,12 +110,12 @@ void dev_d_execute(struct udevice *udev)
strcpy(dirname, DEVD_DIR);
strfieldcat(dirname, udev->name);
- call_foreach_file(run_program, dirname, DEVD_SUFFIX);
+ call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev);
strcpy(dirname, DEVD_DIR);
strfieldcat(dirname, udev->subsystem);
- call_foreach_file(run_program, dirname, DEVD_SUFFIX);
+ call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev);
strcpy(dirname, DEVD_DIR "default");
- call_foreach_file(run_program, dirname, DEVD_SUFFIX);
+ call_foreach_file(run_program, dirname, DEVD_SUFFIX, udev);
}