diff options
author | Christoph Hellwig <hch@lst.de> | 2017-05-27 11:16:46 +0300 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2017-06-30 00:49:21 +0300 |
commit | 251b42a1dc641fac3fe412515233d60456180011 (patch) | |
tree | 19fe784d5f1f6a8ada89fd8fc7951904a517ea85 /fs/read_write.c | |
parent | 20223f0f39ea9d31ece08f04ac79f8c4e8d98246 (diff) | |
download | linux-251b42a1dc641fac3fe412515233d60456180011.tar.xz |
fs: remove do_readv_writev
opencode it in both callers to simplify the call stack a bit.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/read_write.c')
-rw-r--r-- | fs/read_write.c | 43 |
1 files changed, 21 insertions, 22 deletions
diff --git a/fs/read_write.c b/fs/read_write.c index 19d4d88fa285..94cb71058098 100644 --- a/fs/read_write.c +++ b/fs/read_write.c @@ -951,51 +951,50 @@ out: return ret; } -static ssize_t do_readv_writev(int type, struct file *file, - const struct iovec __user *uvector, - unsigned long nr_segs, loff_t *pos, - int flags) +ssize_t vfs_readv(struct file *file, const struct iovec __user *vec, + unsigned long vlen, loff_t *pos, int flags) { struct iovec iovstack[UIO_FASTIOV]; struct iovec *iov = iovstack; struct iov_iter iter; ssize_t ret; - ret = import_iovec(type, uvector, nr_segs, - ARRAY_SIZE(iovstack), &iov, &iter); - if (ret < 0) - return ret; - - ret = __do_readv_writev(type, file, &iter, pos, flags); - kfree(iov); - - return ret; -} - -ssize_t vfs_readv(struct file *file, const struct iovec __user *vec, - unsigned long vlen, loff_t *pos, int flags) -{ if (!(file->f_mode & FMODE_READ)) return -EBADF; if (!(file->f_mode & FMODE_CAN_READ)) return -EINVAL; - return do_readv_writev(READ, file, vec, vlen, pos, flags); -} + ret = import_iovec(READ, vec, vlen, ARRAY_SIZE(iovstack), &iov, &iter); + if (ret < 0) + return ret; + ret = __do_readv_writev(READ, file, &iter, pos, flags); + kfree(iov); + return ret; +} EXPORT_SYMBOL(vfs_readv); ssize_t vfs_writev(struct file *file, const struct iovec __user *vec, unsigned long vlen, loff_t *pos, int flags) { + struct iovec iovstack[UIO_FASTIOV]; + struct iovec *iov = iovstack; + struct iov_iter iter; + ssize_t ret; + if (!(file->f_mode & FMODE_WRITE)) return -EBADF; if (!(file->f_mode & FMODE_CAN_WRITE)) return -EINVAL; - return do_readv_writev(WRITE, file, vec, vlen, pos, flags); -} + ret = import_iovec(WRITE, vec, vlen, ARRAY_SIZE(iovstack), &iov, &iter); + if (ret < 0) + return ret; + ret = __do_readv_writev(WRITE, file, &iter, pos, flags); + kfree(iov); + return ret; +} EXPORT_SYMBOL(vfs_writev); static ssize_t do_readv(unsigned long fd, const struct iovec __user *vec, |