Commit cd28e28d authored by Al Viro's avatar Al Viro

switch drivers/char/mem.c to ->read_iter/->write_iter

Note that _these_ guys have ->read() and ->write() left in place - they are
eqiuvalent to what we'd get if we replaced those with NULL, but we are
talking about hot paths here.
Signed-off-by: default avatarAl Viro <viro@zeniv.linux.org.uk>
parent 5d5d5689
...@@ -607,16 +607,16 @@ static ssize_t write_null(struct file *file, const char __user *buf, ...@@ -607,16 +607,16 @@ static ssize_t write_null(struct file *file, const char __user *buf,
return count; return count;
} }
static ssize_t aio_read_null(struct kiocb *iocb, const struct iovec *iov, static ssize_t read_iter_null(struct kiocb *iocb, struct iov_iter *to)
unsigned long nr_segs, loff_t pos)
{ {
return 0; return 0;
} }
static ssize_t aio_write_null(struct kiocb *iocb, const struct iovec *iov, static ssize_t write_iter_null(struct kiocb *iocb, struct iov_iter *from)
unsigned long nr_segs, loff_t pos)
{ {
return iov_length(iov, nr_segs); size_t count = iov_iter_count(from);
iov_iter_advance(from, count);
return count;
} }
static int pipe_to_null(struct pipe_inode_info *info, struct pipe_buffer *buf, static int pipe_to_null(struct pipe_inode_info *info, struct pipe_buffer *buf,
...@@ -718,7 +718,7 @@ static int open_port(struct inode *inode, struct file *filp) ...@@ -718,7 +718,7 @@ static int open_port(struct inode *inode, struct file *filp)
#define zero_lseek null_lseek #define zero_lseek null_lseek
#define full_lseek null_lseek #define full_lseek null_lseek
#define write_zero write_null #define write_zero write_null
#define aio_write_zero aio_write_null #define write_iter_zero write_iter_null
#define open_mem open_port #define open_mem open_port
#define open_kmem open_mem #define open_kmem open_mem
...@@ -750,8 +750,8 @@ static const struct file_operations null_fops = { ...@@ -750,8 +750,8 @@ static const struct file_operations null_fops = {
.llseek = null_lseek, .llseek = null_lseek,
.read = read_null, .read = read_null,
.write = write_null, .write = write_null,
.aio_read = aio_read_null, .read_iter = read_iter_null,
.aio_write = aio_write_null, .write_iter = write_iter_null,
.splice_write = splice_write_null, .splice_write = splice_write_null,
}; };
...@@ -766,7 +766,7 @@ static const struct file_operations zero_fops = { ...@@ -766,7 +766,7 @@ static const struct file_operations zero_fops = {
.llseek = zero_lseek, .llseek = zero_lseek,
.write = write_zero, .write = write_zero,
.read_iter = read_iter_zero, .read_iter = read_iter_zero,
.aio_write = aio_write_zero, .write_iter = write_iter_zero,
.mmap = mmap_zero, .mmap = mmap_zero,
#ifndef CONFIG_MMU #ifndef CONFIG_MMU
.mmap_capabilities = zero_mmap_capabilities, .mmap_capabilities = zero_mmap_capabilities,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment