From mboxrd@z Thu Jan 1 00:00:00 1970 From: Thomas de Grenier de Latour Date: Sat, 08 Apr 2006 15:51:57 +0000 Subject: [PATCH] fix udevtrigger first/default/last ordering Message-Id: <20060408175157.6dfb3d29@eusebe> MIME-Version: 1 Content-Type: multipart/mixed; boundary="MP_VOynWnIOwUwQfZxaNXzKxcB" List-Id: To: linux-hotplug@vger.kernel.org --MP_VOynWnIOwUwQfZxaNXzKxcB Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Content-Disposition: inline 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. --MP_VOynWnIOwUwQfZxaNXzKxcB Content-Type: text/x-patch; name=udevtrigger-ordering.patch Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename=udevtrigger-ordering.patch 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(); --MP_VOynWnIOwUwQfZxaNXzKxcB-- ------------------------------------------------------- This SF.Net email is sponsored by xPML, a groundbreaking scripting language that extends applications into web and mobile media. Attend the live webcast and join the prime developer group breaking into this new coding territory! http://sel.as-us.falkag.net/sel?cmd=lnk&kid=110944&bid=241720&dat=121642 _______________________________________________ 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