linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] fix udevtrigger first/default/last ordering
@ 2006-04-08 15:51 Thomas de Grenier de Latour
  2006-04-08 16:20 ` Kay Sievers
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Thomas de Grenier de Latour @ 2006-04-08 15:51 UTC (permalink / raw)
  To: linux-hotplug

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

Hi,

There is some logic in udevtrigger (udev-0.89 or current git) to make
some events being triggered first or last. But it doesn't work because,
in device_list_insert(), some "sysfs_path"-prefixed devices paths are
compared to some unprefixed paths (the ones from first_list/last_list).
The attached patch fixes that.

Thanks,

-- 
TGL.

[-- Attachment #2: udevtrigger-ordering.patch --]
[-- Type: text/x-patch, Size: 1048 bytes --]

diff --git a/udevtrigger.c b/udevtrigger.c
index bc8453a..49d6b9c 100644
--- a/udevtrigger.c
+++ b/udevtrigger.c
@@ -36,6 +36,7 @@
 static const char *udev_log_str;
 static int verbose;
 static int dry_run;
+static int sysfs_path_length;
 
 #ifdef USE_LOG
 void log_message(int priority, const char *format, ...)
@@ -77,13 +78,13 @@ static int device_list_insert(const char
 	int i;
 
 	for (i = 0; first_list[i] != NULL; i++) {
-		if (strncmp(path, first_list[i], strlen(first_list[i])) == 0) {
+		if (strncmp(path+sysfs_path_length, first_list[i], strlen(first_list[i])) == 0) {
 			device_list = &device_first_list;
 			break;
 		}
 	}
 	for (i = 0; last_list[i] != NULL; i++) {
-		if (strncmp(path, last_list[i], strlen(last_list[i])) == 0) {
+		if (strncmp(path+sysfs_path_length, last_list[i], strlen(last_list[i])) == 0) {
 			device_list = &device_last_list;
 			break;
 		}
@@ -341,6 +342,7 @@ int main(int argc, char *argv[], char *e
 	}
 
 	sysfs_init();
+	sysfs_path_length=strlen(sysfs_path);
 
 	udev_scan_bus();
 	udev_scan_class();

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

end of thread, other threads:[~2006-04-13  0:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-04-08 15:51 [PATCH] fix udevtrigger first/default/last ordering Thomas de Grenier de Latour
2006-04-08 16:20 ` Kay Sievers
2006-04-12 23:22 ` juuso.alasuutari
2006-04-13  0:51 ` 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).