14 模型,又见模型 小结
来源:互联网 发布:天盾数据恢复软件 编辑:程序博客网 时间:2024/06/05 02:51
1. bus_type,device,device_driver的关系?
1)bus_type有两个kset成员,
struct kset drivers;
struct kset devices;
分别表示它连接在这个总线上的设备列表和注册在这个总线上的驱动列表。
2)device有两个成员:
struct bus_type * bus; /* type of bus device is on */
struct device_driver *driver; /* which driver has allocated this device */
分别表示它连接的总线和驱动。
3)device_driver有两个成员:
struct bus_type * bus;
struct klist klist_devices;
分别表示它连接的总线和支持的设备的列表。
操作系统初始化时,总线扫描设备,每找到一个设备,就为其申请一个struct device 结构,并且挂入总线中的devices 链表中,然后每一个驱动程序初始化,注册其struct device_driver结构,之后它在总线的devices 链表中遍历,寻找每一个还没有绑定driver 的设备,即struct device 中的struct device_driver 指针仍为空的设备,根据这种设备的特征,判断是否是它所支持的设备,如果是,则调用device_bind_driver函数,将struct device中的struct device_driver driver 指向这个driver,而struct device_driver driver 把struct device 加入它的struct klist klist_devices 链表中。这样,bus、device和driver三者就联系上了。
2. 什么是kobject,kset和klist?kset和klist的区别?
参见p34.
klist在include\linux\klist.h定义。援引注释:
"Some generic list helpers, extending struct list_head a bit.
"
它是一个内核里面的通用链表的实现。
而kset在include\linux\kobject.h定义。
援引注释:
"a set of kobjects of a specific type, belonging to a specific subsystem."
它被设计为一个针对kobjects的链表。
这就是两者的区别。
- 14 模型,又见模型 小结
- 模型,又见模型
- Linux那些事儿 之 戏说USB(14)模型,又见模型
- 【转】Linux那些事儿 之 戏说USB(14)模型,又见模型
- Linux那些事儿 之 戏说USB(14)模型,又见模型
- JS事件模型小结
- 线性模型小结
- nginx事件模型小结
- JS事件模型小结
- nginx事件模型小结
- poverDesiger创建模型小结
- 主题模型-LDA小结
- PRML线性模型小结
- 主题模型-LDA小结
- JS事件模型小结
- 多线程:线程模型-小结
- 主题模型-LDA小结
- 事件模型小结
- kwstyle中的编码规范
- SSH2完美整合流程
- android4.0.3的error: insufficient permissions for device的解决
- C/C++变量之间的“干扰”
- UML建模类图、时序图、用例图相关
- 14 模型,又见模型 小结
- 关于arcgis for android demo中加载自己发布的地图服务出错
- Google 收购摩托罗拉移动将会对全球手机市场格局带来哪些深远影响?
- WCF之ABC
- VelocityTracker监控速度!!!
- Delphi7中存储unicode的BUG
- java数字字符串比较大小
- 安装Windows2003 Server MSCS群集
- 改善C++代码的学习笔记1