免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1942 | 回复: 2
打印 上一主题 下一主题

IOCTL的I/O控制疑问 [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2011-03-01 20:57 |只看该作者 |倒序浏览
_IOR(base, command, size)

/*
* _IOR means that we're creating an ioctl command
* number for passing information from a user process
* to the kernel module.
*
* The first arguments, MAJOR_NUM, is the major device
* number we're using.
*
* The second argument is the number of the command
* (there could be several with different meanings).
*
* The third argument is the type we want to get from
* the process to the kernel.
*/
没看懂第二个参数是什么意思啊?有大牛了解吗?

论坛徽章:
0
2 [报告]
发表于 2011-03-02 17:09 |只看该作者
以_IOR('V',  0, struct v4l2_capability)为例,第一个参数是幻数,第二个就是命令,第三个是传替参数的大小。第二个参数根据不同的命令可以定义为任意数字,这个就看个人喜好了。比如:
#define cmdA   _IOR('V',0,struct v4l2_capability)
#define cmdB   _IOR('V',1,struct v4l2_capability)
#define cmdC   _IOR('V',2,struct v4l2_capability)
#define cmdD   _IOR('V',3,struct v4l2_capability)

论坛徽章:
0
3 [报告]
发表于 2011-03-02 20:09 |只看该作者
The second argument is the number of the command      
第二个参数 不就是命令号么?
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP