udev(七):/dev、devfs、 udev和sysfs之间的关系

长平狐 发布于 2013/01/11 10:33
阅读 997
收藏 0

       原创文章,转载请注明出处,谢谢!       
 
     作者:清林,博客名: 空静渡

 

       在前面,我们看到了/dev、devfs、udev和sysfs等概念,估计读者也会乱了思路了,下面这段文章摘自udev的说明文档,来理清一下它们之间的关系,这里我就不翻译了,我只在后面说明一下。


       On typical Linux-based systems, the /dev directory is used to store file-like device nodes which refer to certain devices in the system. Each node points to a part of the system (a device), which might or might not exist. Userspace applications can use these device nodes to interface with the systems hardware, for example, the X server will "listen to" /dev/input/mice so that it can relate the user's mouse movements to moving the visual mouse pointer.

      

       The original /dev directories were just populated with every device that might possibly appear in the system. /dev directories were typically very large because of this. devfs came along to provide a more manageable approach (noticeably, it only populated /dev with hardware that is plugged into the system), as well as some other functionality, but the system proved to have problems which could not be easily fixed.


       udev is the "new" way of managing /dev directories, designed to clear up some issues with previous /dev implementations, and provide a robust path forward. In order to create and name /dev device nodes corresponding to devices that are present in the system, udev relies on matching information provided by sysfs with rules provided by the user. This documentation aims to detail the process of rule-writing, one of the only udev-related tasks that must (optionally) be performed by the user.


       sysfs is a new filesystem to the 2.6 kernels. It is managed by the kernel, and exports basic information about the devices currently plugged into your system. udev can use this information to create device nodes corresponding to your hardware. sysfs is mounted at /sys and is browseable. You may wish to investigate some of the files stored there before getting to grips with udev. Throughout this document, I will use the terms /sys and sysfs interchangeably.


       我这里简单说明一下。在以前呢/dev存储的是linux可以认识的所有的文件设备名,无论这个设备有没有在系统里。为了解决/dev目录过大的问题,就产生了devfs,但devfs是基因内核的,有很多无法解决的问题(参考前面的文章),所以就出现了udev。而udev对设备在/dev目录下的命名依赖于sysfs所提供的规则信息,这些规则信息由用户提供。sysfs是在2.6内核时加进linux内核的。sysfs就是我们系统加载的/sys。


原文链接:http://blog.csdn.net/fjb2080/article/details/4871192
加载中
返回顶部
顶部