From: Andrew Morton <akpm@linux-foundation.org>
To: Paul Turner <pjt@google.com>
Cc: linux-kernel@vger.kernel.org, adobriyan@gmail.com,
ebierderm@xmission.com, stable@kernel.org,
Al Viro <viro@zeniv.linux.org.uk>,
Linus Torvalds <torvalds@linux-foundation.org>
Subject: Re: [PATCH] Separate FMODE_PREAD/FMODE_PWRITE into separate flags
Date: Wed, 4 Feb 2009 19:36:15 -0800 [thread overview]
Message-ID: <20090204193615.2d9aaa7a.akpm@linux-foundation.org> (raw)
In-Reply-To: <Pine.LNX.4.64.0902041736080.15728@kitami.corp.google.com>
(cc's restored)
On Wed, 4 Feb 2009 18:06:11 -0800 (PST) Paul Turner <pjt@google.com> wrote:
> Separate FMODE_PREAD and FMODE_PWRITE into separate flags to reflect the
> reality that the read and write paths may have independent restrictions.
>
> A git grep verifies that these flags are always cleared together so this new
> behavior will only apply to interfaces that change to clear flags individually.
>
> Signed-off-by: Paul Turner <pjt@google.com>
> ---
> include/linux/fs.h | 13 +++++++------
> 1 files changed, 7 insertions(+), 6 deletions(-)
>
> diff --git a/include/linux/fs.h b/include/linux/fs.h
> index 6022f44..d6a51d9 100644
> --- a/include/linux/fs.h
> +++ b/include/linux/fs.h
> @@ -60,18 +60,19 @@ struct inodes_stat_t {
> #define FMODE_WRITE ((__force fmode_t)2)
> /* file is seekable */
> #define FMODE_LSEEK ((__force fmode_t)4)
> -/* file can be accessed using pread/pwrite */
> +/* file can be accessed using pread */
> #define FMODE_PREAD ((__force fmode_t)8)
> -#define FMODE_PWRITE FMODE_PREAD /* These go hand in hand */
> +/* file can be accessed using pwrite */
> +#define FMODE_PWRITE ((__force fmode_t)16)
> /* File is opened for execution with sys_execve / sys_uselib */
> -#define FMODE_EXEC ((__force fmode_t)16)
> +#define FMODE_EXEC ((__force fmode_t)32)
> /* File is opened with O_NDELAY (only set for block devices) */
> -#define FMODE_NDELAY ((__force fmode_t)32)
> +#define FMODE_NDELAY ((__force fmode_t)64)
> /* File is opened with O_EXCL (only set for block devices) */
> -#define FMODE_EXCL ((__force fmode_t)64)
> +#define FMODE_EXCL ((__force fmode_t)128)
> /* File is opened using open(.., 3, ..) and is writeable only for ioctls
> (specialy hack for floppy.c) */
> -#define FMODE_WRITE_IOCTL ((__force fmode_t)128)
> +#define FMODE_WRITE_IOCTL ((__force fmode_t)256)
>
> /*
> * Don't update ctime and mtime.
Seems OK.
I augmented the changelog to
Separate FMODE_PREAD and FMODE_PWRITE into separate flags to
reflect the reality that the read and write paths may have
independent restrictions.
A git grep verifies that these flags are always cleared together so
this new behavior will only apply to interfaces that change to clear
flags individually.
+ This is required for "seq_file: properly cope with pread", a
+ post-2.6.25 regression fix.
and added this comment:
--- a/include/linux/fs.h~vfs-separate-fmode_pread-fmode_pwrite-into-separate-flags-fix
+++ a/include/linux/fs.h
@@ -54,6 +54,11 @@ struct inodes_stat_t {
#define MAY_ACCESS 16
#define MAY_OPEN 32
+/*
+ * flags in file.f_mode. Note that FMODE_READ and FMODE_WRITE must correspond
+ * to O_WRONLY and O_RDWR via the strange trick in __dentry_open()
+ */
+
/* file is open for reading */
#define FMODE_READ ((__force fmode_t)1)
/* file is open for writing */
_
next prev parent reply other threads:[~2009-02-05 3:36 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-02-05 2:06 Paul Turner
2009-02-05 2:13 ` Paul Turner
2009-02-05 3:36 ` Andrew Morton [this message]
2009-02-05 3:42 ` Andrew Morton
2009-02-05 3:43 ` Andrew Morton
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=20090204193615.2d9aaa7a.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=ebierderm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=pjt@google.com \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®