The sysfs filesystem is a special filesystem similar to /proc that is usually mounted on the /sys directory. The /proc filesystem was the first special filesystem designed to allow user mode applications to access kernel internal data structures. The /sysfs filesystem has essentially the same objective, but it provides additional information on kernel data structures;

Furthermore, /sysfs is organized in a more structured way than /proc. It is designed to handle the device and driver specific options that have previously resided in /proc/, and encompass the dynamic device addition previously offered by devfs.

sysfs /sys directories

 A goal of the sysfs filesystem is to expose the hierarchical relationships among the components of the device driver model. the related top level directories of this filesystem are:

The /block/ directory

    This directory contains directories for each of the block devices on the system. These are mostly disk type devices such as real DASD, loopback devices, and software raid block devices.

The /devices/ directory

    All hardware devices recognized by the kernel, organized according to the bus in which they are connected. Its subdirectories represent all the subchannels detected by the Linux kernel. Subchannel directories are named in the form 0.0.nnnn where nnnn is the subchannel number in hex between 0000 and ffff. Subchannel directories in turn contain status files and another subdirectory which represents the actual device. The device directory is named 0.0.xxxx where xxxx is the unit address for the device. The /devices/ directory also contains status information as well as configuration options for the device.

The /bus/ directory

    The buses in the system, which host the devices.

The /class/ directory

    The types of devices in the system such as ttys, SCSI tape drives, network devices, and other miscellaneous devices and so on. The same class may include devices hosted by different buses and driven by different drivers.

The /module/ directory

    The device drivers registered in the kernel.

The /power/ directory

     Files to handle the power states of some hardware devices.

The /firmware/ directory

    Files to handle the firmware of some hardware devices.



Comments powered by CComment