All of lore.kernel.org
 help / color / mirror / Atom feed
From: David Howells <dhowells@redhat.com>
To: viro@zeniv.linux.org.uk
Cc: dhowells@redhat.com, linux-kernel@vger.kernel.org,
	hch@infradead.org, linux-fsdevel@vger.kernel.org,
	linux-ext4@vger.kernel.org, linux-xfs@vger.kernel.org
Subject: [PATCH 7/8] statx: Reserve the top bit of the mask for future struct expansion
Date: Fri, 31 Mar 2017 18:32:10 +0100	[thread overview]
Message-ID: <149098153077.28108.1844719448258566328.stgit@warthog.procyon.org.uk> (raw)
In-Reply-To: <149098148523.28108.1441135633380173665.stgit@warthog.procyon.org.uk>

Reserve the top bit of the mask for future expansion of the statx struct
and give an error if statx() sees it set.  All the other bits are ignored
if we see them set but don't support the bit; we just clear the bit in the
returned mask.

Signed-off-by: David Howells <dhowells@redhat.com>
---

 fs/stat.c                 |    2 ++
 include/uapi/linux/stat.h |    1 +
 2 files changed, 3 insertions(+)

diff --git a/fs/stat.c b/fs/stat.c
index ab27f2868588..0c7e6cdc435c 100644
--- a/fs/stat.c
+++ b/fs/stat.c
@@ -562,6 +562,8 @@ SYSCALL_DEFINE5(statx,
 	struct kstat stat;
 	int error;
 
+	if (mask & STATX__RESERVED)
+		return -EINVAL;
 	if ((flags & AT_STATX_SYNC_TYPE) == AT_STATX_SYNC_TYPE)
 		return -EINVAL;
 
diff --git a/include/uapi/linux/stat.h b/include/uapi/linux/stat.h
index 51a6b86e3700..0869b9eaa8ce 100644
--- a/include/uapi/linux/stat.h
+++ b/include/uapi/linux/stat.h
@@ -152,6 +152,7 @@ struct statx {
 #define STATX_BASIC_STATS	0x000007ffU	/* The stuff in the normal stat struct */
 #define STATX_BTIME		0x00000800U	/* Want/got stx_btime */
 #define STATX_ALL		0x00000fffU	/* All currently supported flags */
+#define STATX__RESERVED		0x80000000U	/* Reserved for future struct statx expansion */
 
 /*
  * Attributes to be found in stx_attributes

  parent reply	other threads:[~2017-03-31 17:33 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-31 17:31 [PATCH 1/8] Documentation/filesystems: fix documentation for ->getattr() David Howells
2017-03-31 17:31 ` [PATCH 2/8] statx: reject unknown flags when using NULL path David Howells
2017-03-31 17:31 ` [PATCH 3/8] statx: remove incorrect part of vfs_statx() comment David Howells
2017-03-31 17:31 ` [PATCH 4/8] statx: optimize copy of struct statx to userspace David Howells
2017-03-31 17:31 ` [PATCH 5/8] ext4: Add statx support David Howells
2017-03-31 17:32 ` [PATCH 6/8] xfs: report crtime and attribute flags to statx David Howells
2017-03-31 17:32 ` David Howells [this message]
2017-03-31 17:32 ` [PATCH 8/8] statx: Include a mask for stx_attributes in struct statx David Howells
2017-03-31 17:41   ` Darrick J. Wong
2017-04-04  7:12   ` Christoph Hellwig
2017-04-12 15:12     ` Christoph Hellwig

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=149098153077.28108.1844719448258566328.stgit@warthog.procyon.org.uk \
    --to=dhowells@redhat.com \
    --cc=hch@infradead.org \
    --cc=linux-ext4@vger.kernel.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-xfs@vger.kernel.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.