- 1、有哪些信誉好的足球投注网站(book118)网站文档一经付费(服务费),不意味着购买了该文档的版权,仅供个人/单位学习、研究之用,不得用于商业用途,未经授权,严禁复制、发行、汇编、翻译或者网络传播等,侵权必究。。
- 2、本站所有内容均由合作方或网友上传,本站不对文档的完整性、权威性及其观点立场正确性做任何保证或承诺!文档内容仅供研究参考,付费前请自行鉴别。如您付费,意味着您自己接受本站规则且自行承担风险,本站不退款、不进行额外附加服务;查看《如何避免下载的几个坑》。如果您已付费下载过本站文档,您可以点击 这里二次下载。
- 3、如文档侵犯商业秘密、侵犯著作权、侵犯人身权等,请点击“版权申诉”(推荐),也可以打举报电话:400-050-0827(电话支持时间:9:00-18:30)。
- 4、该文档为VIP文档,如果想要下载,成为VIP会员后,下载免费。
- 5、成为VIP后,下载本文档将扣除1次下载权益。下载后,不支持退款、换文档。如有疑问请联系我们。
- 6、成为VIP后,您将拥有八大权益,权益包括:VIP文档下载权益、阅读免打扰、文档格式转换、高级专利检索、专属身份标志、高级客服、多端互通、版权登记。
- 7、VIP文档为合作方或网友上传,每下载1次, 网站将根据用户上传文档的质量评分、类型等,对文档贡献者给予高额补贴、流量扶持。如果你也想贡献VIP文档。上传文档
查看更多
device_create()自动创建设备文件结点
class_create(),class_device_create()或 device_create()自动创建设备文件结点 2011-07-12 10:40:30| 分类: s3c-linux |字号 订阅 class_create(),class_device_create()或device_create()自动创建 设备文件结点 2011-03-14 15:40 85人阅读 评论(0) 收藏 举报 从linux内核2.6的某个版本之后,devfs不复存在,udev成为devfs的替代。相比 devfs,udev有很多优势,在此就 不罗嗦了,提醒一点,udev是应用层的东东,不 要试图在内核的配置选项里找到它;加入对udev的支持很简单,以作者所写的一个 字符设备驱动为例,在驱 动初始化的代码里调用class_create为该设备创建一个 class,再为每个设备调用 class_device_create创建对应的设备。(不太明白什么是 devfs,udev,对linux中的文件系统没有什么概念呢。) 大致用法如下: struct class *myclass = class_create(THIS_MODULE, “my_device_driver”); class_device_create(myclass, NULL, MKDEV(major_num, 0), NULL, “my_device”); 这样的module被加载时,udev daemon就会自动在/dev下创建my_device设备文 件。 class_create() ------------------------------------------------- linux-2.6.22/include/linux/device.h struct class *class_create(struct module *owner, const char *name) class_create - create a struct class structure @owner: pointer to the module that is to own this struct class @name: pointer to a string for the name of this class. 在/sys/class/下创建类目录 class_device_create() ------------------------------------------------- linux-2.6.22/include/linux/device.h struct class_device *class_device_create(struct class *cls, struct class_device *parent, dev_t devt, struct device *device, const char *fmt, ...) class_device_create - creates a class device and registers it with sysfs @cls: pointer to the struct class that this device should be registered to. @parent: pointer to the parent struct class_device of this new device, if any. @devt: the dev_t for the char device to be added. @device: a pointer to a struct device that is assiociated with this class device. @fmt: string for the class devices name 在驱动模块初始化函数中实现设备节点的自动创建 我 们在刚开始写Linux设备驱动程序的时候,很多时候都是利用mknod命令手动创 建设备节点,实际上Linux内核为我们提
您可能关注的文档
- Contrasting regulatory focus and reinforcement sensitivity.pdf
- Continuum Microviscoelasticity Model for Aging Basic Creep of Early-Age Concrete.pdf
- Controllable Josephson-Like Tunneling in Two-Component Bose-Einstein Condensates Coupled wi.pdf
- Continuum Charged $D^{}$ Spin Alignment at $sqrt{s}$ = 10.5 GeV.pdf
- Controllable quantum spin precession by Aharonov-Casher phase in conducting ring.pdf
- Conxall连接器.pdf
- Control synthesis of rutile TiO2 microspheres, nanoflowers, nanotrees and nanobelts via acid-hydroth.pdf
- Continuously varying exponents in $A+B to 0$ reaction with long-ranged attractive interacti.pdf
- Convection and surface radiation heat losses from modified cavity receiver.pdf
- Cooperative control between large capacity HVDC system and thermal power plant.pdf
- DF52_catalog-939321.pdf
- DF6501-PQA(机架)电能质量监测终端用户手册.pdf
- Development of thicker negative tone resist.pdf
- Diagnosis and Management of Central Nervous System Metastases from Breast Cancer.pdf
- DFT, ATPG, and BIST.pdf
- DIALux evo 3.3 GZ_Oct_2014_CN.pdf
- Diagnosisandrepairofa_省略_tonemasonryarch.pdf
- DG Schaefer 2001.pdf
- DHEA, DHEAS and PCOS.pdf
- Did_you_want_to_tell_me_something.ppt
最近下载
- 新媒体营销课件 第11章 新媒体营销的前沿应用.pptx VIP
- 新媒体营销课件 第10章 视频圈的两座大山——哔哩哔哩、抖音平台.pptx VIP
- 新媒体营销课件 第9章 为优质“种草”,为大众求知——小红书、知乎.pptx VIP
- 新媒体营销课件 第8章 微信平台.pptx VIP
- 糖尿病心血管疾病管理.pptx
- 新媒体营销课件 第7章 数据:大数据营销.pptx VIP
- 新媒体营销课件 第6章 社群:社交裂变营销+社群运营.pptx VIP
- 新媒体营销课件 第5章 体验:游戏化营销+内容营销.pptx VIP
- 新媒体营销课件 第4章 连接:流量池+产品.pptx VIP
- 新媒体营销课件 第3章 新媒体营销时代的用户分析.pptx VIP
文档评论(0)