]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
hfs: Implement fileattr_get for case sensitivity
authorChuck Lever <chuck.lever@oracle.com>
Thu, 7 May 2026 08:52:59 +0000 (04:52 -0400)
committerChristian Brauner <brauner@kernel.org>
Mon, 11 May 2026 14:50:28 +0000 (16:50 +0200)
Report HFS case sensitivity behavior via the FS_XFLAG_CASEFOLD
flag. HFS is always case-insensitive (using Mac OS Roman case
folding) and always preserves case at rest.

Reviewed-by: Viacheslav Dubeyko <slava@dubeyko.com>
Reviewed-by: Roland Mainz <roland.mainz@nrubsig.org>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Link: https://patch.msgid.link/20260507-case-sensitivity-v14-6-e62cc8200435@oracle.com
Signed-off-by: Christian Brauner <brauner@kernel.org>
fs/hfs/dir.c
fs/hfs/hfs_fs.h
fs/hfs/inode.c

index f5e7efe924e7838d3ce3eadcaf275ca2332e90f3..c4c6e1623f55d163121d396087df7ac64de13c04 100644 (file)
@@ -328,4 +328,5 @@ const struct inode_operations hfs_dir_inode_operations = {
        .rmdir          = hfs_remove,
        .rename         = hfs_rename,
        .setattr        = hfs_inode_setattr,
+       .fileattr_get   = hfs_fileattr_get,
 };
index ac0e83f77a0f196bafd00a436ec92c042d4e9560..1b23448c9a48b4dd807804f51ad313db0b6aecce 100644 (file)
@@ -177,6 +177,8 @@ extern int hfs_get_block(struct inode *inode, sector_t block,
 extern const struct address_space_operations hfs_aops;
 extern const struct address_space_operations hfs_btree_aops;
 
+struct file_kattr;
+int hfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa);
 int hfs_write_begin(const struct kiocb *iocb, struct address_space *mapping,
                    loff_t pos, unsigned int len, struct folio **foliop,
                    void **fsdata);
index 89b33a9d46d5c0538f3174008dd901ed60332bc8..f41cc261684d9772e13df5e142e365c5ebcf43e0 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/uio.h>
 #include <linux/xattr.h>
 #include <linux/blkdev.h>
+#include <linux/fileattr.h>
 
 #include "hfs_fs.h"
 #include "btree.h"
@@ -699,6 +700,18 @@ static int hfs_file_fsync(struct file *filp, loff_t start, loff_t end,
        return ret;
 }
 
+int hfs_fileattr_get(struct dentry *dentry, struct file_kattr *fa)
+{
+       /*
+        * HFS compares filenames using Mac OS Roman case folding, so
+        * lookup is always case-insensitive. Names are stored on disk
+        * with case intact; CASENONPRESERVING stays clear.
+        */
+       fa->fsx_xflags |= FS_XFLAG_CASEFOLD;
+       fa->flags |= FS_CASEFOLD_FL;
+       return 0;
+}
+
 static const struct file_operations hfs_file_operations = {
        .llseek         = generic_file_llseek,
        .read_iter      = generic_file_read_iter,
@@ -715,4 +728,5 @@ static const struct inode_operations hfs_file_inode_operations = {
        .lookup         = hfs_file_lookup,
        .setattr        = hfs_inode_setattr,
        .listxattr      = generic_listxattr,
+       .fileattr_get   = hfs_fileattr_get,
 };