From: koraynilay <koray.fra@gmail.com>
To: Namjae Jeon <linkinjeon@kernel.org>,
Hyunchul Lee <hyc.lee@gmail.com>,
Jonathan Corbet <corbet@lwn.net>,
Eric Biggers <ebiggers@kernel.org>,
"Theodore Y . Ts'o" <tytso@mit.edu>,
Jaegeuk Kim <jaegeuk@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>
Cc: "Shuah Khan" <skhan@linuxfoundation.org>,
"Randy Dunlap" <rdunlap@infradead.org>,
"Chuck Lever" <cel@kernel.org>,
"Jeff Layton" <jlayton@kernel.org>, "Jan Kara" <jack@suse.cz>,
"Alexander Aring" <alex.aring@gmail.com>,
"Darrick J . Wong" <djwong@kernel.org>,
"Andrey Albershteyn" <aalbersh@kernel.org>,
"Amir Goldstein" <amir73il@gmail.com>,
"Miklos Szeredi" <miklos@szeredi.hu>,
"Pali Rohár" <pali@kernel.org>,
"Lauri Gates" <lauri.gates@gmail.com>,
"Christoph Hellwig" <hch@infradead.org>,
"Dave Chinner" <dgc@kernel.org>,
linux-btrfs@vger.kernel.org, linux-xfs@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
ntfs@lists.linux.dev, linux-nfs@vger.kernel.org,
linux-api@vger.kernel.org, linux-doc@vger.kernel.org,
linux-unionfs@vger.kernel.org, koraynilay <koray.fra@gmail.com>
Subject: [PATCH v4 2/7] fs: rename FS_XFLAGS_MASK and shorten other internal macro names
Date: Wed, 2 Dec 2026 22:54:22 +0100 [thread overview]
Message-ID: <20261202215427.798262-3-koray.fra@gmail.com> (raw)
In-Reply-To: <20261202215427.798262-1-koray.fra@gmail.com>
Rename FS_XFLAGS_MASK to FSX_FSXATTR_MASK and add an explanatory comment
for it so it's clearer which xflags it includes.
Make the internal xflags collection macros' names shorter so the code
that uses them can be cleaner and more readable.
Don't touch the names of the actual xflags macros as those are exposed
to userspace so they can't be easily changed.
Signed-off-by: koraynilay <koray.fra@gmail.com>
---
fs/file_attr.c | 14 +++++++-------
fs/overlayfs/copy_up.c | 2 +-
fs/overlayfs/inode.c | 2 +-
include/linux/fileattr.h | 19 ++++++++++---------
4 files changed, 19 insertions(+), 18 deletions(-)
diff --git a/fs/file_attr.c b/fs/file_attr.c
index 0f2975c9b7bc..226ee34fde2d 100644
--- a/fs/file_attr.c
+++ b/fs/file_attr.c
@@ -102,7 +102,7 @@ EXPORT_SYMBOL(vfs_fileattr_get);
static void fileattr_to_file_attr(const struct file_kattr *fa,
struct file_attr *fattr)
{
- __u32 mask = FS_XFLAGS_MASK;
+ __u32 mask = FSX_FSXATTR_MASK;
memset(fattr, 0, sizeof(struct file_attr));
fattr->fa_xflags = fa->fsx_xflags & mask;
@@ -122,7 +122,7 @@ static void fileattr_to_file_attr(const struct file_kattr *fa,
int copy_fsxattr_to_user(const struct file_kattr *fa, struct fsxattr __user *ufa)
{
struct fsxattr xfa;
- __u32 mask = FS_XFLAGS_MASK;
+ __u32 mask = FSX_FSXATTR_MASK;
memset(&xfa, 0, sizeof(xfa));
xfa.fsx_xflags = fa->fsx_xflags & mask;
@@ -141,12 +141,12 @@ EXPORT_SYMBOL(copy_fsxattr_to_user);
static int file_attr_to_fileattr(const struct file_attr *fattr,
struct file_kattr *fa)
{
- __u64 mask = FS_XFLAGS_MASK;
+ __u64 mask = FSX_FSXATTR_MASK;
if (fattr->fa_xflags & ~mask)
return -EINVAL;
- fileattr_fill_xflags(fa, fattr->fa_xflags & ~FS_XFLAG_RDONLY_MASK);
+ fileattr_fill_xflags(fa, fattr->fa_xflags & ~FSX_RDONLY_MASK);
fa->fsx_extsize = fattr->fa_extsize;
fa->fsx_projid = fattr->fa_projid;
fa->fsx_cowextsize = fattr->fa_cowextsize;
@@ -158,7 +158,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
struct fsxattr __user *ufa)
{
struct fsxattr xfa;
- __u32 mask = FS_XFLAGS_MASK;
+ __u32 mask = FSX_FSXATTR_MASK;
if (copy_from_user(&xfa, ufa, sizeof(xfa)))
return -EFAULT;
@@ -166,7 +166,7 @@ static int copy_fsxattr_from_user(struct file_kattr *fa,
if (xfa.fsx_xflags & ~mask)
return -EOPNOTSUPP;
- fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FS_XFLAG_RDONLY_MASK);
+ fileattr_fill_xflags(fa, xfa.fsx_xflags & ~FSX_RDONLY_MASK);
fa->fsx_extsize = xfa.fsx_extsize;
fa->fsx_nextents = xfa.fsx_nextents;
fa->fsx_projid = xfa.fsx_projid;
@@ -290,7 +290,7 @@ int vfs_fileattr_set(const struct mnt_idmap *idmap, struct dentry *dentry,
/* initialize missing bits from old_ma */
if (fa->flags_valid) {
- fa->fsx_xflags |= old_ma.fsx_xflags & ~FS_XFLAG_COMMON;
+ fa->fsx_xflags |= old_ma.fsx_xflags & ~FSX_COMMON;
fa->fsx_extsize = old_ma.fsx_extsize;
fa->fsx_nextents = old_ma.fsx_nextents;
fa->fsx_projid = old_ma.fsx_projid;
diff --git a/fs/overlayfs/copy_up.c b/fs/overlayfs/copy_up.c
index c147ad155b79..20f369863faf 100644
--- a/fs/overlayfs/copy_up.c
+++ b/fs/overlayfs/copy_up.c
@@ -220,7 +220,7 @@ static int ovl_copy_fileattr(struct inode *inode, const struct path *old,
newfa.flags &= ~OVL_COPY_FS_FLAGS_MASK;
newfa.flags |= (oldfa.flags & OVL_COPY_FS_FLAGS_MASK);
- BUILD_BUG_ON(OVL_COPY_FSX_FLAGS_MASK & ~FS_XFLAG_COMMON);
+ BUILD_BUG_ON(OVL_COPY_FSX_FLAGS_MASK & ~FSX_COMMON);
newfa.fsx_xflags &= ~OVL_COPY_FSX_FLAGS_MASK;
newfa.fsx_xflags |= (oldfa.fsx_xflags & OVL_COPY_FSX_FLAGS_MASK);
diff --git a/fs/overlayfs/inode.c b/fs/overlayfs/inode.c
index f1c6df39d0ae..92df4f5c071e 100644
--- a/fs/overlayfs/inode.c
+++ b/fs/overlayfs/inode.c
@@ -709,7 +709,7 @@ int ovl_fileattr_set(const struct mnt_idmap *idmap,
static void ovl_fileattr_prot_flags(struct inode *inode, struct file_kattr *fa)
{
BUILD_BUG_ON(OVL_PROT_FS_FLAGS_MASK & ~FS_COMMON_FL);
- BUILD_BUG_ON(OVL_PROT_FSX_FLAGS_MASK & ~FS_XFLAG_COMMON);
+ BUILD_BUG_ON(OVL_PROT_FSX_FLAGS_MASK & ~FSX_COMMON);
if (inode->i_flags & S_APPEND) {
fa->flags |= FS_APPEND_FL;
diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h
index 09e32b84e02a..c26f70aaa3b8 100644
--- a/include/linux/fileattr.h
+++ b/include/linux/fileattr.h
@@ -9,31 +9,32 @@
FS_NODUMP_FL | FS_NOATIME_FL | FS_DAX_FL | \
FS_PROJINHERIT_FL | FS_VERITY_FL)
-#define FS_XFLAG_COMMON \
+#define FSX_COMMON \
(FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \
FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \
FS_XFLAG_PROJINHERIT | FS_XFLAG_VERITY)
/* Read-only inode flags */
-#define FS_XFLAG_RDONLY_MASK \
+#define FSX_RDONLY_MASK \
(FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY | \
FS_XFLAG_CASEFOLD | FS_XFLAG_CASENONPRESERVING)
/* Flags to indicate valid value of fsx_ fields */
-#define FS_XFLAG_VALUES_MASK \
+#define FSX_VALUES_MASK \
(FS_XFLAG_EXTSIZE | FS_XFLAG_COWEXTSIZE)
/* Flags for directories */
-#define FS_XFLAG_DIRONLY_MASK \
+#define FSX_DIRONLY_MASK \
(FS_XFLAG_RTINHERIT | FS_XFLAG_NOSYMLINKS | FS_XFLAG_EXTSZINHERIT)
/* Misc settable flags */
-#define FS_XFLAG_MISC_MASK \
+#define FSX_MISC_MASK \
(FS_XFLAG_REALTIME | FS_XFLAG_NODEFRAG | FS_XFLAG_FILESTREAM)
-#define FS_XFLAGS_MASK \
- (FS_XFLAG_COMMON | FS_XFLAG_RDONLY_MASK | FS_XFLAG_VALUES_MASK | \
- FS_XFLAG_DIRONLY_MASK | FS_XFLAG_MISC_MASK)
+/* xflags supported by FS_IOC_FS[GS]ETXATTR and file_[gs]etattr() */
+#define FSX_FSXATTR_MASK \
+ (FSX_COMMON | FSX_RDONLY_MASK | FSX_VALUES_MASK | \
+ FSX_DIRONLY_MASK | FSX_MISC_MASK)
/*
* Merged interface for miscellaneous file attributes. 'flags' originates from
@@ -69,7 +70,7 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 flags);
static inline bool fileattr_has_fsx(const struct file_kattr *fa)
{
return fa->fsx_valid &&
- ((fa->fsx_xflags & ~FS_XFLAG_COMMON) || fa->fsx_extsize != 0 ||
+ ((fa->fsx_xflags & ~FSX_COMMON) || fa->fsx_extsize != 0 ||
fa->fsx_projid != 0 || fa->fsx_cowextsize != 0);
}
--
2.56.0
next prev parent reply other threads:[~2026-12-02 21:54 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-12-02 21:54 [PATCH v4 0/7] Add f*_xflags_{rw,ro}_mask flags to the fileattr API koraynilay
2026-12-02 21:54 ` [PATCH v4 1/7] fs: use goto out on error in vfs_fileattr_set() koraynilay
2026-12-02 21:54 ` koraynilay [this message]
2026-12-02 21:54 ` [PATCH v4 3/7] fs: add xflags masks to fileattr API koraynilay
2026-12-02 21:54 ` [PATCH v4 4/7] fs: advertise COMPR/ENCRYPT xflags in file_getattr() koraynilay
2026-12-02 21:54 ` [PATCH v4 5/7] ntfs: switch from flags to xflags in ntfs_fileattr_get/set() koraynilay
2026-12-02 21:54 ` [PATCH v4 6/7] ntfs: support the fileattr API masks " koraynilay
2026-12-02 21:54 ` [PATCH v4 7/7] docs: add fileattr API documentation koraynilay
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=20261202215427.798262-3-koray.fra@gmail.com \
--to=koray.fra@gmail.com \
--cc=aalbersh@kernel.org \
--cc=alex.aring@gmail.com \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=cel@kernel.org \
--cc=corbet@lwn.net \
--cc=dgc@kernel.org \
--cc=djwong@kernel.org \
--cc=ebiggers@kernel.org \
--cc=hch@infradead.org \
--cc=hyc.lee@gmail.com \
--cc=jack@suse.cz \
--cc=jaegeuk@kernel.org \
--cc=jlayton@kernel.org \
--cc=lauri.gates@gmail.com \
--cc=linkinjeon@kernel.org \
--cc=linux-api@vger.kernel.org \
--cc=linux-btrfs@vger.kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-nfs@vger.kernel.org \
--cc=linux-unionfs@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=miklos@szeredi.hu \
--cc=ntfs@lists.linux.dev \
--cc=pali@kernel.org \
--cc=rdunlap@infradead.org \
--cc=skhan@linuxfoundation.org \
--cc=tytso@mit.edu \
--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