udev kill extra bus_id compares in match_id
PATCH 1/1 udev kill extra bus_id compares in match_id
Patch against current udev bk.
Kill the extra bus_id check in match_id. This is wrong, especially since we check for rule matches with the parent devices on a given devices path.
For example, given a device path of:
/sys/devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0
With this patch, the following rule will no longer match:
BUS="scsi", ID="host5", NAME="sd-bus_id-host5"
=== namedev.c 1.100 vs edited ==--- 1.100/namedev.c Wed Feb 11 15:49:04 2004
+++ edited/namedev.c Wed Feb 11 16:03:35 2004
@@ -469,32 +469,19 @@
static int match_id(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) {
char path[SYSFS_PATH_MAX];
- int found;
char *temp = NULL;
/* we have to have a sysfs device for ID to work */ if (!sysfs_device)
return -ENODEV;
- found = 0;
strfieldcpy(path, sysfs_device->path);
temp = strrchr(path, '/');
dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
- if (strstr(temp, dev->id) != NULL) {
- found = 1;
- } else {
- *temp = 0x00;
- temp = strrchr(path, '/');
- dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
- if (strstr(temp, dev->id) != NULL)
- found = 1;
- }
- if (!found) {
- dbg("id doesn't match");
+ if (strstr(temp, dev->id) = NULL)
return -ENODEV;
- }
-
- return 0;
+ else
+ return 0;
}
static int match_place(struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device)
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel
Greg KH
AppliedQuoted 5 lines · Patrick Mansfield
Patch against current udev bk.
Kill the extra
bus_idcheck inmatch_id. This is wrong, especially since we check for rule matches with the parent devices on a given devices path.
Quoted 7 lines
For example, given a device path of:
/sys/devices/pci0000:01/0000:01:0c.0/host5/5:0:2:0With this patch, the following rule will no longer match:
BUS="scsi", ID="host5", NAME="sd-bus_id-host5"
Applied, thanks.
greg k-h
-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now. Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id56&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list http://linux-hotplug.sourceforge.net
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel