fuse: switch to ->read_iter/->write_iter
authorAl Viro <viro@zeniv.linux.org.uk>
Sat, 4 Apr 2015 01:53:39 +0000 (21:53 -0400)
committerAl Viro <viro@zeniv.linux.org.uk>
Sun, 12 Apr 2015 02:29:41 +0000 (22:29 -0400)
we just change the calling conventions here; more work to follow.

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
fs/fuse/dev.c

index 95a2797..89bf9df 100644 (file)
@@ -1363,8 +1363,7 @@ static int fuse_dev_open(struct inode *inode, struct file *file)
        return 0;
 }
 
-static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov,
-                             unsigned long nr_segs, loff_t pos)
+static ssize_t fuse_dev_read(struct kiocb *iocb, struct iov_iter *to)
 {
        struct fuse_copy_state cs;
        struct file *file = iocb->ki_filp;
@@ -1372,9 +1371,12 @@ static ssize_t fuse_dev_read(struct kiocb *iocb, const struct iovec *iov,
        if (!fc)
                return -EPERM;
 
-       fuse_copy_init(&cs, fc, 1, iov, nr_segs);
+       if (!iter_is_iovec(to))
+               return -EINVAL;
+
+       fuse_copy_init(&cs, fc, 1, to->iov, to->nr_segs);
 
-       return fuse_dev_do_read(fc, file, &cs, iov_length(iov, nr_segs));
+       return fuse_dev_do_read(fc, file, &cs, iov_iter_count(to));
 }
 
 static ssize_t fuse_dev_splice_read(struct file *in, loff_t *ppos,
@@ -1970,17 +1972,19 @@ static ssize_t fuse_dev_do_write(struct fuse_conn *fc,
        return err;
 }
 
-static ssize_t fuse_dev_write(struct kiocb *iocb, const struct iovec *iov,
-                             unsigned long nr_segs, loff_t pos)
+static ssize_t fuse_dev_write(struct kiocb *iocb, struct iov_iter *from)
 {
        struct fuse_copy_state cs;
        struct fuse_conn *fc = fuse_get_conn(iocb->ki_filp);
        if (!fc)
                return -EPERM;
 
-       fuse_copy_init(&cs, fc, 0, iov, nr_segs);
+       if (!iter_is_iovec(from))
+               return -EINVAL;
+
+       fuse_copy_init(&cs, fc, 0, from->iov, from->nr_segs);
 
-       return fuse_dev_do_write(fc, &cs, iov_length(iov, nr_segs));
+       return fuse_dev_do_write(fc, &cs, iov_iter_count(from));
 }
 
 static ssize_t fuse_dev_splice_write(struct pipe_inode_info *pipe,
@@ -2232,11 +2236,9 @@ const struct file_operations fuse_dev_operations = {
        .owner          = THIS_MODULE,
        .open           = fuse_dev_open,
        .llseek         = no_llseek,
-       .read           = do_sync_read,
-       .aio_read       = fuse_dev_read,
+       .read_iter      = fuse_dev_read,
        .splice_read    = fuse_dev_splice_read,
-       .write          = do_sync_write,
-       .aio_write      = fuse_dev_write,
+       .write_iter     = fuse_dev_write,
        .splice_write   = fuse_dev_splice_write,
        .poll           = fuse_dev_poll,
        .release        = fuse_dev_release,