This is very useful feature came from Linux 2.6 kernel. It provides a uniform way to exports system information to user space via in-memory filesystem. Whenever a driver is registered in kernel , driver framework creates directories under /sysfs based on driver type and values in its data structures. This is designed to handle device and driver related options.
Sysfs has two components -
1 : A programming interface for exporting system information.
2 : A user interface to view and modify these information.
Root /sysfs contains following directories -
sys/block : It contains each block device that has been discovered in the system.
sys/bus : It contains each physical bus which has support registered in kernel.
sys/device : It contains every physical device that has been discovered by bus types registered with kernel. It has file-system representation of device tree.
sys/class : It contains class (like audio or network) of every device registered in kernel.
sys/firmware : It contains interface for manipulating firmware specific attributes.
sys/module : It contains subdirectories for each module loaded in kernel.
sys/power : It contains files to handle power state of system.
sys/fs : It contains files to control various filesystem.
sys/kernel : It contains various kernel related files.
Sample output-
narendra@narendra-VirtualBox ~ $ ls -l /sys/
total 0
drwxr-xr-x 2 root root 0 Jun 6 11:37 block
drwxr-xr-x 12 root root 0 Jun 6 11:37 bus
drwxr-xr-x 26 root root 0 Jun 6 11:37 class
drwxr-xr-x 4 root root 0 Jun 6 11:37 dev
drwxr-xr-x 8 root root 0 Jun 6 11:37 devices
drwxr-xr-x 4 root root 0 Jun 6 11:37 firmware
drwxr-xr-x 4 root root 0 Jun 6 11:37 fs
drwxr-xr-x 5 root root 0 Jun 6 11:37 kernel
drwxr-xr-x 54 root root 0 Jun 6 11:37 module
drwxr-xr-x 2 root root 0 Jun 6 11:37 power
Note : Check ouput of man sysfs
Sysfs has two components -
1 : A programming interface for exporting system information.
2 : A user interface to view and modify these information.
Root /sysfs contains following directories -
sys/block : It contains each block device that has been discovered in the system.
sys/bus : It contains each physical bus which has support registered in kernel.
sys/device : It contains every physical device that has been discovered by bus types registered with kernel. It has file-system representation of device tree.
sys/class : It contains class (like audio or network) of every device registered in kernel.
sys/firmware : It contains interface for manipulating firmware specific attributes.
sys/module : It contains subdirectories for each module loaded in kernel.
sys/power : It contains files to handle power state of system.
sys/fs : It contains files to control various filesystem.
sys/kernel : It contains various kernel related files.
Sample output-
narendra@narendra-VirtualBox ~ $ ls -l /sys/
total 0
drwxr-xr-x 2 root root 0 Jun 6 11:37 block
drwxr-xr-x 12 root root 0 Jun 6 11:37 bus
drwxr-xr-x 26 root root 0 Jun 6 11:37 class
drwxr-xr-x 4 root root 0 Jun 6 11:37 dev
drwxr-xr-x 8 root root 0 Jun 6 11:37 devices
drwxr-xr-x 4 root root 0 Jun 6 11:37 firmware
drwxr-xr-x 4 root root 0 Jun 6 11:37 fs
drwxr-xr-x 5 root root 0 Jun 6 11:37 kernel
drwxr-xr-x 54 root root 0 Jun 6 11:37 module
drwxr-xr-x 2 root root 0 Jun 6 11:37 power
Note : Check ouput of man sysfs
No comments:
Post a Comment