]> err.no Git - systemd/commitdiff
[PATCH] remove PLACE key match
authorkay.sievers@vrfy.org <kay.sievers@vrfy.org>
Thu, 10 Mar 2005 04:15:07 +0000 (05:15 +0100)
committerGreg KH <gregkh@suse.de>
Wed, 27 Apr 2005 06:51:00 +0000 (23:51 -0700)
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.

namedev.c
namedev.h
namedev_parse.c
test/udev-test.pl
udev.8.in

index 4b3674935aa1671ed39245562222a005cd153077..cd1f2de989ea1036319479c3e7374a33d3270e4e 100644 (file)
--- a/namedev.c
+++ b/namedev.c
@@ -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");
index 76caaaa9f7a0685868e2ad22d99605fea4580fcf..d0235996bc22fcf755d0f11bc9204a6f5612dd22 100644 (file)
--- a/namedev.h
+++ b/namedev.h
@@ -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];
index b19a5f26f5a7eee908cf556423fc55af5f96068b..3be408932bc93edbc82485357b86928dbe9ff793 100644 (file)
@@ -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;
index 9699f2e8f50fdcecac17ea0b318ac4ebaaa25659..c7e1a9d47e7f4d3898f9a070e1e4b7d2853888a1 100644 (file)
@@ -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
        },
        {
index 936ec15d2a1ed77b3c49423db917ad3a3789b3f2..e02596053258523a99715330630b5ad1f3d2d1a6 100644 (file)
--- a/udev.8.in
+++ b/udev.8.in
@@ -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"