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. --- udevtest.c | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) (limited to 'udevtest.c') diff --git a/udevtest.c b/udevtest.c index fa1629af25..f2b0c98edb 100644 --- a/udevtest.c +++ b/udevtest.c @@ -69,12 +69,9 @@ int main(int argc, char *argv[], char *envp[]) if (argv[1] == NULL) { info("udevinfo expects the DEVPATH of the sysfs device as a argument"); - goto exit; + return 1; } - /* initialize our configuration */ - udev_init_config(); - /* remove sysfs_path if given */ if (strncmp(argv[1], sysfs_path, strlen(sysfs_path)) == 0) devpath = argv[1] + strlen(sysfs_path); @@ -93,9 +90,12 @@ int main(int argc, char *argv[], char *envp[]) /* we only care about class devices and block stuff */ if (!strstr(devpath, "class") && !strstr(devpath, "block")) { dbg("not a block or class device"); - goto exit; + return 2; } + /* initialize our configuration */ + udev_init_config(); + /* initialize the naming deamon */ namedev_init(); @@ -104,7 +104,6 @@ int main(int argc, char *argv[], char *envp[]) /* fill in values and test_run flag*/ udev_set_values(&udev, devpath, subsystem); - udev.test_run = 1; /* open the device */ snprintf(path, SYSFS_PATH_MAX, "%s%s", sysfs_path, udev.devpath); @@ -114,9 +113,11 @@ int main(int argc, char *argv[], char *envp[]) else dbg("opened class_dev->name='%s'", class_dev->name); - /* simulate node creation with fake flag */ + /* simulate node creation with test flag */ + udev.test_run = 1; udev_add_device(&udev, class_dev); -exit: + sysfs_close_class_device(class_dev); + return 0; } -- cgit v1.2.3-54-g00ecf