diff options
author | kay.sievers@vrfy.org <kay.sievers@vrfy.org> | 2005-03-10 05:15:07 +0100 |
---|---|---|
committer | Greg KH <gregkh@suse.de> | 2005-04-26 23:51:00 -0700 |
commit | 882af735ec18cb4e6ba6f59ca60f8266cc96c330 (patch) | |
tree | 9a2953bd0ea3c94cbf8dcda3b42842b959e07347 | |
parent | 783272f045faf39325678eef0d55a41d7306e2d3 (diff) |
[PATCH] remove PLACE key match
ID should do the same, cause we walk up the chain of devices on the
physical device and can match for the name of every device there with
the ID key.
-rw-r--r-- | namedev.c | 36 | ||||
-rw-r--r-- | namedev.h | 2 | ||||
-rw-r--r-- | namedev_parse.c | 10 | ||||
-rw-r--r-- | test/udev-test.pl | 6 | ||||
-rw-r--r-- | udev.8.in | 5 |
5 files changed, 6 insertions, 53 deletions
@@ -531,28 +531,6 @@ static int match_id(struct config_device *dev, struct sysfs_device *sysfs_device return 0; } -static int match_place(struct config_device *dev, struct sysfs_device *sysfs_device) -{ - char path[PATH_SIZE]; - char *temp; - - strlcpy(path, sysfs_device->path, sizeof(path)); - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) != NULL) - return 0; - - /* try the parent */ - temp[0] = '\0'; - temp = strrchr(path, '/'); - dbg("search '%s' in '%s', path='%s'", dev->place, temp, path); - if (strstr(temp, dev->place) == NULL) - return 0; - - dbg("place doesn't match"); - return -ENODEV; -} - static int match_rule(struct udevice *udev, struct config_device *dev, struct sysfs_class_device *class_dev, struct sysfs_device *sysfs_device) { @@ -622,20 +600,6 @@ static int match_rule(struct udevice *udev, struct config_device *dev, dbg(FIELD_ID " matches"); } - /* check for matching place of device */ - if (dev->place[0] != '\0') { - if (sysfs_device == NULL) { - dbg("device has no sysfs_device"); - goto try_parent; - } - dbg("check " FIELD_PLACE); - if (match_place(dev, sysfs_device) != 0) { - dbg(FIELD_PLACE " is not matching"); - goto try_parent; - } - dbg(FIELD_PLACE " matches"); - } - /* check for matching sysfs pairs */ if (dev->sysfs_pair[0].file[0] != '\0') { dbg("check " FIELD_SYSFS " pairs"); @@ -33,7 +33,6 @@ struct sysfs_class_device; #define FIELD_BUS "BUS" #define FIELD_SYSFS "SYSFS" #define FIELD_ID "ID" -#define FIELD_PLACE "PLACE" #define FIELD_PROGRAM "PROGRAM" #define FIELD_RESULT "RESULT" #define FIELD_DRIVER "DRIVER" @@ -64,7 +63,6 @@ struct config_device { char subsystem[NAME_SIZE]; char bus[NAME_SIZE]; char id[NAME_SIZE]; - char place[NAME_SIZE]; struct sysfs_pair sysfs_pair[MAX_SYSFS_PAIRS]; char program[PATH_SIZE]; char result[PATH_SIZE]; diff --git a/namedev_parse.c b/namedev_parse.c index b19a5f26f5..3be408932b 100644 --- a/namedev_parse.c +++ b/namedev_parse.c @@ -59,11 +59,11 @@ static int add_config_dev(struct config_device *new_dev) void dump_config_dev(struct config_device *dev) { - dbg_parse("name='%s', symlink='%s', bus='%s', place='%s', id='%s', " + dbg_parse("name='%s', symlink='%s', bus='%s', id='%s', " "sysfs_file[0]='%s', sysfs_value[0]='%s', " "kernel='%s', program='%s', result='%s'" "owner='%s', group='%s', mode=%#o", - dev->name, dev->symlink, dev->bus, dev->place, dev->id, + dev->name, dev->symlink, dev->bus, dev->id, dev->sysfs_pair[0].file, dev->sysfs_pair[0].value, dev->kernel, dev->program, dev->result, dev->owner, dev->group, dev->mode); @@ -196,12 +196,6 @@ static int namedev_parse(struct udevice *udev, const char *filename) continue; } - if (strcasecmp(temp2, FIELD_PLACE) == 0) { - strlcpy(dev.place, temp3, sizeof(dev.place)); - valid = 1; - continue; - } - if (strncasecmp(temp2, FIELD_SYSFS, sizeof(FIELD_SYSFS)-1) == 0) { struct sysfs_pair *pair = &dev.sysfs_pair[0]; int sysfs_pair_num = 0; diff --git a/test/udev-test.pl b/test/udev-test.pl index 9699f2e8f5..c7e1a9d47e 100644 --- a/test/udev-test.pl +++ b/test/udev-test.pl @@ -237,7 +237,7 @@ EOF devpath => "/block/sda/sda3", exp_name => "first_disk3" , conf => <<EOF -BUS="scsi", PLACE="0:0:0:0", NAME="first_disk%n" +BUS="scsi", ID="0:0:0:0", NAME="first_disk%n" EOF }, { @@ -246,7 +246,7 @@ EOF devpath => "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => <<EOF -BUS="scsi", PLACE="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" +BUS="scsi", ID="0:0:0:0", NAME="Major:%M:minor:%m:kernelnumber:%n:bus:%b" EOF }, { @@ -255,7 +255,7 @@ EOF devpath => "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , conf => <<EOF -BUS="scsi", PLACE="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}" +BUS="scsi", ID="0:0:0:0", NAME="M%M-m%m-n%n-b%3b-s%3s{vendor}" EOF }, { @@ -114,9 +114,6 @@ Match the kernel driver name. .B ID Match the device number on the bus, like PCI bus id. .TP -.B PLACE -Match the topological position on bus, like physical port of USB device -.TP .BI SYSFS{ filename } Match sysfs device attribute like label, vendor, USB serial number, SCSI UUID or file system label. Up to 5 different sysfs files can be checked, with @@ -255,7 +252,7 @@ BUS="scsi", SYSFS{vendor}="IBM", SYSFS{model}="ST336", NAME="boot%n" BUS="pci", ID="00:0b.0", NAME="dsp" # USB mouse at third port of the second hub to be called mouse1 -BUS="usb", PLACE="2.3", NAME="mouse1" +BUS="usb", ID="2.3", NAME="mouse1" # ttyUSB1 should always be called pda with two additional symlinks KERNEL="ttyUSB1", NAME="pda", SYMLINK="palmtop handheld" |