From: Carl-Daniel Hailfinger <c-d.hailfinger.kernel.2004@gmx.net>
To: linux-hotplug@vger.kernel.org
Subject: Re: udevinfo patch
Date: Fri, 26 Mar 2004 00:26:46 +0000 [thread overview]
Message-ID: <406378C6.5000905@gmx.net> (raw)
In-Reply-To: <20040323215101.GA30721@us.ibm.com>
[-- Attachment #1: Type: text/plain, Size: 1061 bytes --]
Greg KH wrote:
> On Tue, Mar 23, 2004 at 01:51:01PM -0800, Daniel Stekloff wrote:
>
>>
>>Hi Greg,
>>
>>I think this is what you want for udevinfo. Patched against the latest BK
>>tree. I tested it and it seemed to work.
It seems to have a bug:
carldani@4100xcdt:~/work/udev-023-orig> ./udevinfo -a -p /sys/block
udevinfo starts with the device the node belongs to and then walks up the
[...]
to match the device for which the node will be created.
looking at class device '/sys/block':
couldn't open class device directory
carldani@4100xcdt:~/work/udev-023-orig> ./udevinfo -a -p /sys/block/
udevinfo starts with the device the node belongs to and then walks up the
[...]
to match the device for which the node will be created.
device '/sys/block' has major:minor 1:9
looking at class device '/sys/block':
couldn't open class device directory
How can /sys/block have a major/minor number which changes everytime I
recompile udevinfo?
> Thanks, I've applied this.
Could you also apply the attached patch to clean up a bit?
Thanks,
Carl-Daniel
[-- Attachment #2: udevinfo.diff --]
[-- Type: text/plain, Size: 1374 bytes --]
diff -urN udev-023-orig/udevinfo.c udev-023/udevinfo.c
--- udev-023-orig/udevinfo.c 2004-03-25 01:09:52.000000000 +0100
+++ udev-023/udevinfo.c 2004-03-26 01:16:13.122194272 +0100
@@ -133,7 +133,7 @@
static int print_device_chain(const char *path)
{
struct sysfs_class_device *class_dev;
- struct sysfs_class_device *class_dev_parent;
+ struct sysfs_class_device *class_dev_basedev;
struct sysfs_attribute *attr;
struct sysfs_device *sysfs_dev;
struct sysfs_device *sysfs_dev_parent;
@@ -166,6 +166,10 @@
goto exit;
}
printf("device '%s' has major:minor %s", class_dev->path, attr->value);
+ } else {
+ printf("this is not a block or char device\n");
+ retval =-1;
+ goto exit;
}
/* open sysfs class device directory and print all attributes */
@@ -176,12 +180,11 @@
goto exit;
}
- /* get the device link (if parent exists look here) */
- class_dev_parent = sysfs_get_classdev_parent(class_dev);
- if (class_dev_parent != NULL)
- sysfs_dev = sysfs_get_classdev_device(class_dev_parent);
- else
- sysfs_dev = sysfs_get_classdev_device(class_dev);
+ /* if parent exists, use that instead */
+ class_dev_basedev = sysfs_get_classdev_parent(class_dev) ? : class_dev;
+
+ /* get the device link */
+ sysfs_dev = sysfs_get_classdev_device(class_dev_basedev);
if (sysfs_dev != NULL)
printf("follow the class device's \"device\"\n");
next prev parent reply other threads:[~2004-03-26 0:26 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 [this message]
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
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=406378C6.5000905@gmx.net \
--to=c-d.hailfinger.kernel.2004@gmx.net \
--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.