Enable upper layers such as NFSD to retrieve case sensitivity information from file systems by adding FS_XFLAG_CASEFOLD and FS_XFLAG_CASENONPRESERVING flags. Filesystems report case-insensitive or case-nonpreserving behavior by setting these flags directly in fa->fsx_xflags. The default (flags unset) indicates POSIX semantics: case-sensitive and case-preserving. Both flags are added to FS_XFLAG_RDONLY_MASK so FS_IOC_FSSETXATTR silently strips them, keeping the new xflags strictly a reporting interface. Callers that want to toggle casefolding continue to use FS_IOC_SETFLAGS with FS_CASEFOLD_FL, the established UAPI on filesystems that support the operation (ext4 and f2fs on empty directories). Case sensitivity information is exported to userspace via the fa_xflags field in the FS_IOC_FSGETXATTR ioctl and file_getattr() system call.
Unified · Split
| @@ -37,6 +37,8 @@ void fileattr_fill_xflags(struct file_kattr *fa, u32 xflags) · 36 unmodified lines | ||
| 37 | 37 | fa->flags |= FS_PROJINHERIT_FL; |
| 38 | 38 | if (fa->fsx_xflags & FS_XFLAG_VERITY) |
| 39 | 39 | fa->flags |= FS_VERITY_FL; |
| 40 | + if (fa->fsx_xflags & FS_XFLAG_CASEFOLD) | |
| 41 | + fa->flags |= FS_CASEFOLD_FL; | |
| 40 | 42 | } |
| 41 | 43 | EXPORT_SYMBOL(fileattr_fill_xflags); |
| 42 | 44 | |
| @@ -67,6 +69,8 @@ void fileattr_fill_flags(struct file_kattr *fa, u32 flags) · 24 unmodified lines | ||
| 67 | 69 | fa->fsx_xflags |= FS_XFLAG_PROJINHERIT; |
| 68 | 70 | if (fa->flags & FS_VERITY_FL) |
| 69 | 71 | fa->fsx_xflags |= FS_XFLAG_VERITY; |
| 72 | + if (fa->flags & FS_CASEFOLD_FL) | |
| 73 | + fa->fsx_xflags |= FS_XFLAG_CASEFOLD; | |
| 70 | 74 | } |
| 71 | 75 | EXPORT_SYMBOL(fileattr_fill_flags); |
| 72 | 76 | |
| @@ -16,7 +16,8 @@ · 15 unmodified lines | ||
| 16 | 16 | |
| 17 | 17 | /* Read-only inode flags */ |
| 18 | 18 | #define FS_XFLAG_RDONLY_MASK \ |
| 19 | − (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY) | |
| 19 | + (FS_XFLAG_PREALLOC | FS_XFLAG_HASATTR | FS_XFLAG_VERITY | \ | |
| 20 | + FS_XFLAG_CASEFOLD | FS_XFLAG_CASENONPRESERVING) | |
| 20 | 21 | |
| 21 | 22 | /* Flags to indicate valid value of fsx_ fields */ |
| 22 | 23 | #define FS_XFLAG_VALUES_MASK \ |
| @@ -254,6 +254,13 @@ struct file_attr { · 253 unmodified lines | ||
| 254 | 254 | #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */ |
| 255 | 255 | #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */ |
| 256 | 256 | #define FS_XFLAG_VERITY 0x00020000 /* fs-verity enabled */ |
| 257 | +/* | |
| 258 | + * Case handling flags (read-only, cannot be set via ioctl). | |
| 259 | + * Default (neither set) indicates POSIX semantics: case-sensitive | |
| 260 | + * lookups and case-preserving storage. | |
| 261 | + */ | |
| 262 | +#define FS_XFLAG_CASEFOLD 0x00040000 /* case-insensitive lookups */ | |
| 263 | +#define FS_XFLAG_CASENONPRESERVING 0x00080000 /* case not preserved */ | |
| 257 | 264 | #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */ |
| 258 | 265 | |
| 259 | 266 | /* the read-only stuff doesn't really belong here, but any other place is |