文件操作 aio_read 在内核 4.1 中发生了变化

文件操作 aio_read 在内核 4.1 中发生了变化

我有一个我维护的驱动程序,我需要使用 Linux 标头 4.1.21 来编译它,但我收到 , 的编译错误aio_readaio_write它们在 中丢失struct file_operations,我假设它们已被替换。
我如何知道替代品是什么?

fs.h在内核4.0中有:

struct file_operations {
struct module *owner;
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
ssize_t (*aio_read) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
ssize_t (*aio_write) (struct kiocb *, const struct iovec *, unsigned long, loff_t);
ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
...  

fs.h在内核4.1中 有:

struct file_operations {
struct module *owner;
loff_t (*llseek) (struct file *, loff_t, int);
ssize_t (*read) (struct file *, char __user *, size_t, loff_t *);
ssize_t (*write) (struct file *, const char __user *, size_t, loff_t *);
ssize_t (*read_iter) (struct kiocb *, struct iov_iter *);
ssize_t (*write_iter) (struct kiocb *, struct iov_iter *);
int (*iterate) (struct file *, struct dir_context *);

答案1

如果你正在做内核工作,你应该订阅Linux 每周新闻

很快就找到了本文其中提到了aio_read和正在由和aio_write处理。read_iterwrite_iter

您还可以在以下位置找到相关的简短声明:Documentation/filesystems/porting

相关内容