aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/uio.h
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2014-04-04 23:12:29 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2014-05-06 17:39:45 -0400
commit62a8067a7f35dba2de501c9cb00e4cf36da90bc0 (patch)
treebb008456891c13b9d8a25825a10074efb861cd88 /include/linux/uio.h
parent81055e584f9d743cb13dc7944923d817c20f089d (diff)
bio_vec-backed iov_iter
New variant of iov_iter - ITER_BVEC in iter->type, backed with bio_vec array instead of iovec one. Primitives taught to deal with such beasts, __swap_write() switched to using that kind of iov_iter. Note that bio_vec is just a <page, offset, length> triple - there's nothing block-specific about it. I've left the definition where it was, but took it from under ifdef CONFIG_BLOCK. Next target: ->splice_write()... Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'include/linux/uio.h')
-rw-r--r--include/linux/uio.h14
1 files changed, 12 insertions, 2 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h
index e8a109a75de1..e2231e47cec1 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -19,12 +19,21 @@ struct kvec {
19 size_t iov_len; 19 size_t iov_len;
20}; 20};
21 21
22enum {
23 ITER_IOVEC = 0,
24 ITER_KVEC = 2,
25 ITER_BVEC = 4,
26};
27
22struct iov_iter { 28struct iov_iter {
23 int type; 29 int type;
24 const struct iovec *iov;
25 unsigned long nr_segs;
26 size_t iov_offset; 30 size_t iov_offset;
27 size_t count; 31 size_t count;
32 union {
33 const struct iovec *iov;
34 const struct bio_vec *bvec;
35 };
36 unsigned long nr_segs;
28}; 37};
29 38
30/* 39/*
@@ -54,6 +63,7 @@ static inline struct iovec iov_iter_iovec(const struct iov_iter *iter)
54} 63}
55 64
56#define iov_for_each(iov, iter, start) \ 65#define iov_for_each(iov, iter, start) \
66 if (!((start).type & ITER_BVEC)) \
57 for (iter = (start); \ 67 for (iter = (start); \
58 (iter).count && \ 68 (iter).count && \
59 ((iov = iov_iter_iovec(&(iter))), 1); \ 69 ((iov = iov_iter_iovec(&(iter))), 1); \