- int retval;
- int res;
- int status;
- int fds[2];
- pid_t pid;
- int value_set = 0;
- char buffer[255];
- char *pos;
-
- retval = pipe(fds);
- if (retval != 0) {
- dbg("pipe failed");
- return -1;
- }
- pid = fork();
- switch(pid) {
- case 0:
- /* child */
- close(STDOUT_FILENO);
-
- /* dup write side of pipe to STDOUT */
- dup(fds[1]);
-
- dbg("executing /sbin/udev '%s'", path);
- retval = execl("/sbin/udev", "/sbin/udev", path, NULL);
-
- info("execution of '%s' failed", path);
- exit(1);
- case -1:
- dbg("fork failed");
- return -1;
- default:
- /* parent reads from fds[0] */
- close(fds[1]);
- retval = 0;
- while (1) {
- res = read(fds[0], buffer, sizeof(buffer) - 1);
- if (res <= 0)
+ char *argv[3];
+
+ /* fake argument vector and environment for callouts and dev.d/ */
+ argv[0] = "udev";
+ argv[1] = subsys;
+ argv[2] = NULL;
+
+ main_argv = argv;
+ setenv("DEVPATH", path, 1);
+ setenv("ACTION", "add", 1);
+ udev_add_device(path, subsys, fake);
+}
+
+static void exec_list(struct list_head *device_list)
+{
+ struct device *loop_device;
+ struct device *tmp_device;
+ int i;
+
+ /* handle the "first" type devices first */
+ list_for_each_entry_safe(loop_device, tmp_device, device_list, list) {
+ for (i=0; first_list[i] != NULL; i++) {
+ if (strncmp(loop_device->path, first_list[i], strlen(first_list[i])) == 0) {
+ add_device(loop_device->path, loop_device->subsys, NOFAKE);
+ list_del(&loop_device->list);
+ free(loop_device);