linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] incorrectly placed sysfs_init() call in udevtest
@ 2006-08-17 15:55 Alex Merry
  2006-08-18  0:34 ` Kay Sievers
  0 siblings, 1 reply; 2+ messages in thread
From: Alex Merry @ 2006-08-17 15:55 UTC (permalink / raw)
  To: linux-hotplug


[-- Attachment #1.1.1: Type: text/plain, Size: 938 bytes --]

The udevtest documentation doesn't make this explicitly clear, but
udevtest should treat device paths in the same way as udevinfo: it
should strip the leading /sys (or whatever sysfs_path is) if given. In
fact, there is code in udevtest.c designed to do just this.

However, sysfs_init() is called _after_ this code, which uses
sysfs_path. So, at the time it checks whether sysfs_path is at the front
of the device path, sysfs_path is an empty string. As a result, the
command
  udevtest /sys/block/hda
fails with the message
  main: unable to open '/sys/block/hda'
while
  udevtest /block/hda
produces the expected output (assuming you have at least one ide drive).

The attached patch moves sysfs_init() to the same place as udev_init(),
and before the code that uses sysfs_path.

Diff against udev-097.

Alex :-)

-- 
Pippin
Computer Monkey to the Pelican
www.oxrev.org.uk, www.corpusjcr.org, www.rev.org.uk

[-- Attachment #1.1.2: udev-097-udevtest_sysfs-1.patch --]
[-- Type: text/plain, Size: 519 bytes --]

diff -urw udev-097.orig/udevtest.c udev-097/udevtest.c
--- udev-097.orig/udevtest.c	2006-08-17 12:01:45.000000000 +0100
+++ udev-097/udevtest.c	2006-08-17 12:02:09.000000000 +0100
@@ -64,6 +64,7 @@
 	udev_config_init();
 	if (udev_log_priority < LOG_INFO)
 		udev_log_priority = LOG_INFO;
+	sysfs_init();
 
 	if (argc != 2) {
 		info("Usage: udevtest <devpath>");
@@ -82,7 +83,6 @@
 		} else
 			devpath = argv[1];
 
-	sysfs_init();
 	udev_rules_init(&rules, 0);
 
 	dev = sysfs_device_get(devpath);

[-- Attachment #1.2: Type: application/pgp-signature, Size: 189 bytes --]

[-- Attachment #2: Type: text/plain, Size: 373 bytes --]

-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642

[-- Attachment #3: Type: text/plain, Size: 226 bytes --]

_______________________________________________
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:[~2006-08-18  0:34 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-08-17 15:55 [PATCH] incorrectly placed sysfs_init() call in udevtest Alex Merry
2006-08-18  0:34 ` Kay Sievers

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).