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. --- udev_remove.c | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) (limited to 'udev_remove.c') diff --git a/udev_remove.c b/udev_remove.c index d97a2411f4..0dcec731ea 100644 --- a/udev_remove.c +++ b/udev_remove.c @@ -36,7 +36,7 @@ #include "namedev.h" #include "udevdb.h" -static int delete_path(char *path) +static int delete_path(const char *path) { char *pos; int retval; @@ -168,14 +168,15 @@ static int delete_node(struct udevice *dev) int udev_remove_device(struct udevice *udev) { struct udevice db_dev; - char *temp; + const char *temp; int retval; - memset(&db_dev, 0x00, sizeof(struct udevice)); + if (udev->type != 'b' && udev->type != 'c') + return 0; retval = udevdb_get_dev(udev->devpath, &db_dev); if (retval == 0) { - /* get stored values in our device */ + /* copy over the stored values to our device */ memcpy(udev, &db_dev, UDEVICE_DB_LEN); } else { /* fall back to kernel name */ @@ -185,15 +186,12 @@ int udev_remove_device(struct udevice *udev) strfieldcpy(udev->name, &temp[1]); dbg("'%s' not found in database, falling back on default name", udev->name); } - dbg("remove name='%s'", udev->name); - dev_d_send(udev); + dbg("remove name='%s'", udev->name); udevdb_delete_dev(udev->devpath); - if (udev->type == 'b' || udev->type == 'c') - retval = delete_node(udev); - else - retval = 0; + /* use full path to the environment */ + snprintf(udev->devname, NAME_SIZE-1, "%s%s", udev_root, udev->name); - return retval; + return delete_node(udev); } -- cgit v1.2.3-54-g00ecf