summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOmar Sandoval <osandov@osandov.com>2015-03-18 00:04:02 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2015-04-12 05:29:44 +0300
commitbd8e0ff956456ad9071dbb6c2ed7d33bd22fc216 (patch)
treeb5b35ab8f9c73cc5d71967d5b3ef22047ac92ed6
parent8436318205b9f29e45db88850ec60e326327e241 (diff)
downloadlinux-bd8e0ff956456ad9071dbb6c2ed7d33bd22fc216.tar.xz
new helper: iov_iter_rw()
Get either READ or WRITE out of iter->type. Signed-off-by: Omar Sandoval <osandov@osandov.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
-rw-r--r--include/linux/uio.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/uio.h b/include/linux/uio.h
index 15f11fb9fff6..8b01e1c3c614 100644
--- a/include/linux/uio.h
+++ b/include/linux/uio.h
@@ -112,6 +112,14 @@ static inline bool iter_is_iovec(struct iov_iter *i)
}
/*
+ * Get one of READ or WRITE out of iter->type without any other flags OR'd in
+ * with it.
+ *
+ * The ?: is just for type safety.
+ */
+#define iov_iter_rw(i) ((0 ? (struct iov_iter *)0 : (i))->type & RW_MASK)
+
+/*
* Cap the iov_iter by given limit; note that the second argument is
* *not* the new size - it's upper limit for such. Passing it a value
* greater than the amount of data in iov_iter is fine - it'll just do