From 5a42932b9a783670ae3406fb2c3462036bb16d32 Mon Sep 17 00:00:00 2001 From: "patmans@us.ibm.com" Date: Thu, 12 Feb 2004 01:24:54 -0800 Subject: [PATCH 1/1] [PATCH] udev kill extra bus_id compares in match_id 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 | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/namedev.c b/namedev.c index 3e2182ae7..59ec08c71 100644 --- a/namedev.c +++ b/namedev.c @@ -469,32 +469,19 @@ static int match_sysfs_pairs(struct config_device *dev, struct sysfs_class_devic 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) -- 2.30.2