History

fs: Add case sensitivity flags to file_kattr

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.

Chuck Lever committed 6 months ago

Commit 3035e441 parent 14c31973 files · +13 −1Browse files

Showing the changes to include/uapi (1 of 3 files). Show all

Unified · Split

include/uapi/linux/fs.h+7−0
@@ -254,6 +254,13 @@ struct file_attr { · 253 unmodified lines
254254 #define FS_XFLAG_DAX 0x00008000 /* use DAX for IO */
255255 #define FS_XFLAG_COWEXTSIZE 0x00010000 /* CoW extent size allocator hint */
256256 #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 */
257264 #define FS_XFLAG_HASATTR 0x80000000 /* no DIFLAG for this */
258265
259266 /* the read-only stuff doesn't really belong here, but any other place is