chiark / gitweb /
[PATCH] udev add wild card compare for ID
authorpatmans@us.ibm.com <patmans@us.ibm.com>
Thu, 12 Feb 2004 09:25:28 +0000 (01:25 -0800)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 04:32:26 +0000 (21:32 -0700)
Allow wild card comparison of the ID.

Using strcmp_pattern here also means we on longer match partial values,
for example, a scsi rule like this won't match anymore:

BUS="scsi", ID=":0", NAME="sdfoo-short-bus_id-1"

But this now works:

BUS="scsi", ID="*:0", NAME="sdfoo-bus_id-wild-card-1"

namedev.c

index 59ec08c715e58bdc92a52f669ecc86b8845e6e1e..e4e585b5cd64b5676a3261a736c6b620f3a6dad5 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -477,8 +477,9 @@ static int match_id(struct config_device *dev, struct sysfs_class_device *class_
 
        strfieldcpy(path, sysfs_device->path);
        temp = strrchr(path, '/');
 
        strfieldcpy(path, sysfs_device->path);
        temp = strrchr(path, '/');
+       temp++;
        dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
        dbg("search '%s' in '%s', path='%s'", dev->id, temp, path);
-       if (strstr(temp, dev->id) == NULL)
+       if (strcmp_pattern(dev->id, temp) != 0)
                return -ENODEV;
        else
                return 0;
                return -ENODEV;
        else
                return 0;