From patchwork Tue Mar 17 21:04:02 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Omar Sandoval X-Patchwork-Id: 6034601 Return-Path: X-Original-To: patchwork-linux-fsdevel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 065E6BF90F for ; Tue, 17 Mar 2015 21:04:46 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1063020421 for ; Tue, 17 Mar 2015 21:04:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3A30B2041F for ; Tue, 17 Mar 2015 21:04:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752886AbbCQVEm (ORCPT ); Tue, 17 Mar 2015 17:04:42 -0400 Received: from mail-pd0-f181.google.com ([209.85.192.181]:34322 "EHLO mail-pd0-f181.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750958AbbCQVEl (ORCPT ); Tue, 17 Mar 2015 17:04:41 -0400 Received: by pdbni2 with SMTP id ni2so20515993pdb.1 for ; Tue, 17 Mar 2015 14:04:40 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=Q1tC9o5yA+QRNDtl/vGeud5aHGgHeXMgWuqD0dHNSL0=; b=H+kxlujnewgSPT+4m+VWPm0Y1xK9KCISnV6UmaqbHO+2CBuNWP6J5NZqU8BGoURqjb TJrlSke7AkFEYz7esZwm9/8Z34PPb7j8Y7LrzBYJvlO5mjWxtBfeecwO5kbRn2VX+cl1 20ELEP/Gtg1APImGBRHIWUpQhhfmW1VaoS+i+4S8LljY2/py+UcEzDwYws7nSeX19PQ5 RjW2OMLesR86og0+5ngcmsAuFkCTJUJcEe6qpsA/5RvovdLN8cg3qU4iXZ0PQdlPu1Py ikAGotaujeObwpGO9qhe+63KYkcH8//JOSSL+omBf5BdNYjwrN2UInHHS6YK+GKPsCCQ 2FLQ== X-Gm-Message-State: ALoCoQmfmRzZYnmfQCzRKaYuaGpVf/hWZWQlC5Kn3kDYJyCACaSn/CElsQPtqw1PGayx9EMNv3zj X-Received: by 10.67.7.195 with SMTP id de3mr48084251pad.79.1426626280445; Tue, 17 Mar 2015 14:04:40 -0700 (PDT) Received: from mew.localdomain (c-76-104-211-44.hsd1.wa.comcast.net. [76.104.211.44]) by mx.google.com with ESMTPSA id dt10sm23899603pdb.82.2015.03.17.14.04.38 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 17 Mar 2015 14:04:38 -0700 (PDT) From: Omar Sandoval To: Al Viro , David Sterba Cc: linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, Omar Sandoval Subject: [RFC PATCH v3 1/5] new helper: iov_iter_rw() Date: Tue, 17 Mar 2015 14:04:02 -0700 Message-Id: X-Mailer: git-send-email 2.3.3 In-Reply-To: <20150317181910.GK29656@ZenIV.linux.org.uk> References: <20150317181910.GK29656@ZenIV.linux.org.uk> Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Get either READ or WRITE out of iter->type. Signed-off-by: Omar Sandoval --- Ok, let's do that, then. include/linux/uio.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 7188029..71889c9 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) } /* + * 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