告诉 proc_entry->write_proc 使用带参数的 ioctl?
我已经看到了一些执行此操作的示例代码:
proc_entry->read_proc = module_read;
proc_entry->write_proc = module_write;
但是,在我的模块中,我使用了 ioctl 而不是读取和写入。这是我的 ioctl 函数原型:
int mytimer_ioctl(struct inode *inode, struct file *file, unsigned int fcn, unsigned long args)
对于读取,我的“fcn”是 IOCTL_GET_TIMER,对于写入,我的“fcn”是 IOCTL_SET_TIMER。
无论如何要做这样的事情:
proc_entry->read_proc = module_ioctl(IOCTL_GET_TIMER);
proc_entry->write_proc = module_ioctl(IOCTL_SET_TIMER);
但不传递“args”参数?
或者也许更简单的方法是只编写 module_read 和 module_write 函数,然后让它们调用 ioctl?
感谢各位的帮助!
I've seen some sample code that does this:
proc_entry->read_proc = module_read;
proc_entry->write_proc = module_write;
However, in my module, I've used ioctls instead of the read and write. Here is my ioctl function prototype:
int mytimer_ioctl(struct inode *inode, struct file *file, unsigned int fcn, unsigned long args)
For read, my "fcn" is IOCTL_GET_TIMER, and for write, my "fcn" is IOCTL_SET_TIMER.
Anyway to do something like this:
proc_entry->read_proc = module_ioctl(IOCTL_GET_TIMER);
proc_entry->write_proc = module_ioctl(IOCTL_SET_TIMER);
But not pass in the "args" argument?
Or maybe the easier way is to just write the module_read and module_write function, and have those call the ioctl?
Thanks for the help guys!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
没有办法做到这一点。只需实现转发功能即可。
No way to do this. Just implement forwarding functions.