那个module是你自己写的吗?read/write需要自己在module里写。你搜一下char
driver,字符设备。有讲这个file_operations的东西。

在 14/7/9,Kroderia<krode...@gmail.com> 写道:
> 找了老半天没找到能看的样例程序, 来求救
>
> Linux module里面的file_operations的读写函数, 要对struct file *filp进行读写, 要调用那些函数?
> 刚直接用filp->f_ops->read/write把虚拟机都搞崩了...看到有个版本是直接用simple_read_from_buffer对filp->private_data进行写入,
> 不过似乎要在init里面进行内存分配, 这个做法可以吗?
>
> --
> 您收到此邮件是因为您订阅了 Google 网上论坛的“广州 GNU/Linux 用户组”论坛。
> 要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到gzlug+unsubscr...@googlegroups.com。
> 要向此网上论坛发帖,请发送电子邮件至 gzlug@googlegroups.com。
> 通过以下网址访问此论坛:http://groups.google.com/group/gzlug。
> 要查看更多选项,请访问 https://groups.google.com/d/optout。
>


-- 
*iZobs Lin*
*Appreciate Daily Life*

-- 
您收到此邮件是因为您订阅了 Google 网上论坛的“广州 GNU/Linux 用户组”论坛。
要退订此论坛并停止接收此论坛的电子邮件,请发送电子邮件到gzlug+unsubscr...@googlegroups.com。
要向此网上论坛发帖,请发送电子邮件至 gzlug@googlegroups.com。
通过以下网址访问此论坛:http://groups.google.com/group/gzlug。
要查看更多选项,请访问 https://groups.google.com/d/optout。

回复