From: Chuck Lever <[email protected]>

Enable upper layers such as NFSD to retrieve case sensitivity
information from file systems by adding case_insensitive and
case_preserving boolean fields to struct file_kattr.

The default POSIX behavior (case-sensitive, case-preserving) is
initialized in vfs_fileattr_get(), allowing filesystems to override
these values only when they differ from the default.

Signed-off-by: Chuck Lever <[email protected]>
---
 fs/file_attr.c           | 10 ++++++++++
 include/linux/fileattr.h |  3 +++
 2 files changed, 13 insertions(+)

diff --git a/fs/file_attr.c b/fs/file_attr.c
index 13cdb31a3e94..a73de0e0ecac 100644
--- a/fs/file_attr.c
+++ b/fs/file_attr.c
@@ -21,6 +21,9 @@
 void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags)
 {
        memset(fa, 0, sizeof(*fa));
+       /* Default: POSIX semantics (case-sensitive, case-preserving) */
+       fa->case_insensitive = false;
+       fa->case_preserving = true;
        fa->fsx_valid = true;
        fa->fsx_xflags = xflags;
        if (fa->fsx_xflags & FS_XFLAG_IMMUTABLE)
@@ -51,6 +54,9 @@ EXPORT_SYMBOL(fileattr_fill_xflags);
 void fileattr_fill_flags(struct file_kattr *fa, u32 flags)
 {
        memset(fa, 0, sizeof(*fa));
+       /* Default: POSIX semantics (case-sensitive, case-preserving) */
+       fa->case_insensitive = false;
+       fa->case_preserving = true;
        fa->flags_valid = true;
        fa->flags = flags;
        if (fa->flags & FS_SYNC_FL)
@@ -84,6 +90,10 @@ int vfs_fileattr_get(struct dentry *dentry, struct 
file_kattr *fa)
        struct inode *inode = d_inode(dentry);
        int error;
 
+       /* Default: POSIX semantics (case-sensitive, case-preserving) */
+       fa->case_insensitive = false;
+       fa->case_preserving = true;
+
        if (!inode->i_op->fileattr_get)
                return -ENOIOCTLCMD;
 
diff --git a/include/linux/fileattr.h b/include/linux/fileattr.h
index f89dcfad3f8f..cfd4d3973716 100644
--- a/include/linux/fileattr.h
+++ b/include/linux/fileattr.h
@@ -51,6 +51,9 @@ struct file_kattr {
        /* selectors: */
        bool    flags_valid:1;
        bool    fsx_valid:1;
+       /* case sensitivity behavior: */
+       bool    case_insensitive:1;
+       bool    case_preserving:1;
 };
 
 int copy_fsxattr_to_user(const struct file_kattr *fa, struct fsxattr __user 
*ufa);
-- 
2.52.0



_______________________________________________
Linux-f2fs-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/linux-f2fs-devel

Reply via email to