Skip to content

Commit cd28e28

Browse files
author
Al Viro
committed
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>
1 parent 5d5d568 commit cd28e28

1 file changed

Lines changed: 9 additions & 9 deletions

File tree

‎drivers/char/mem.c‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -607,16 +607,16 @@ static ssize_t write_null(struct file *file, const char __user *buf,
607607
return count;
608608
}
609609

610-
static ssize_t aio_read_null(struct kiocb *iocb, const struct iovec *iov,
611-
unsigned long nr_segs, loff_t pos)
610+
static ssize_t read_iter_null(struct kiocb *iocb, struct iov_iter *to)
612611
{
613612
return 0;
614613
}
615614

616-
static ssize_t aio_write_null(struct kiocb *iocb, const struct iovec *iov,
617-
unsigned long nr_segs, loff_t pos)
615+
static ssize_t write_iter_null(struct kiocb *iocb, struct iov_iter *from)
618616
{
619-
return iov_length(iov, nr_segs);
617+
size_t count = iov_iter_count(from);
618+
iov_iter_advance(from, count);
619+
return count;
620620
}
621621

622622
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)
718718
#define zero_lseek null_lseek
719719
#define full_lseek null_lseek
720720
#define write_zero write_null
721-
#define aio_write_zero aio_write_null
721+
#define write_iter_zero write_iter_null
722722
#define open_mem open_port
723723
#define open_kmem open_mem
724724

@@ -750,8 +750,8 @@ static const struct file_operations null_fops = {
750750
.llseek = null_lseek,
751751
.read = read_null,
752752
.write = write_null,
753-
.aio_read = aio_read_null,
754-
.aio_write = aio_write_null,
753+
.read_iter = read_iter_null,
754+
.write_iter = write_iter_null,
755755
.splice_write = splice_write_null,
756756
};
757757

@@ -766,7 +766,7 @@ static const struct file_operations zero_fops = {
766766
.llseek = zero_lseek,
767767
.write = write_zero,
768768
.read_iter = read_iter_zero,
769-
.aio_write = aio_write_zero,
769+
.write_iter = write_iter_zero,
770770
.mmap = mmap_zero,
771771
#ifndef CONFIG_MMU
772772
.mmap_capabilities = zero_mmap_capabilities,

0 commit comments

Comments
 (0)