[Concept,04/12] linux: Add statfs.h header with kstatfs struct
Commit Message
From: Simon Glass <simon.glass@canonical.com>
Create linux/statfs.h with the kstatfs structure for filesystem
statistics reporting.
Update ext4_uboot.h to use the new header instead of duplicating
the structure definition.
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/ext4_uboot.h | 17 ++---------------
include/linux/statfs.h | 42 ++++++++++++++++++++++++++++++++++++++++++
2 files changed, 44 insertions(+), 15 deletions(-)
create mode 100644 include/linux/statfs.h
@@ -1300,21 +1300,8 @@ static inline __kernel_fsid_t uuid_to_fsid(const u8 *uuid)
return fsid;
}
-/* kstatfs for statfs */
-struct kstatfs {
- long f_type;
- long f_bsize;
- u64 f_blocks;
- u64 f_bfree;
- u64 f_bavail;
- u64 f_files;
- u64 f_ffree;
- __kernel_fsid_t f_fsid;
- long f_namelen;
- long f_frsize;
- long f_flags;
- long f_spare[4];
-};
+/* kstatfs - use linux/statfs.h */
+#include <linux/statfs.h>
/* struct seq_file is in linux/seq_file.h */
new file mode 100644
@@ -0,0 +1,42 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Filesystem statistics definitions for U-Boot
+ *
+ * Based on Linux statfs.h
+ */
+#ifndef _LINUX_STATFS_H
+#define _LINUX_STATFS_H
+
+#include <linux/types.h>
+
+/**
+ * struct kstatfs - kernel filesystem statistics
+ * @f_type: filesystem type
+ * @f_bsize: optimal transfer block size
+ * @f_blocks: total data blocks in filesystem
+ * @f_bfree: free blocks in filesystem
+ * @f_bavail: free blocks available to unprivileged user
+ * @f_files: total file nodes in filesystem
+ * @f_ffree: free file nodes in filesystem
+ * @f_fsid: filesystem ID
+ * @f_namelen: maximum length of filenames
+ * @f_frsize: fragment size
+ * @f_flags: mount flags
+ * @f_spare: spare for later
+ */
+struct kstatfs {
+ long f_type;
+ long f_bsize;
+ u64 f_blocks;
+ u64 f_bfree;
+ u64 f_bavail;
+ u64 f_files;
+ u64 f_ffree;
+ __kernel_fsid_t f_fsid;
+ long f_namelen;
+ long f_frsize;
+ long f_flags;
+ long f_spare[4];
+};
+
+#endif /* _LINUX_STATFS_H */