"block" symlink in sysfs for a multifunction device

From: Pete Zaitcev
Date: Mon Dec 12 2005 - 16:48:55 EST


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
[zaitcev@niphredil ~]$ cat /proc/version
Linux version 2.6.14-nip (zaitcev@niphredil) (gcc version 4.0.2 20051109 (Red Hat 4.0.2-6)) #5 Tue Dec 6 23:10:53 PST 2005
[zaitcev@niphredil ~]$

The usb-storage produces this:

[root@niphredil linux-2.6.14-nip]# find /sys -name block
/sys/block
/sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host0/target0:0:0/0:0:0:3/block
/sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host0/target0:0:0/0:0:0:2/block
/sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host0/target0:0:0/0:0:0:1/block
/sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host0/target0:0:0/0:0:0:0/block
/sys/devices/pci0000:00/0000:00:07.1/ide0/0.0/block
[root@niphredil linux-2.6.14-nip]# ls -l /sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host0/target0:0:0/0:0:0:0/block
lrwxrwxrwx 1 root root 0 Dec 12 13:44 /sys/devices/pci0000:00/0000:00:07.2/usb1/1-2/1-2:1.0/host0/target0:0:0/0:0:0:0/block -> ../../../../../../../../../block/sda
[root@niphredil linux-2.6.14-nip]#

Each "block" is in its own subdirectory.

Do you have a suggestion about the fastest way to accomplish the same
effect with ub?

Thank you,
-- Pete
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/