From: Omar Sandoval Subject: [RFC PATCH 1/5] new helper: iov_iter_rw() Date: Mon, 16 Mar 2015 04:33:49 -0700 Message-ID: <34dc78b262546e9343e0ed872232a97f5eaa5f15.1426502566.git.osandov@osandov.com> References: Cc: linux-kernel@vger.kernel.org, Chris Mason , Josef Bacik , David Sterba , "Yan Zheng" , Sage Weil , Steve French , Boaz Harrosh , Benny Halevy , Jan Kara , "Theodore Ts'o" , Andreas Dilger , Jaegeuk Kim , Changman Lee , Miklos Szeredi , Steven Whitehouse , Dave Kleikamp , Oleg Drokin , Trond Myklebust , Anna Schumaker , Ryusuke Konishi , Mark Fasheh , Joel Becker , Eric Van Hensbergen , Ron Minnich , linux-fsdevel@vger.kernel.org, linux-btrfs@vger.kernel.org, ceph-devel@vger.kernel.org, linux-cifs@vger.kernel.org, osd-dev@open-osd.org, linux-ext4@vger.kernel.org, linux-f2fs-devel@lists.sourceforge.net, fuse-devel@lists.sourceforge.net, cluster-devel@redhat.com, jfs-discussion@lists.sourceforge.net, HPDD-discuss@lists.01.org, linux-nfs@vger.kernel.org, linux-nilfs@vger.kernel.org, ocfs2-devel@oss.oracle.com, reiserfs-devel@vger.kernel.org, v9fs-developer@lists.sourceforge.net, xfs@oss.sgi.com Return-path: In-Reply-To: In-Reply-To: References: Sender: linux-btrfs-owner@vger.kernel.org List-Id: linux-ext4.vger.kernel.org Get either READ or WRITE out of iter->type. Signed-off-by: Omar Sandoval --- include/linux/uio.h | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 7188029..87a47b3 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -10,6 +10,7 @@ #define __LINUX_UIO_H #include +#include #include struct page; @@ -111,6 +112,15 @@ 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. + */ +static inline int iov_iter_rw(const struct iov_iter *i) +{ + return 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 -- 2.3.3