开发者

manually call flush within character device driver

开发者 https://www.devze.com 2023-04-11 15:48 出处:网络
I want a character device to flush as I write to it. 开发者_如何学GoHow do I call the file_operation\'s flush method?

I want a character device to flush as I write to it. 开发者_如何学GoHow 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.


You're missing the pointer to the file lock owner. Try

*(ent_fops.flush)(filp, NULL); 
0

精彩评论

暂无评论...
验证码 换一张
取 消