From: Omar Sandoval Date: Tue, 17 Mar 2015 21:04:02 +0000 (-0700) Subject: new helper: iov_iter_rw() X-Git-Tag: KARO-TXA5-2015-06-26~105^2~6 X-Git-Url: https://git.karo-electronics.de/?a=commitdiff_plain;h=d7d9c433a13ffee37b35e5461c9aafe433f4b4d8;p=karo-tx-linux.git new helper: iov_iter_rw() Get either READ or WRITE out of iter->type. Signed-off-by: Omar Sandoval Signed-off-by: Al Viro --- 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 @@ -111,6 +111,14 @@ static inline bool iter_is_iovec(struct iov_iter *i) return !(i->type & (ITER_BVEC | ITER_KVEC)); } +/* + * 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