在字符设备驱动程序中手动调用刷新
我想要一个字符设备在写入时刷新它。如何调用file_operation的flush方法?
这是一些相关代码:
struct file_operations ent_fops = {
.owner = THIS_MODULE,
.read = ent_read,
.write = ent_write,
};
我自己没有定义刷新
ssize_t ent_write(struct file *filp, const char __user *buf, size_t count,loff_t *f_pos)
{
blah...
*(ent_fops.flush)(file);
blah...
}
代码无法编译,错误是我发送的刷新参数太少。我找不到任何地方提到它需要多个。
I want a character device to flush as I write to it. How do I call the file_operation's flush method?
Here's some relevant code:
struct file_operations ent_fops = {
.owner = THIS_MODULE,
.read = ent_read,
.write = ent_write,
};
I don't define flush myself
ssize_t ent_write(struct file *filp, const char __user *buf, size_t count,loff_t *f_pos)
{
blah...
*(ent_fops.flush)(file);
blah...
}
The code wont compile, the error is that I'm sending flush too few arguments. I cant find any mention anywhere of it needing more than one.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您缺少指向文件锁所有者的指针。尝试
You're missing the pointer to the file lock owner. Try