/sys/dev 和/sys/devices 和udev的关系
来源:互联网 发布:象过河进销存软件图 编辑:程序博客网 时间:2024/05/14 13:07
sysfs introduction:
----------------------------
sysfs is a mechanism for representing kernel objects, theirattributes, and their relationships
with each other.
It provides two components: a kernel programming interface forexporting these items via sysfs, and a user interface to view andmanipulate these items that maps back to the kernel objects whichthey represent.
The table below shows the mapping between internel (kernel)constructs and their external
(userspace) sysfs mappings.
---------------------------------------
|Internal |External |
---------------------------------------
|KernelObjects | Directories |
---------------------------------------
|ObjectAttributes |Regular Files |
---------------------------------------
|Object Relationships | Symbolic Links|
---------------------------------------
(Reference:http://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf)
/sys/dev:
------------------
Contains two directories char/ and block/. Inside these twodirectories there are symlinks named<major>:<minor>.These symlinks point to the sysfs directory for the given device./sys/dev provides a quick way to lookup the sysfs interface for adevice from the result of a stat(2) operation.
Example:
root@AuxLinux:/sys# ls -l dev/block/8:1
lrwxrwxrwx 1 root root 0 2011-08-26 10:13 dev/block/8:1->../../devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda/sda1
root@AuxLinux:/sys# stat /dev/sda1
File: `/dev/sda1'
Size:0 Blocks:0 IO Block: 4096 block specialfile
Device: 5h/5d Inode:5484 Links:1 Devicetype: 8,1
Access: (0660/brw-rw----) Uid:( 0/ root) Gid:( 6/ disk)
Access: 2011-08-24 18:25:02.902025252 +0800
Modify: 2011-08-18 15:14:17.281472005 +0800
Change: 2011-08-18 15:14:17.281472005 +0800
/sys/devices:
----------------------------
Contains a filesystem representation of the device tree. It mapsdirectly to the internal kernel device tree, which is a hierarchyof struct device.
udev:
-----------------------------
udev is a device management framework that replaced the devfsfacility in the Linux 2.6 kernel. It is composed of some kernelservices and the udevd daemon. The kernel informs the udevd daemonwhen certain events happen. The udevd daemon is configured torespond to some events with actions. Always, it meansadding/removing device file under /dev dynamically.
* When the kernel detects that a device has been added or removed,a uevent is sent to
the udevd daemon through a netlink socket
* When udevd receives the uevent, it matches its configured rulesagainst the available
device attributes provided in sysfs
* If a match is found, one or more actions (e.g., create devicenode, remove device node,
install firmware, etc.) are taken
----------------------------
sysfs is a mechanism for representing kernel objects, theirattributes, and their relationships
with each other.
It provides two components: a kernel programming interface forexporting these items via sysfs, and a user interface to view andmanipulate these items that maps back to the kernel objects whichthey represent.
The table below shows the mapping between internel (kernel)constructs and their external
(userspace) sysfs mappings.
---------------------------------------
|Internal
---------------------------------------
|KernelObjects
---------------------------------------
|ObjectAttributes
---------------------------------------
|Object Relationships | Symbolic Links|
---------------------------------------
(Reference:http://www.kernel.org/pub/linux/kernel/people/mochel/doc/papers/ols-2005/mochel.pdf)
/sys/dev:
------------------
Contains two directories char/ and block/. Inside these twodirectories there are symlinks named<major>:<minor>.These symlinks point to the sysfs directory for the given device./sys/dev provides a quick way to lookup the sysfs interface for adevice from the result of a stat(2) operation.
Example:
root@AuxLinux:/sys# ls -l dev/block/8:1
lrwxrwxrwx 1 root root 0 2011-08-26 10:13 dev/block/8:1->../../devices/pci0000:00/0000:00:10.0/host2/target2:0:0/2:0:0:0/block/sda/sda1
root@AuxLinux:/sys# stat /dev/sda1
Device: 5h/5d
Access: (0660/brw-rw----)
Access: 2011-08-24 18:25:02.902025252 +0800
Modify: 2011-08-18 15:14:17.281472005 +0800
Change: 2011-08-18 15:14:17.281472005 +0800
/sys/devices:
----------------------------
Contains a filesystem representation of the device tree. It mapsdirectly to the internal kernel device tree, which is a hierarchyof struct device.
udev:
-----------------------------
udev is a device management framework that replaced the devfsfacility in the Linux 2.6 kernel. It is composed of some kernelservices and the udevd daemon. The kernel informs the udevd daemonwhen certain events happen. The udevd daemon is configured torespond to some events with actions. Always, it meansadding/removing device file under /dev dynamically.
* When the kernel detects that a device has been added or removed,a uevent is sent to
the udevd daemon through a netlink socket
* When udevd receives the uevent, it matches its configured rulesagainst the available
device attributes provided in sysfs
* If a match is found, one or more actions (e.g., create devicenode, remove device node,
install firmware, etc.) are taken
(Usage Reference:http://www.ibm.com/developerworks/cn/linux/l-cn-udev/index.html?ca=drs-cn-0304)
转载:http://blog.csdn.net/xuesen_lin/article/details/6946719
- /dev、/sys/dev 和/sys/devices 和udev的关系
- /sys/dev 和/sys/devices 和udev的关系
- /sys/dev 和/sys/devices 和udev的关系
- /dev和/sys/devices
- /dev和/sys/devices
- /dev、/sys/devices 和 /sys/dev 之间区别
- linux下/dev、/sys/devices 和 /sys/dev 之间区别
- /dev、/sys/devices 和 /sys/dev 之间区别
- /dev、/sys/devices 和 /sys/dev 之间区别
- linux下/dev、/sys/devices 和 /sys/dev 之间区别
- linux下/dev、/sys/devices 和 /sys/dev 之间区别
- /dev、/sys/devices 和 /sys/dev 之间区别
- 关于sys/device和/dev的区别
- /proc/devices和/dev的关系
- linux 下 /dev和/sys/dev的区别
- /proc /sys /tmp /dev /dev/pts udev
- sys目录devices、dev等目录的创建
- /proc/modules, /sys/module, /proc/devices, /dev
- C语言中如何使用宏 包括单双井号 可变参数
- jsp页面遮罩层
- unity3d 摄像机画面作为材质贴到模型上面去
- 6603斗地主看牌制作原理
- UVa:11151 Longest Palindrome
- /sys/dev 和/sys/devices 和udev的关系
- [LeetCode] Binary Tree Zigzag Level Order Traversal
- 走访2000人:终于找到诺基亚销量不好的原因了
- Java中ArrayList 、LinkList区别
- SQLyog 连不上MySQL , ERROR NO.1045 简单的解决方法
- Response状态码
- android 获取时钟信息并显示
- WebLogic10.3两种模式的切换
- Linux内核之中断概述