public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: Christoph Hellwig <hch@infradead.org>,
	David Howells <dhowells@redhat.com>,
	willy@infradead.org, dchinner@redhat.com,
	Steve French <smfrench@gmail.com>,
	Shyam Prasad N <nspmangalore@gmail.com>,
	Rohith Surabattula <rohiths.msft@gmail.com>,
	Jeff Layton <jlayton@kernel.org>, Ira Weiny <ira.weiny@intel.com>,
	linux-cifs@vger.kernel.org, linux-fsdevel@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] iov_iter: Declare new iterator direction symbols
Date: Fri, 04 Nov 2022 17:47:20 +0000	[thread overview]
Message-ID: <1010626.1667584040@warthog.procyon.org.uk> (raw)

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 <viro@zeniv.linux.org.uk>

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 <viro@zeniv.linux.org.uk>
Signed-off-by: David Howells <dhowells@redhat.com>
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;


             reply	other threads:[~2022-11-04 17:48 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-04 17:47 David Howells [this message]
2022-11-04 18:49 ` [PATCH] iov_iter: Declare new iterator direction symbols Linus Torvalds

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1010626.1667584040@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=dchinner@redhat.com \
    --cc=hch@infradead.org \
    --cc=ira.weiny@intel.com \
    --cc=jlayton@kernel.org \
    --cc=linux-cifs@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nspmangalore@gmail.com \
    --cc=rohiths.msft@gmail.com \
    --cc=smfrench@gmail.com \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    --cc=willy@infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox