告诉 proc_entry->write_proc 使用带参数的 ioctl?

发布于 2024-08-23 04:10:51 字数 651 浏览 3 评论 0原文

我已经看到了一些执行此操作的示例代码:

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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

蛮可爱 2024-08-30 04:10:51

没有办法做到这一点。只需实现转发功能即可。

No way to do this. Just implement forwarding functions.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文