More sysfs symlinks
This symlink is identical to the information that the kernel has always been emitting to userspace through the hotplug interface whenever a device was created or removed from the system. Userspace uses the subsystem information in order to determine what to do with the device.
If you look at the older hotplug package, it is broken down into a set of different scripts that run depending on the subsystem that is being addressed:
$ ls /etc/hotplug/*.rc /etc/hotplug/input.rc /etc/hotplug/isapnp.rc /etc/hotplug/pci.rc /etc/hotplug/pnp.rc /etc/hotplug/usb.rcAnd udev rules also act on the subsystem type in order to determine what to do with the device:
$ head -n 3 /etc/udev/rules.d/05-udev-early.rules # ignore these events until someone needs them SUBSYSTEM=="drivers", OPTIONS="ignore_device" SUBSYSTEM=="module", OPTIONS="ignore_device"But before this kernel patch, if a program wanted to walk through sysfs and try to determine the subsystem that a specific device was associated with, they had to do the following steps:
- If this is a device, look for the bus symlink and follow it.
- If this is a class device, go up a directory and see if this is a class directory. If not, go up another directory, until the class is found.
$ tree /sys/class/tty/ttyS0/ /sys/class/tty/ttyS0/ |-- dev |-- device -> ../../../devices/platform/serial8250 |-- subsystem -> ../../../class/tty `-- uevent $ tree /sys/devices/pci0000:00/0000:00:00.0/ /sys/devices/pci0000:00/0000:00:00.0/ |-- broken_parity_status |-- bus -> ../../../bus/pci |-- class |-- config |-- device |-- driver -> ../../../bus/pci/drivers/e752x_edac |-- enable |-- irq |-- local_cpus |-- modalias |-- power | |-- state | `-- wakeup |-- resource |-- subsystem -> ../../../bus/pci |-- subsystem_device |-- subsystem_vendor |-- uevent `-- vendor
| Index entries for this article | |
|---|---|
| GuestArticles | Kroah-Hartman, Greg |
