Chinaunix首页 | 论坛 | 博客
  • 博客访问: 259285
  • 博文数量: 29
  • 博客积分: 1680
  • 博客等级: 上尉
  • 技术积分: 533
  • 用 户 组: 普通用户
  • 注册时间: 2008-04-17 14:38
文章分类

全部博文(29)

文章存档

2014年(2)

2012年(3)

2011年(9)

2008年(15)

我的朋友

分类: LINUX

2008-10-03 23:32:21

Sysfs
Sysfs is a virtual file system provided by Linux 2.6. Sysfs exports information about devices and drivers from the kernel device model to userspace, and is also used for configuration.

Sysfs is designed to export the information present in the device tree which would then no longer clutter up procfs. It was written by Patrick Mochel. Maneesh Soni later wrote the sysfs backing store patch to reduce memory usage on large systems.

sysfs is an in-memory filesystem that was originally based on ramfs. ramfs was written around the time Linux 2.4.0 was being stabilized. It was an exercise in elegance, as it showed just how easy it was to write a simple filesystem using the then-new VFS layer. Because of its simplicity and use of the VFS, it provided a good base from which to derive other in-memory based filesystems.

For each object added in the driver model tree (drivers, devices including class devices) a directory in sysfs is created. The parent/child relationship is reflected with subdirectories under /sys/devices/ (reflecting the physical layout). The subdirectory /sys/bus/ is populated with symbolic links, reflecting how the devices belong to different busses. /sys/class/ shows devices grouped according to classes, like network, while /sys/block/ contains the block devices.

For device drivers and devices, attributes may be created. These are simple files; the rule is that they should only contain a single value and/or allow a single value to be set (unlike some files in procfs, which need to be heavily parsed). These files show up in the subdirectory of the device driver respective to the device. Using attribute groups, a subdirectory filled with attributes may also be created.


procfs
    On many Unix-like computer systems, procfs, short for process file system, consists of a pseudo file system (a file system dynamically generated at boot) used to access process information from the kernel. The file system is often mounted at the /proc directory. Because /proc is not a real file system, it consumes no storage space and only a limited amount of memory.

/proc/cmdline, giving the boot options passed to the kernel
/proc/filesystems, a list of the file systems supported by the kernel at the time of listing
/proc/interrupts, /proc/iomem, /proc/ioports and the directory /proc/irq, giving some self-explanatory details about the devices (physical or logical) using the various system resources
/proc/meminfo, containing a summary of how the kernel is managing its memory.
/proc/modules, one of the most important files in /proc, containing a list of the kernel modules currently loaded . It gives some indication ( not always entirely correct) of dependencies.
/proc/tty, containing information about the current terminals; /proc/tty/driver looks to be a list of the different types of tty available each of which is a list of those of each type
阅读(2009) | 评论(0) | 转发(0) |
0

上一篇:some concept of file Systems

下一篇:技术3年。

给主人留下些什么吧!~~