From: Chuck Lever Add case sensitivity reporting to the existing hfsplus_fileattr_get() function via the FS_XFLAG_CASEFOLD flag. HFS+ always preserves case at rest. Case sensitivity depends on how the volume was formatted: HFSX volumes may be either case-sensitive or case-insensitive, indicated by the HFSPLUS_SB_CASEFOLD superblock flag. Reviewed-by: Viacheslav Dubeyko Signed-off-by: Chuck Lever --- fs/hfsplus/inode.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/fs/hfsplus/inode.c b/fs/hfsplus/inode.c index d05891ec492e..ffbb57493d7b 100644 --- a/fs/hfsplus/inode.c +++ b/fs/hfsplus/inode.c @@ -740,6 +740,7 @@ int hfsplus_fileattr_get(struct dentry *dentry, struct file_kattr *fa) { struct inode *inode = d_inode(dentry); struct hfsplus_inode_info *hip = HFSPLUS_I(inode); + struct hfsplus_sb_info *sbi = HFSPLUS_SB(inode->i_sb); unsigned int flags = 0; if (inode->i_flags & S_IMMUTABLE) @@ -751,6 +752,15 @@ int hfsplus_fileattr_get(struct dentry *dentry, struct file_kattr *fa) fileattr_fill_flags(fa, flags); + /* + * HFS+ always preserves case at rest. Standard HFS+ volumes + * are case-insensitive; HFSX volumes may be either + * case-sensitive or case-insensitive depending on how they + * were formatted. HFSPLUS_SB_CASEFOLD is set in both + * case-insensitive variants. + */ + if (test_bit(HFSPLUS_SB_CASEFOLD, &sbi->flags)) + fa->fsx_xflags |= FS_XFLAG_CASEFOLD; return 0; } -- 2.53.0