- /* skip subsystems without "dev", but handle net devices */
- if (udev.type != DEV_NET && subsystem_expect_no_dev(udev.subsystem)) {
- dbg("don't care about '%s' devices", udev.subsystem);
- goto hotplug;
- }
-
- snprintf(path, sizeof(path), "%s%s", sysfs_path, udev.devpath);
- path[sizeof(path)-1] = '\0';
- class_dev = wait_class_device_open(path);
- if (class_dev == NULL) {
- dbg("open class device failed");
- goto hotplug;
- }
- dbg("opened class_dev->name='%s'", class_dev->name);
-
- wait_for_class_device(class_dev, &error);
-
- /* name, create node, store in db */
- retval = udev_add_device(&udev, class_dev);
-
- sysfs_close_class_device(class_dev);
- } else if (strcmp(action, "remove") == 0) {
- /* possibly remove a node */
- dbg("udev remove");
-
- /* skip subsystems without "dev" */
- if (subsystem_expect_no_dev(udev.subsystem)) {
- dbg("don't care about '%s' devices", udev.subsystem);
- goto hotplug;
- }
-
- udev_rules_get_run(&udev);
- if (udev.ignore_device) {
- dbg("device event will be ignored");
- goto hotplug;
- }
-
- /* get node from db, remove db-entry, delete created node */
- retval = udev_remove_device(&udev);
- }
-
- if (udev.devname[0] != '\0')
- setenv("DEVNAME", udev.devname, 1);
-
- if (udev_run && !list_empty(&udev.run_list)) {
- struct name_entry *name_loop;
-
- dbg("executing run list");
- list_for_each_entry(name_loop, &udev.run_list, node)
- execute_command(name_loop->name, udev.subsystem);
- }