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: Al Viro <viro@zeniv.linux.org.uk>
This commit is contained in:
parent
5d5d568975
commit
cd28e28d80
|
@ -607,16 +607,16 @@ static ssize_t write_null(struct file *file, const char __user *buf,
|
|||
return count;
|
||||
}
|
||||
|
||||
static ssize_t aio_read_null(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
static ssize_t read_iter_null(struct kiocb *iocb, struct iov_iter *to)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ssize_t aio_write_null(struct kiocb *iocb, const struct iovec *iov,
|
||||
unsigned long nr_segs, loff_t pos)
|
||||
static ssize_t write_iter_null(struct kiocb *iocb, struct iov_iter *from)
|
||||
{
|
||||
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,
|
||||
|
@ -718,7 +718,7 @@ static int open_port(struct inode *inode, struct file *filp)
|
|||
#define zero_lseek null_lseek
|
||||
#define full_lseek null_lseek
|
||||
#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_kmem open_mem
|
||||
|
||||
|
@ -750,8 +750,8 @@ static const struct file_operations null_fops = {
|
|||
.llseek = null_lseek,
|
||||
.read = read_null,
|
||||
.write = write_null,
|
||||
.aio_read = aio_read_null,
|
||||
.aio_write = aio_write_null,
|
||||
.read_iter = read_iter_null,
|
||||
.write_iter = write_iter_null,
|
||||
.splice_write = splice_write_null,
|
||||
};
|
||||
|
||||
|
@ -766,7 +766,7 @@ static const struct file_operations zero_fops = {
|
|||
.llseek = zero_lseek,
|
||||
.write = write_zero,
|
||||
.read_iter = read_iter_zero,
|
||||
.aio_write = aio_write_zero,
|
||||
.write_iter = write_iter_zero,
|
||||
.mmap = mmap_zero,
|
||||
#ifndef CONFIG_MMU
|
||||
.mmap_capabilities = zero_mmap_capabilities,
|
||||
|
|
Loading…
Reference in New Issue