linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] udev kill extra bus_id compares in match_id
@ 2004-02-12  0:18 Patrick Mansfield
  2004-02-12  1:26 ` Greg KH
  0 siblings, 1 reply; 2+ messages in thread
From: Patrick Mansfield @ 2004-02-12  0:18 UTC (permalink / raw)
  To: linux-hotplug

Patch against current udev bk.

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 1.100 vs edited ==--- 1.100/namedev.c	Wed Feb 11 15:49:04 2004
+++ edited/namedev.c	Wed Feb 11 16:03:35 2004
@@ -469,32 +469,19 @@
 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)


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] udev kill extra bus_id compares in match_id
  2004-02-12  0:18 [PATCH] udev kill extra bus_id compares in match_id Patrick Mansfield
@ 2004-02-12  1:26 ` Greg KH
  0 siblings, 0 replies; 2+ messages in thread
From: Greg KH @ 2004-02-12  1:26 UTC (permalink / raw)
  To: linux-hotplug

On Wed, Feb 11, 2004 at 04:18:47PM -0800, Patrick Mansfield wrote:
> Patch against current udev bk.
> 
> 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"

Applied, thanks.

greg k-h


-------------------------------------------------------
SF.Net is sponsored by: Speed Start Your Linux Apps Now.
Build and deploy apps & Web services for Linux with
a free DVD software kit from IBM. Click Now!
http://ads.osdn.com/?ad_id\x1356&alloc_id438&op=click
_______________________________________________
Linux-hotplug-devel mailing list  http://linux-hotplug.sourceforge.net
Linux-hotplug-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/linux-hotplug-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-02-12  1:26 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-02-12  0:18 [PATCH] udev kill extra bus_id compares in match_id Patrick Mansfield
2004-02-12  1:26 ` Greg KH

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).