summaryrefslogtreecommitdiff
path: root/udev_device.c
diff options
context:
space:
mode:
authorKay Sievers <kay.sievers@suse.de>2006-08-19 16:06:25 +0200
committerKay Sievers <kay.sievers@suse.de>2006-08-19 16:06:25 +0200
commit95776dc6ec174f47fa4dd4d8abf5d457223e5dd4 (patch)
treeff9f2e24f8333d460509c7fb987ce2ecb37605e1 /udev_device.c
parenteef7c9a385575375a3e3310900022b37777aeb6c (diff)
consistent key naming to match only the event device or include all parent devices
This scheme is more consistent and makes it obvious if a match happens against the event device only, or the full chain of parent devices. The old key names are now: BUS -> SUBSYSTEMS ID -> KERNELS SYSFS -> ATTRS DRIVER -> DRIVERS Match keys for the event device: KERNEL SUBSYSTEM ATTR DRIVER (in a future release, for now the same as DRIVERS) Match keys for all devices along the parent device chain: KERNELS SUBSYSTEMS ATTRS DRIVERS ID, BUS, SYSFS are no longer mentioned in the man page but still work. DRIVER must be converted to DRIVERS to match the new scheme. For now, an error is logged, if DRIVER is used. In a future release, the DRIVER key behaviour will change.
Diffstat (limited to 'udev_device.c')
-rw-r--r--udev_device.c16
1 files changed, 8 insertions, 8 deletions
diff --git a/udev_device.c b/udev_device.c
index 87f90c7676..b680246bf8 100644
--- a/udev_device.c
+++ b/udev_device.c
@@ -87,7 +87,7 @@ static int rename_netif(struct udevice *udev)
struct ifreq ifr;
int retval;
- info("changing net interface name from '%s' to '%s'", udev->dev->kernel_name, udev->name);
+ info("changing net interface name from '%s' to '%s'", udev->dev->kernel, udev->name);
if (udev->test_run)
return 0;
@@ -98,7 +98,7 @@ static int rename_netif(struct udevice *udev)
}
memset(&ifr, 0x00, sizeof(struct ifreq));
- strlcpy(ifr.ifr_name, udev->dev->kernel_name, IFNAMSIZ);
+ strlcpy(ifr.ifr_name, udev->dev->kernel, IFNAMSIZ);
strlcpy(ifr.ifr_newname, udev->name, IFNAMSIZ);
retval = ioctl(sk, SIOCSIFNAME, &ifr);
if (retval != 0) {
@@ -111,7 +111,7 @@ static int rename_netif(struct udevice *udev)
}
/* free our own name, another process may wait for us */
- strlcpy(ifr.ifr_newname, udev->dev->kernel_name, IFNAMSIZ);
+ strlcpy(ifr.ifr_newname, udev->dev->kernel, IFNAMSIZ);
strlcat(ifr.ifr_newname, "_rename", IFNAMSIZ);
retval = ioctl(sk, SIOCSIFNAME, &ifr);
if (retval != 0) {
@@ -211,7 +211,7 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev)
}
/* look if we want to change the name of the netif */
- if (strcmp(udev->name, udev->dev->kernel_name) != 0) {
+ if (strcmp(udev->name, udev->dev->kernel) != 0) {
char *pos;
retval = rename_netif(udev);
@@ -220,14 +220,14 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev)
info("renamed netif to '%s'", udev->name);
/* export old name */
- setenv("INTERFACE_OLD", udev->dev->kernel_name, 1);
+ setenv("INTERFACE_OLD", udev->dev->kernel, 1);
/* now fake the devpath, because the kernel name changed silently */
pos = strrchr(udev->dev->devpath, '/');
if (pos != NULL) {
pos[1] = '\0';
strlcat(udev->dev->devpath, udev->name, sizeof(udev->dev->devpath));
- strlcpy(udev->dev->kernel_name, udev->name, sizeof(udev->dev->kernel_name));
+ strlcpy(udev->dev->kernel, udev->name, sizeof(udev->dev->kernel));
setenv("DEVPATH", udev->dev->devpath, 1);
setenv("INTERFACE", udev->name, 1);
}
@@ -250,8 +250,8 @@ int udev_device_event(struct udev_rules *rules, struct udevice *udev)
list_for_each_entry(name_loop, &udev->env_list, node)
putenv(name_loop->name);
} else {
- dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel_name);
- strlcpy(udev->name, udev->dev->kernel_name, sizeof(udev->name));
+ dbg("'%s' not found in database, using kernel name '%s'", udev->dev->devpath, udev->dev->kernel);
+ strlcpy(udev->name, udev->dev->kernel, sizeof(udev->name));
}
udev_rules_get_run(rules, udev);