我有一个我维护的驱动程序,我需要使用 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
。