summaryrefslogtreecommitdiff
path: root/udevtest.c
diff options
context:
space:
mode:
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>2004-10-18 19:28:39 -0700
committerGreg KH <gregkh@suse.de>2005-04-26 22:02:46 -0700
commit5d24c6ca364c6232efa626049b03d02c15ab5e85 (patch)
tree972572aae40413a0fb29f2b272a52e1f257c239e /udevtest.c
parent7a947ce51586fd4212447643df90580542777ab9 (diff)
[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.
Diffstat (limited to 'udevtest.c')
-rw-r--r--udevtest.c17
1 files changed, 9 insertions, 8 deletions
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;
}