switch drivers/char/mem.c to ->read_iter/->write_iter
authorAl Viro <viro@zeniv.linux.org.uk>
Fri, 3 Apr 2015 19:57:04 +0000 (15:57 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Apr 2015 02:29:40 +0000 (22:29 -0400)
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>
drivers/char/mem.c

index ad08400491aefa7c0924894f8bb4d7ec90c4778f..6b1721f978c2945f4af716636c8373fe8807dca0 100644 (file)
@@ -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,