From: kay.sievers@vrfy.org Date: Thu, 10 Mar 2005 04:15:07 +0000 (+0100) Subject: [PATCH] remove PLACE key match X-Git-Tag: 055~30 X-Git-Url: https://err.no/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=882af735ec18cb4e6ba6f59ca60f8266cc96c330;p=systemd [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. --- diff --git a/namedev.c b/namedev.c index 4b367493..cd1f2de9 100644 --- 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"); diff --git a/namedev.h b/namedev.h index 76caaaa9..d0235996 100644 --- 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]; diff --git a/namedev_parse.c b/namedev_parse.c index b19a5f26..3be40893 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 9699f2e8..c7e1a9d4 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 => < "/block/sda/sda3", exp_name => "Major:8:minor:3:kernelnumber:3:bus:0:0:0:0" , conf => < "/block/sda/sda3", exp_name => "M8-m3-n3-b0:0-sIBM" , conf => <