lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <1010626.1667584040@warthog.procyon.org.uk>
Date:   Fri, 04 Nov 2022 17:47:20 +0000
From:   David Howells <dhowells@...hat.com>
To:     Linus Torvalds <torvalds@...ux-foundation.org>,
        Al Viro <viro@...iv.linux.org.uk>
Cc:     Christoph Hellwig <hch@...radead.org>,
        David Howells <dhowells@...hat.com>, willy@...radead.org,
        dchinner@...hat.com, Steve French <smfrench@...il.com>,
        Shyam Prasad N <nspmangalore@...il.com>,
        Rohith Surabattula <rohiths.msft@...il.com>,
        Jeff Layton <jlayton@...nel.org>,
        Ira Weiny <ira.weiny@...el.com>, linux-cifs@...r.kernel.org,
        linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: [PATCH] iov_iter: Declare new iterator direction symbols

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@...iv.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@...iv.linux.org.uk>
Signed-off-by: David Howells <dhowells@...hat.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;

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ