lkml.org 
[lkml]   [2020]   [Nov]   [21]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Subject[PATCH 08/29] iov_iter: Split the iterate_all_kinds() macro
From
Date
Split the iterate_all_kinds() macro into iovec, bvec and kvec variants.
It doesn't handle pipes and the discard variant is a no-op and can be built
in directly.

Signed-off-by: David Howells <dhowells@redhat.com>
---

lib/iov_iter.c | 27 +++++++++++++++++++++++++++
1 file changed, 27 insertions(+)

diff --git a/lib/iov_iter.c b/lib/iov_iter.c
index 5b18dfe0dcc7..934193627540 100644
--- a/lib/iov_iter.c
+++ b/lib/iov_iter.c
@@ -106,6 +106,33 @@ static inline bool page_copy_sane(struct page *page, size_t offset, size_t n);
} \
}

+#define iterate_over_iovec(i, n, v, CMD) { \
+ if (likely(n)) { \
+ size_t skip = i->iov_offset; \
+ const struct iovec *iov; \
+ struct iovec v; \
+ iterate_iovec(i, n, v, iov, skip, (CMD)) \
+ } \
+}
+
+#define iterate_over_bvec(i, n, v, CMD) { \
+ if (likely(n)) { \
+ size_t skip = i->iov_offset; \
+ struct bio_vec v; \
+ struct bvec_iter __bi; \
+ iterate_bvec(i, n, v, __bi, skip, (CMD)) \
+ } \
+}
+
+#define iterate_over_kvec(i, n, v, CMD) { \
+ if (likely(n)) { \
+ size_t skip = i->iov_offset; \
+ const struct kvec *kvec; \
+ struct kvec v; \
+ iterate_kvec(i, n, v, kvec, skip, (CMD)) \
+ } \
+}
+
#define iterate_and_advance(i, n, v, I, B, K) { \
if (unlikely(i->count < n)) \
n = i->count; \

\
 
 \ /
  Last update: 2020-11-21 15:16    [W:0.261 / U:1.176 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site