From: "Pali Rohár" <pali@kernel.org>
To: Amir Goldstein <amir73il@gmail.com>,
"Darrick J. Wong" <djwong@kernel.org>,
ronnie sahlberg <ronniesahlberg@gmail.com>,
Chuck Lever <chuck.lever@oracle.com>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Steve French <sfrench@samba.org>,
Alexander Viro <viro@zeniv.linux.org.uk>
Cc: linux-fsdevel@vger.kernel.org, linux-cifs@vger.kernel.org,
linux-kernel@vger.kernel.org
Subject: [RFC PATCH 1/4] fs: Add FS_XFLAG_COMPRESSED & FS_XFLAG_ENCRYPTED for FS_IOC_FS[GS]ETXATTR API
Date: Sun, 16 Feb 2025 17:40:26 +0100 [thread overview]
Message-ID: <20250216164029.20673-2-pali@kernel.org> (raw)
In-Reply-To: <20250216164029.20673-1-pali@kernel.org>
This allows to get or set FS_COMPR_FL and FS_ENCRYPT_FL bits via FS_IOC_FSGETXATTR/FS_IOC_FSSETXATTR API.
Signed-off-by: Pali Rohár <pali@kernel.org>
---
fs/ioctl.c | 8 ++++++++
include/linux/fileattr.h | 4 ++--
include/uapi/linux/fs.h | 2 ++
3 files changed, 12 insertions(+), 2 deletions(-)
diff --git a/fs/ioctl.c b/fs/ioctl.c
index 638a36be31c1..9f3609b50779 100644
--- a/fs/ioctl.c
+++ b/fs/ioctl.c
@@ -480,6 +480,10 @@ void fileattr_fill_xflags(struct fileattr *fa, u32 xflags)
fa->flags |= FS_DAX_FL;
if (fa->fsx_xflags & FS_XFLAG_PROJINHERIT)
fa->flags |= FS_PROJINHERIT_FL;
+ if (fa->fsx_xflags & FS_XFLAG_COMPRESSED)
+ fa->flags |= FS_COMPR_FL;
+ if (fa->fsx_xflags & FS_XFLAG_ENCRYPTED)
+ fa->flags |= FS_ENCRYPT_FL;
}
EXPORT_SYMBOL(fileattr_fill_xflags);
@@ -496,6 +500,8 @@ void fileattr_fill_flags(struct fileattr *fa, u32 flags)
memset(fa, 0, sizeof(*fa));
fa->flags_valid = true;
fa->flags = flags;
+ if (fa->flags & FS_COMPR_FL)
+ fa->fsx_xflags |= FS_XFLAG_COMPRESSED;
if (fa->flags & FS_SYNC_FL)
fa->fsx_xflags |= FS_XFLAG_SYNC;
if (fa->flags & FS_IMMUTABLE_FL)
@@ -506,6 +512,8 @@ void fileattr_fill_flags(struct fileattr *fa, u32 flags)
fa->fsx_xflags |= FS_XFLAG_NODUMP;
if (fa->flags & FS_NOATIME_FL)
fa->fsx_xflags |= FS_XFLAG_NOATIME;
+ if (fa->flags & FS_ENCRYPT_FL)
+ fa->fsx_xflags |= FS_XFLAG_ENCRYPTED;
if (fa->flags & FS_DAX_FL)
fa->fsx_xflags |= FS_XFLAG_DAX;
if (fa->flags & FS_PROJINHERIT_FL)
diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h
index 47c05a9851d0..c297e6151703 100644
--- a/include/linux/fileattr.h
+++ b/include/linux/fileattr.h
@@ -7,12 +7,12 @@
#define FS_COMMON_FL \
(FS_SYNC_FL | FS_IMMUTABLE_FL | FS_APPEND_FL | \
FS_NODUMP_FL | FS_NOATIME_FL | FS_DAX_FL | \
- FS_PROJINHERIT_FL)
+ FS_PROJINHERIT_FL | FS_COMPR_FL | FS_ENCRYPT_FL)
#define FS_XFLAG_COMMON \
(FS_XFLAG_SYNC | FS_XFLAG_IMMUTABLE | FS_XFLAG_APPEND | \
FS_XFLAG_NODUMP | FS_XFLAG_NOATIME | FS_XFLAG_DAX | \
- FS_XFLAG_PROJINHERIT)
+ FS_XFLAG_PROJINHERIT | FS_XFLAG_COMPRESSED | FS_XFLAG_ENCRYPTED)
/*
* Merged interface for miscellaneous file attributes. 'flags' originates from
diff --git a/include/uapi/linux/fs.h b/include/uapi/linux/fs.h
index 2bbe00cf1248..367bc5289c47 100644
--- a/include/uapi/linux/fs.h
+++ b/include/uapi/linux/fs.h
@@ -167,6 +167,8 @@ struct fsxattr {
#define FS_XFLAG_FILESTREAM 0x00004000 /* use filestream allocator */
#define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */
#define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
+#define FS_XFLAG_COMPRESSED 0x00020000 /* compressed file */
+#define FS_XFLAG_ENCRYPTED 0x00040000 /* encrypted file */
#define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
/* the read-only stuff doesn't really belong here, but any other place is
--
2.20.1
next prev parent reply other threads:[~2025-02-16 16:42 UTC|newest]
Thread overview: 33+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-02-16 16:40 [RFC PATCH 0/4] fs: Add support for Windows file attributes Pali Rohár
2025-02-16 16:40 ` Pali Rohár [this message]
2025-02-16 18:34 ` [RFC PATCH 1/4] fs: Add FS_XFLAG_COMPRESSED & FS_XFLAG_ENCRYPTED for FS_IOC_FS[GS]ETXATTR API Eric Biggers
2025-02-16 18:49 ` Pali Rohár
2025-02-16 20:17 ` Amir Goldstein
2025-02-16 20:24 ` Pali Rohár
2025-02-16 20:43 ` Amir Goldstein
2025-02-16 21:17 ` Pali Rohár
2025-02-17 8:27 ` Amir Goldstein
2025-02-18 1:33 ` Dave Chinner
2025-02-18 9:13 ` Amir Goldstein
2025-02-18 19:27 ` Pali Rohár
2025-02-18 22:56 ` Dave Chinner
2025-02-18 23:06 ` Pali Rohár
2025-02-19 7:55 ` Amir Goldstein
2025-02-21 16:34 ` Theodore Ts'o
2025-02-21 17:11 ` Amir Goldstein
2025-02-25 5:41 ` Dave Chinner
2025-02-25 20:14 ` Pali Rohár
2025-02-21 18:55 ` Andreas Dilger
2025-02-25 3:42 ` Dave Chinner
2025-02-18 22:45 ` Dave Chinner
2025-02-16 16:40 ` [RFC PATCH 2/4] fs: Extend FS_IOC_FS[GS]ETXATTR API for Windows attributes Pali Rohár
2025-02-16 19:55 ` Amir Goldstein
2025-02-16 20:01 ` Pali Rohár
2025-02-16 20:34 ` Amir Goldstein
2025-02-16 21:01 ` Pali Rohár
2025-02-16 16:40 ` [RFC PATCH 3/4] fs: Implement support for fsx_xflags_mask, fsx_xflags2 and fsx_xflags2_mask into vfs Pali Rohár
2025-02-21 18:24 ` Theodore Ts'o
2025-02-25 20:07 ` Pali Rohár
2025-02-16 16:40 ` [RFC PATCH 4/4] cifs: Implement FS_IOC_FS[GS]ETXATTR API for Windows attributes Pali Rohár
2025-02-16 20:21 ` Amir Goldstein
2025-02-16 20:25 ` Pali Rohár
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=20250216164029.20673-2-pali@kernel.org \
--to=pali@kernel.org \
--cc=amir73il@gmail.com \
--cc=brauner@kernel.org \
--cc=chuck.lever@oracle.com \
--cc=djwong@kernel.org \
--cc=jack@suse.cz \
--cc=linux-cifs@vger.kernel.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ronniesahlberg@gmail.com \
--cc=sfrench@samba.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