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);
精彩评论