summaryrefslogtreecommitdiff
path: root/include/linux/uio.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2022-06-09 17:28:36 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2022-08-09 05:37:22 +0300
commit1ef255e257173f4bc44317ef2076e7e0de688fdf (patch)
tree700be64ef5aa70a34f6d8158936214e9694e4245 /include/linux/uio.h
parent3cf42da327f26eb4461864dd64812345b37f4fd9 (diff)
downloadlinux-1ef255e257173f4bc44317ef2076e7e0de688fdf.tar.xz
iov_iter: advancing variants of iov_iter_get_pages{,_alloc}()
Most of the users immediately follow successful iov_iter_get_pages() with advancing by the amount it had returned. Provide inline wrappers doing that, convert trivial open-coded uses of those. BTW, iov_iter_get_pages() never returns more than it had been asked to; such checks in cifs ought to be removed someday... Reviewed-by: Jeff Layton <jlayton@kernel.org> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r--include/linux/uio.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h
index e7fc29b5ad19..b70d28693400 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -351,4 +351,24 @@ static inline void iov_iter_ubuf(struct iov_iter *i, unsigned int direction,
};
}
+static inline ssize_t iov_iter_get_pages2(struct iov_iter *i, struct page **pages,
+ size_t maxsize, unsigned maxpages, size_t *start)
+{
+ ssize_t res = iov_iter_get_pages(i, pages, maxsize, maxpages, start);
+
+ if (res >= 0)
+ iov_iter_advance(i, res);
+ return res;
+}
+
+static inline ssize_t iov_iter_get_pages_alloc2(struct iov_iter *i, struct page ***pages,
+ size_t maxsize, size_t *start)
+{
+ ssize_t res = iov_iter_get_pages_alloc(i, pages, maxsize, start);
+
+ if (res >= 0)
+ iov_iter_advance(i, res);
+ return res;
+}
+
#endif