[PATCH 08/29] iov_iter: Split the iterate_all_kinds() macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxxx>
---

 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;					\





[Index of Archives]     [Linux RAID]     [Linux SCSI]     [Linux ATA RAID]     [IDE]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Device Mapper]

  Powered by Linux