linux-hotplug.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Kay Sievers <kay.sievers@vrfy.org>
To: linux-hotplug@vger.kernel.org
Subject: Re: udevinfo patch
Date: Fri, 26 Mar 2004 17:19:47 +0000	[thread overview]
Message-ID: <20040326171947.GA493@vrfy.org> (raw)
In-Reply-To: <20040323215101.GA30721@us.ibm.com>

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

On Fri, Mar 26, 2004 at 06:36:32PM +0500, Ananth N Mavinakayanahalli wrote:
> On Fri, Mar 26, 2004 at 11:24:39AM +0100, Kay Sievers wrote:
> > On Fri, Mar 26, 2004 at 11:21:29AM +0500, Ananth N Mavinakayanahalli wrote:
> > > On Fri, Mar 26, 2004 at 04:47:35AM +0100, Kay Sievers wrote:
> > > > On Fri, Mar 26, 2004 at 01:26:46AM +0100, Carl-Daniel Hailfinger wrote:
> > > > > Greg KH wrote:
> > > > > > On Tue, Mar 23, 2004 at 01:51:01PM -0800, Daniel Stekloff wrote:
> > > > 
> > > > No, it breaks the net device handling. I think we should change
> > > > libsysfs instead, not to return a class device for '/block', if
> > > > we want to fix it.
> > > 
> > > /sys/block is considered a sysfs "class" and not a class_device. So, 
> > > going by udevinfo's help, -p expects path to a class_device and _not_ 
> > > a class itself and hence option /sys/block with -p is not a valid query. 
> > > 
> > > Kay?
> > 
> > Yes, it's invalid, but we shouldn't print major minor for a invalid
> > path. sysfs_open_class_device_path("/block") returns a device. If this is
> > the right behavior for libsysfs, I will change the get_device_type("/block")
> > not to return a 'b'-type.
> 
> Libsysfs validates the path given to it for opening a class_device to be
> a valid directory; it does not however validate if the path is a valid
> class_device path. So, in the case of udevinfo, a 'b' type should not 
> be returned if the path is just /sys/block or /sys/block/

This may prevent it.

thanks,
Kay

[-- Attachment #2: 03-get_dev.patch --]
[-- Type: text/plain, Size: 1010 bytes --]

===== udev_lib.c 1.3 vs edited =====
--- 1.3/udev_lib.c	Thu Mar 25 00:50:34 2004
+++ edited/udev_lib.c	Fri Mar 26 18:18:34 2004
@@ -81,17 +81,28 @@
 	return subsystem;
 }
 
+#define BLOCK_PATH		"/block/"
+#define CLASS_PATH		"/class/"
+#define NET_PATH		"/class/net/"
+
 char get_device_type(const char *path, const char *subsystem)
 {
-	if (strcmp(subsystem, "block") == 0 ||
-	    strstr(path, "/block/") != NULL)
+	if (strcmp(subsystem, "block") == 0)
+		return 'b';
+
+	if (strcmp(subsystem, "net") == 0)
+		return 'n';
+
+	if (strncmp(path, BLOCK_PATH, strlen(BLOCK_PATH)) == 0 &&
+	    strlen(path) > strlen(BLOCK_PATH))
 		return 'b';
 
-	if (strcmp(subsystem, "net") == 0 ||
-	    strstr(path, "/class/net/") != NULL)
+	if (strncmp(path, NET_PATH, strlen(NET_PATH)) == 0 &&
+	    strlen(path) > strlen(NET_PATH))
 		return 'n';
 
-	if (strstr(path, "/class/") != NULL)
+	if (strncmp(path, CLASS_PATH, strlen(CLASS_PATH)) == 0 &&
+	    strlen(path) > strlen(CLASS_PATH))
 		return 'c';
 
 	return '\0';

  parent reply	other threads:[~2004-03-26 17:19 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-03-23 21:51 udevinfo patch Daniel Stekloff
2004-03-23 22:42 ` Kay Sievers
2004-03-24 17:49 ` Greg KH
2004-03-26  0:26 ` Carl-Daniel Hailfinger
2004-03-26  3:47 ` Kay Sievers
2004-03-26  5:25 ` Carl-Daniel Hailfinger
2004-03-26  5:35 ` Ananth N Mavinakayanahalli
2004-03-26 10:15 ` Kay Sievers
2004-03-26 10:24 ` Kay Sievers
2004-03-26 12:50 ` Ananth N Mavinakayanahalli
2004-03-26 16:43 ` Carl-Daniel Hailfinger
2004-03-26 17:19 ` Kay Sievers [this message]
2004-03-31 23:00 ` 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=20040326171947.GA493@vrfy.org \
    --to=kay.sievers@vrfy.org \
    --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).