- motivation (state pre 2.5):
- no uniform, comprehensive model, only bus specific lists of devices
-
procfs
was getting messy (large files, not hierarchy)
- more and more hotpluggable devices
- generic power and shutdown management impossible
- solution: driver model
- introduced in 2.5, evolved a lot!
- uniform model for representing busses, devices and drivers as a hierarchy
- sysfs
- often confused with driver model
- special file system that exports hierarchical view of all the devices in the system
- driver model can exist without sysfs, but sysfs not without driver model
- Characteristics:
- discoverable (device classes)
- how interconnected?
- cleaner: one value per sysfs file
- handles reference counting
- generic hotplug support
- The driver model is very complex, but fortunately the kernel does most work for us
example
$ tree -L 1 /sys/
/sys/
|-- block
|-- bus
|-- class
|-- devices
|-- firmware
|-- fs
|-- kernel
|-- module
`-- power
explore with
tree(1)