<feed xmlns='http://www.w3.org/2005/Atom'>
<title>linux-toradex.git/Documentation/ABI/testing/sysfs-dev, branch v3.10.78</title>
<subtitle>Linux kernel for Apalis and Colibri modules</subtitle>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/'/>
<entry>
<title>sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minor</title>
<updated>2008-07-22T04:54:40+00:00</updated>
<author>
<name>Dan Williams</name>
<email>dan.j.williams@intel.com</email>
</author>
<published>2008-04-21T17:51:07+00:00</published>
<link rel='alternate' type='text/html' href='https://git.toradex.cn/cgit/linux-toradex.git/commit/?id=e105b8bfc769b0545b6f0f395179d1e43cbee822'/>
<id>e105b8bfc769b0545b6f0f395179d1e43cbee822</id>
<content type='text'>
Why?:
There are occasions where userspace would like to access sysfs
attributes for a device but it may not know how sysfs has named the
device or the path.  For example what is the sysfs path for
/dev/disk/by-id/ata-ST3160827AS_5MT004CK?  With this change a call to
stat(2) returns the major:minor then userspace can see that
/sys/dev/block/8:32 links to /sys/block/sdc.

What are the alternatives?:
1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce
   the need to proliferate ioctl interfaces into the kernel, so this
   seems counter productive.

2/ Use udev to create these symlinks: Also doable, but it adds a
   udev dependency to utilities that might be running in a limited
   environment like an initramfs.

3/ Do a full-tree search of sysfs.

[kay.sievers@vrfy.org: fix duplicate registrations]
[kay.sievers@vrfy.org: cleanup suggestions]

Cc: Neil Brown &lt;neilb@suse.de&gt;
Cc: Tejun Heo &lt;htejun@gmail.com&gt;
Acked-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Reviewed-by: SL Baur &lt;steve@xemacs.org&gt;
Acked-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Acked-by: Mark Lord &lt;lkml@rtr.ca&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Why?:
There are occasions where userspace would like to access sysfs
attributes for a device but it may not know how sysfs has named the
device or the path.  For example what is the sysfs path for
/dev/disk/by-id/ata-ST3160827AS_5MT004CK?  With this change a call to
stat(2) returns the major:minor then userspace can see that
/sys/dev/block/8:32 links to /sys/block/sdc.

What are the alternatives?:
1/ Add an ioctl to return the path: Doable, but sysfs is meant to reduce
   the need to proliferate ioctl interfaces into the kernel, so this
   seems counter productive.

2/ Use udev to create these symlinks: Also doable, but it adds a
   udev dependency to utilities that might be running in a limited
   environment like an initramfs.

3/ Do a full-tree search of sysfs.

[kay.sievers@vrfy.org: fix duplicate registrations]
[kay.sievers@vrfy.org: cleanup suggestions]

Cc: Neil Brown &lt;neilb@suse.de&gt;
Cc: Tejun Heo &lt;htejun@gmail.com&gt;
Acked-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Reviewed-by: SL Baur &lt;steve@xemacs.org&gt;
Acked-by: Kay Sievers &lt;kay.sievers@vrfy.org&gt;
Acked-by: Mark Lord &lt;lkml@rtr.ca&gt;
Acked-by: H. Peter Anvin &lt;hpa@zytor.com&gt;
Signed-off-by: Dan Williams &lt;dan.j.williams@intel.com&gt;
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@suse.de&gt;

</pre>
</div>
</content>
</entry>
</feed>
