From patchwork Fri Nov 4 17:47:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Howells X-Patchwork-Id: 15735 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp554260wru; Fri, 4 Nov 2022 10:58:55 -0700 (PDT) X-Google-Smtp-Source: AMsMyM61Vy7se+M8dDfl1JATaF3vkxOf2kmv4euAOdHrgr5LKYpFbGVpXuuhTup/3VVa5owZZ+HC X-Received: by 2002:a17:907:a0e:b0:780:72bb:5ce4 with SMTP id bb14-20020a1709070a0e00b0078072bb5ce4mr36323604ejc.234.1667584734952; Fri, 04 Nov 2022 10:58:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667584734; cv=none; d=google.com; s=arc-20160816; b=l/tngEx1luPv8iQzoEdgAixc/ctpUbIvo9ctKubXJOwuyzEgRKtjbIQgnvBIJowW2Z WMViqaaKSA6Nina4Jx+2vncRWgL/CWh1mHMlHjIOndyILe4r7TsH22dPqLn3o003rl/7 gwo/CBaEA6EY6Cr1hxa/C6vlioMXVSL0ZC0rmxjjsZyJtSpY4aZkbboTZ4/TMNVBK/SM WYT5HHOfS1bAbO1NyPwEsL+e0cDm6IE7WcbmLrKb/TBHRm3n2UlXYBQe94fZRJxQq5Fn KKDzWxHmiNu6fJW5/ufLg+Q5hVdNnlyhpAElvOzartMb8+dapQH2UcKRdhitXecciMd+ O7IQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:message-id:date:content-transfer-encoding :content-id:mime-version:subject:cc:to:from:organization :dkim-signature; bh=qnPmYmConUMgaBA5iJmBF7ozEvY3875t4nGAe/KAgjQ=; b=Y+QXmhFvXLYLTJlw7RU5HcEtTLPoTEnXYpTy0m4nBjXuaYT9InzzX7G/I64doOWZJZ 3Bi7SCnWO1a1x/v/S6izuDV//3Sq2nmVrfT5aN7me6yTnjgx01TU/f7HrFZbr5ifUzxs 1k+DTfcAYXoYxbozXk63qXpvgCFq3iMJ43vGLxvtuSpc/FkbjBxXePhgj4tjz6gnJsdi X42NCmUof9vtGXRP7ariNfJcUCBO6rENws1lO8eg/lVjILzq0G5WScHtyT21GVpTT/nd w1q4swzv6hYVOm+ei20oVLC/8oi7GQauOkDshXs3uZUGAAxLJq/2IyLzYEeM46A90bg6 a2Jg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XGQybIPr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 11-20020a508e0b000000b004616acd9cbcsi115103edw.360.2022.11.04.10.58.31; Fri, 04 Nov 2022 10:58:54 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=XGQybIPr; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231820AbiKDRse (ORCPT + 99 others); Fri, 4 Nov 2022 13:48:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54506 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231398AbiKDRsb (ORCPT ); Fri, 4 Nov 2022 13:48:31 -0400 Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.133.124]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 05C1A43AD2 for ; Fri, 4 Nov 2022 10:47:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1667584048; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=qnPmYmConUMgaBA5iJmBF7ozEvY3875t4nGAe/KAgjQ=; b=XGQybIPrL7qvkhV+JFhFl1i/73L8BXxvQ9w/H7mK48m5O0PMxlaNMFD07E9t/uqvGlML1J Wd1eday13O9/hMeUGMIK0hYM93B2E4Z7/oPCEKbbR1pYMvLBmwaot7AmC8dxOEC8ssy+pC EdVU9Xg5mxe45UfyqSr0Jm5q/zBaCTQ= Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-102-3FIYXAr3MwugYiDXwX6Aig-1; Fri, 04 Nov 2022 13:47:24 -0400 X-MC-Unique: 3FIYXAr3MwugYiDXwX6Aig-1 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 7905F85A583; Fri, 4 Nov 2022 17:47:23 +0000 (UTC) Received: from warthog.procyon.org.uk (unknown [10.33.37.22]) by smtp.corp.redhat.com (Postfix) with ESMTP id 9C97C4EA5A; Fri, 4 Nov 2022 17:47:21 +0000 (UTC) Organization: Red Hat UK Ltd. Registered Address: Red Hat UK Ltd, Amberley Place, 107-111 Peascod Street, Windsor, Berkshire, SI4 1TE, United Kingdom. Registered in England and Wales under Company Registration No. 3798903 From: David Howells To: Linus Torvalds , Al Viro Cc: Christoph Hellwig , David Howells , willy@infradead.org, dchinner@redhat.com, Steve French , Shyam Prasad N , Rohith Surabattula , Jeff Layton , Ira Weiny , linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] iov_iter: Declare new iterator direction symbols MIME-Version: 1.0 Content-ID: <1010625.1667584040.1@warthog.procyon.org.uk> Date: Fri, 04 Nov 2022 17:47:20 +0000 Message-ID: <1010626.1667584040@warthog.procyon.org.uk> X-Scanned-By: MIMEDefang 3.1 on 10.11.54.5 X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748589331322923896?= X-GMAIL-MSGID: =?utf-8?q?1748589331322923896?= Hi Linus, Al, If we're going to go with Al's changes to switch to using ITER_SOURCE and ITER_DEST instead of READ/WRITE, can we put just the new symbols into mainline now, even if we leave the rest for the next merge window? Thanks, David --- From: Al Viro iov_iter: Declare new iterator direction symbols READ/WRITE proved to be actively confusing - the meanings are "data destination, as used with read(2)" and "data source, as used with write(2)", but people keep interpreting those as "we read data from it" and "we write data to it", i.e. exactly the wrong way. Call them ITER_DEST and ITER_SOURCE - at least that is harder to misinterpret... [dhowells] Declare the symbols for later use and change to an enum. If READ/WRITE are switched to an enum also, I think the compiler should generate a warning if they're mixed. Signed-off-by: Al Viro Signed-off-by: David Howells Link: https://lore.kernel.org/r/20221028023352.3532080-12-viro@zeniv.linux.org.uk/ # v2 --- include/linux/uio.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/linux/uio.h b/include/linux/uio.h index 2e3134b14ffd..7c1317b34c57 100644 --- a/include/linux/uio.h +++ b/include/linux/uio.h @@ -29,6 +29,11 @@ enum iter_type { ITER_UBUF, }; +enum iov_iter_direction { + ITER_DEST = 0, /* Iterator is a destination buffer (== READ) */ + ITER_SOURCE = 1, /* Iterator is a source buffer (== WRITE) */ +}; + struct iov_iter_state { size_t iov_offset; size_t count;