All of lore.kernel.org
 help / color / mirror / Atom feed
From: Thomas de Grenier de Latour <degrenier@easyconnect.fr>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] fix udevtrigger first/default/last ordering
Date: Sat, 08 Apr 2006 15:51:57 +0000	[thread overview]
Message-ID: <20060408175157.6dfb3d29@eusebe> (raw)

[-- 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();

             reply	other threads:[~2006-04-08 15:51 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-08 15:51 Thomas de Grenier de Latour [this message]
2006-04-08 16:20 ` [PATCH] fix udevtrigger first/default/last ordering Kay Sievers
2006-04-12 23:22 ` juuso.alasuutari
2006-04-13  0:51 ` Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20060408175157.6dfb3d29@eusebe \
    --to=degrenier@easyconnect.fr \
    --cc=linux-hotplug@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.