Re: "block" symlink in sysfs for a multifunction device
From: Greg KH
Date: Wed Dec 14 2005 - 00:49:44 EST
On Mon, Dec 12, 2005 at 01:49:04PM -0800, Pete Zaitcev wrote:
> Hi, Greg,
>
> When I plug a USB card reader with multiply LUNs, the following happens:
>
> [zaitcev@niphredil ~]$ ls -l /sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0
> total 0
> -r--r--r-- 1 root root 4096 Dec 12 12:47 bAlternateSetting
> -r--r--r-- 1 root root 4096 Dec 12 12:46 bInterfaceClass
> -r--r--r-- 1 root root 4096 Dec 12 12:46 bInterfaceNumber
> -r--r--r-- 1 root root 4096 Dec 12 12:46 bInterfaceProtocol
> -r--r--r-- 1 root root 4096 Dec 12 12:46 bInterfaceSubClass
> lrwxrwxrwx 1 root root 0 Dec 12 12:47 block -> ../../../../../../block/ubd
> lrwxrwxrwx 1 root root 0 Dec 12 12:47 block -> ../../../../../../block/ubd
> lrwxrwxrwx 1 root root 0 Dec 12 12:47 block -> ../../../../../../block/ubd
> lrwxrwxrwx 1 root root 0 Dec 12 12:47 block -> ../../../../../../block/ubd
> -r--r--r-- 1 root root 4096 Dec 12 12:46 bNumEndpoints
> lrwxrwxrwx 1 root root 0 Dec 12 12:46 bus -> ../../../../../../bus/usb
> -r--r--r-- 1 root root 4096 Dec 12 12:47 diag
> lrwxrwxrwx 1 root root 0 Dec 12 12:46 driver -> ../../../../../../bus/usb/drivers/ub
> -r--r--r-- 1 root root 4096 Dec 12 12:46 modalias
> drwxr-xr-x 2 root root 0 Dec 12 12:46 power
> Do you have a suggestion about the fastest way to accomplish the same
> effect with ub?
Ick, you are right, sorry about this. We changed the class code to add
the class device name to the symlink, because of this very problem. I
forgot to convert the block code to do the same thing. Now, with the
patch below my system looks like:
$ ls -l /sys/block/uba/device/
total 0
-r--r--r-- 1 root root 4096 Dec 13 21:31 bAlternateSetting
-r--r--r-- 1 root root 4096 Dec 13 21:31 bInterfaceClass
-r--r--r-- 1 root root 4096 Dec 13 21:31 bInterfaceNumber
-r--r--r-- 1 root root 4096 Dec 13 21:31 bInterfaceProtocol
-r--r--r-- 1 root root 4096 Dec 13 21:31 bInterfaceSubClass
-r--r--r-- 1 root root 4096 Dec 13 21:31 bNumEndpoints
lrwxrwxrwx 1 root root 0 Dec 13 21:31 block:uba -> ../../../../../../block/uba
lrwxrwxrwx 1 root root 0 Dec 13 21:31 block:ubb -> ../../../../../../block/ubb
lrwxrwxrwx 1 root root 0 Dec 13 21:31 block:ubc -> ../../../../../../block/ubc
lrwxrwxrwx 1 root root 0 Dec 13 21:31 block:ubd -> ../../../../../../block/ubd
lrwxrwxrwx 1 root root 0 Dec 13 13:28 bus -> ../../../../../../bus/usb
-r--r--r-- 1 root root 4096 Dec 13 21:31 diag
lrwxrwxrwx 1 root root 0 Dec 13 21:31 driver -> ../../../../../../bus/usb/drivers/ub
drwxr-xr-x 2 root root 0 Dec 13 21:31 ep_02
drwxr-xr-x 2 root root 0 Dec 13 21:31 ep_82
-r--r--r-- 1 root root 4096 Dec 13 21:31 modalias
drwxr-xr-x 2 root root 0 Dec 13 21:28 power
--w------- 1 root root 4096 Dec 13 21:28 uevent
This will also fix the problem for floppy devices, like Russell pointed
out. Look good to you?
thanks,
greg k-h
-----------------