![文件操作 aio_read 在内核 4.1 中发生了变化](https://linux22.com/image/99110/%E6%96%87%E4%BB%B6%E6%93%8D%E4%BD%9C%20aio_read%20%E5%9C%A8%E5%86%85%E6%A0%B8%204.1%20%E4%B8%AD%E5%8F%91%E7%94%9F%E4%BA%86%E5%8F%98%E5%8C%96.png)
我有一个我维护的驱动程序,我需要使用 Linux 标头 4.1.21 来编译它,但我收到 , 的编译错误aio_read
,aio_write
它们在 中丢失struct file_operations
,我假设它们已被替换。
我如何知道替代品是什么?
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_iter
write_iter
您还可以在以下位置找到相关的简短声明:Documentation/filesystems/porting
。