[Concept,12/23] ext4l: Move STATX_* and struct kstat to linux/stat.h

Message ID 20260119061529.3383191-13-sjg@u-boot.org
State New
Headers
Series Reduce ext4_uboot.h by moving definitions to linux headers |

Commit Message

Simon Glass Jan. 19, 2026, 6:15 a.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move the STATX_* flags and struct kstat definition to include/linux/stat.h
where they belong alongside the struct stat definitions, matching Linux
kernel organisation.

This reduces ext4_uboot.h by 40 lines.

Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---

 fs/ext4l/ext4_uboot.h | 41 +-----------------------------------
 include/linux/stat.h  | 48 +++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 49 insertions(+), 40 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 89d1296c18b..d017d86247b 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -491,48 +491,9 @@  static inline int bdev_read_only(struct block_device *bdev)
 
 /* SB_LAZYTIME is in linux/fs.h */
 /* ATTR_* iattr valid flags are in linux/fs.h */
-
-/* STATX flags and attributes */
-#define STATX_BTIME		0x00000800U
-#define STATX_DIOALIGN		0x00002000U
-#define STATX_WRITE_ATOMIC	0x00004000U
-#define STATX_ATTR_COMPRESSED	0x00000004
-#define STATX_ATTR_IMMUTABLE	0x00000010
-#define STATX_ATTR_APPEND	0x00000020
-#define STATX_ATTR_NODUMP	0x00000040
-#define STATX_ATTR_ENCRYPTED	0x00000800
-#define STATX_ATTR_VERITY	0x00100000
-
+/* STATX_* flags and struct kstat are in linux/stat.h */
 /* VM fault return values are in linux/mm_types.h */
-
 /* struct path is defined in linux/fs.h */
-
-/* struct kstat - stat buffer */
-struct kstat {
-	u64 ino;
-	dev_t dev;
-	umode_t mode;
-	unsigned int nlink;
-	uid_t uid;
-	gid_t gid;
-	dev_t rdev;
-	loff_t size;
-	struct timespec64 atime;
-	struct timespec64 mtime;
-	struct timespec64 ctime;
-	struct timespec64 btime;
-	u64 blocks;
-	u32 blksize;
-	u64 attributes;
-	u64 attributes_mask;
-	u32 result_mask;
-	u32 dio_mem_align;
-	u32 dio_offset_align;
-	u32 atomic_write_unit_min;
-	u32 atomic_write_unit_max;
-	u32 atomic_write_segments_max;
-};
-
 /* VM structs (vm_area_struct, page, vm_fault, vm_operations_struct) are in linux/mm_types.h */
 
 /* Forward declaration for swap */
diff --git a/include/linux/stat.h b/include/linux/stat.h
index b65bff7e97d..9a5babbc5be 100644
--- a/include/linux/stat.h
+++ b/include/linux/stat.h
@@ -180,4 +180,52 @@  struct stat {
 }
 #endif
 
+/*
+ * STATX flags and attributes
+ */
+#define STATX_BTIME		0x00000800U	/* Want/got btime */
+#define STATX_DIOALIGN		0x00002000U	/* Want/got dio alignment */
+#define STATX_WRITE_ATOMIC	0x00004000U	/* Want/got atomic writes */
+
+/* File attributes for STATX */
+#define STATX_ATTR_COMPRESSED	0x00000004	/* Compressed file */
+#define STATX_ATTR_IMMUTABLE	0x00000010	/* Immutable file */
+#define STATX_ATTR_APPEND	0x00000020	/* Append-only file */
+#define STATX_ATTR_NODUMP	0x00000040	/* No dump file */
+#define STATX_ATTR_ENCRYPTED	0x00000800	/* Encrypted file */
+#define STATX_ATTR_VERITY	0x00100000	/* Verity protected file */
+
+#include <linux/time.h>
+
+/**
+ * struct kstat - stat buffer for VFS
+ *
+ * Extended stat buffer used internally by the VFS. Contains all information
+ * returned by statx() system call.
+ */
+struct kstat {
+	u64 ino;
+	dev_t dev;
+	umode_t mode;
+	unsigned int nlink;
+	uid_t uid;
+	gid_t gid;
+	dev_t rdev;
+	loff_t size;
+	struct timespec64 atime;
+	struct timespec64 mtime;
+	struct timespec64 ctime;
+	struct timespec64 btime;		/* Birth/creation time */
+	u64 blocks;
+	u32 blksize;
+	u64 attributes;
+	u64 attributes_mask;
+	u32 result_mask;
+	u32 dio_mem_align;
+	u32 dio_offset_align;
+	u32 atomic_write_unit_min;
+	u32 atomic_write_unit_max;
+	u32 atomic_write_segments_max;
+};
+
 #endif