From 5d24c6ca364c6232efa626049b03d02c15ab5e85 Mon Sep 17 00:00:00 2001 From: "kay.sievers@vrfy.org" Date: Mon, 18 Oct 2004 19:28:39 -0700 Subject: [PATCH] cleanup netif handling and netif-dev.d/ events Here we supress the dev.d/ execution if we didn't change a network interface's name with a rule. This should solve the issue of two running dhclients for the same interface, cause the /etc/dev.d/net/hotplug.dev script that fakes the hotplug event runs with every udevstart for every interface and fakes a second identical hotplug event on bootup. With this patch netif interfaces are no longer stored in the udevdb. It is not needed, cause we don't have permissions or symlinks :) and all information is available in sysfs. This patch also moves the dev_d execution calls out of the udev_add/udev_remove. As with the former api-cleanup-patch we have all processed data in one udev struct and can place the execution calls where needed. --- udevstart.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'udevstart.c') diff --git a/udevstart.c b/udevstart.c index c4ec0f7b7a..fd490f0791 100644 --- a/udevstart.c +++ b/udevstart.c @@ -103,7 +103,7 @@ static int add_device(char *devpath, char *subsystem) setenv("DEVPATH", devpath, 1); setenv("ACTION", "add", 1); - snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, devpath); + snprintf(path, SYSFS_PATH_MAX-1, "%s%s", sysfs_path, devpath); class_dev = sysfs_open_class_device_path(path); if (class_dev == NULL) { dbg ("sysfs_open_class_device_path failed"); @@ -111,8 +111,14 @@ static int add_device(char *devpath, char *subsystem) } udev_set_values(&udev, devpath, subsystem); + udev_add_device(&udev, class_dev); - return udev_add_device(&udev, class_dev); + /* run scripts */ + dev_d_execute(&udev); + + sysfs_close_class_device(class_dev); + + return 0; } static void exec_list(struct list_head *device_list) -- cgit v1.2.3-54-g00ecf