- Downloads
sysfs: add /sys/dev/{char,block} to lookup sysfs path by major:minor
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 <neilb@suse.de> Cc: Tejun Heo <htejun@gmail.com> Acked-by:Kay Sievers <kay.sievers@vrfy.org> Reviewed-by:
SL Baur <steve@xemacs.org> Acked-by:
Kay Sievers <kay.sievers@vrfy.org> Acked-by:
Mark Lord <lkml@rtr.ca> Acked-by:
H. Peter Anvin <hpa@zytor.com> Signed-off-by:
Dan Williams <dan.j.williams@intel.com> Signed-off-by:
Greg Kroah-Hartman <gregkh@suse.de>
Showing
- Documentation/ABI/testing/sysfs-dev 20 additions, 0 deletionsDocumentation/ABI/testing/sysfs-dev
- Documentation/filesystems/sysfs.txt 6 additions, 0 deletionsDocumentation/filesystems/sysfs.txt
- block/genhd.c 4 additions, 1 deletionblock/genhd.c
- drivers/base/class.c 4 additions, 0 deletionsdrivers/base/class.c
- drivers/base/core.c 82 additions, 1 deletiondrivers/base/core.c
- drivers/usb/core/devio.c 5 additions, 0 deletionsdrivers/usb/core/devio.c
- include/linux/device.h 3 additions, 0 deletionsinclude/linux/device.h
Loading
Please sign in to comment