linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Alex Merry <alexander.merry@ccc.ox.ac.uk>
To: linux-hotplug@vger.kernel.org
Subject: [PATCH] incorrectly placed sysfs_init() call in udevtest
Date: Thu, 17 Aug 2006 15:55:54 +0000	[thread overview]
Message-ID: <20060817155554.GA1587@glitch.errata> (raw)


[-- 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

             reply	other threads:[~2006-08-17 15:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-08-17 15:55 Alex Merry [this message]
2006-08-18  0:34 ` [PATCH] incorrectly placed sysfs_init() call in udevtest Kay Sievers

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=20060817155554.GA1587@glitch.errata \
    --to=alexander.merry@ccc.ox.ac.uk \
    --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 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).