[Concept,17/34] ext4l: Move seq_file definitions to linux/seq_file.h

Message ID 20260114225635.3407989-18-sjg@u-boot.org
State New
Headers
Series ext4l: Clean up ext4_uboot.h by moving definitions to standard headers |

Commit Message

Simon Glass Jan. 14, 2026, 10:56 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move struct seq_operations and SEQ_START_TOKEN to linux/seq_file.h
where they belong, following standard Linux header organisation.

Also move GFP_NOIO to linux/slab.h with the other GFP flags, and
remove the redundant bh_end_io_t typedef since it is already defined
in linux/buffer_head.h

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

 fs/ext4l/ext4_uboot.h    | 28 ++++++----------------------
 include/linux/seq_file.h | 13 +++++++++++++
 include/linux/slab.h     |  3 +++
 3 files changed, 22 insertions(+), 22 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index b13e653c883..3cc37f65dda 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -524,11 +524,7 @@  typedef long long qsize_t;
 /* blk_opf_t - block operation flags */
 typedef unsigned int blk_opf_t;
 
-/* Forward declare buffer_head for bh_end_io_t */
-struct buffer_head;
-
-/* bh_end_io_t - buffer head end io callback */
-typedef void bh_end_io_t(struct buffer_head *bh, int uptodate);
+/* bh_end_io_t and struct buffer_head are in linux/buffer_head.h */
 
 /* Directory entry types */
 #define DT_UNKNOWN	0
@@ -919,9 +915,7 @@  struct dx_hash_info {
 #define EXT4_HTREE_EOF_64BIT   ((1ULL << (64 - 1)) - 1)
 
 /* jbd2_buffer_trigger_type is defined in jbd2.h */
-
-/* seq_file - forward declaration */
-struct seq_file;
+/* struct seq_file is in linux/seq_file.h */
 
 /* fscrypt_has_encryption_key, fscrypt_fname_siphash are in ext4_fscrypt.h */
 
@@ -1151,8 +1145,7 @@  static inline ktime_t ktime_add_ns(ktime_t kt, s64 ns)
 	int name __attribute__((unused)) = 0
 #define __ratelimit(state)		({ (void)(state); 1; })
 
-/* seq_file tokens */
-#define SEQ_START_TOKEN			((void *)1)
+/* SEQ_START_TOKEN is in linux/seq_file.h */
 
 /* folio - memory page container stub */
 struct folio {
@@ -1874,8 +1867,7 @@  struct kstatfs {
 	long f_spare[4];
 };
 
-/* seq_file stubs */
-struct seq_file;
+/* struct seq_file is in linux/seq_file.h */
 
 /* Module stubs */
 struct module;
@@ -2339,13 +2331,7 @@  static inline unsigned long ext4_find_next_bit_le(const void *addr,
 /* pde_data - proc dir entry data (not supported in U-Boot) */
 #define pde_data(inode)			((void *)NULL)
 
-/* seq_operations for procfs iteration */
-struct seq_operations {
-	void *(*start)(struct seq_file *m, loff_t *pos);
-	void (*stop)(struct seq_file *m, void *v);
-	void *(*next)(struct seq_file *m, void *v, loff_t *pos);
-	int (*show)(struct seq_file *m, void *v);
-};
+/* struct seq_operations is in linux/seq_file.h */
 
 /* DEFINE_RAW_FLEX - define a flexible array struct on the stack (stubbed to NULL) */
 #define DEFINE_RAW_FLEX(type, name, member, count) \
@@ -2462,9 +2448,7 @@  struct folio_iter {
 #define blk_status_to_errno(status)	(-(status))
 
 /* atomic_inc is in asm-generic/atomic.h */
-
-/* GFP_NOIO - allocation without I/O */
-#define GFP_NOIO			0
+/* GFP_NOIO is in linux/slab.h */
 
 /* fscrypt page-io stubs are in ext4_fscrypt.h */
 
diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h
index e4139f48e16..c10da3e4f98 100644
--- a/include/linux/seq_file.h
+++ b/include/linux/seq_file.h
@@ -2,6 +2,8 @@ 
 #ifndef _LINUX_SEQ_FILE_H
 #define _LINUX_SEQ_FILE_H
 
+#include <linux/types.h>
+
 /*
  * Stub definitions for seq_file interface.
  * U-Boot doesn't use /proc filesystem.
@@ -12,6 +14,17 @@  struct seq_file {
 	struct file *file;
 };
 
+/* seq_operations for procfs iteration */
+struct seq_operations {
+	void *(*start)(struct seq_file *m, loff_t *pos);
+	void (*stop)(struct seq_file *m, void *v);
+	void *(*next)(struct seq_file *m, void *v, loff_t *pos);
+	int (*show)(struct seq_file *m, void *v);
+};
+
+/* SEQ_START_TOKEN for iteration start marker */
+#define SEQ_START_TOKEN			((void *)1)
+
 #define seq_printf(m, fmt, ...)		do { (void)(m); } while (0)
 #define seq_puts(m, s)			do { (void)(m); (void)(s); } while (0)
 #define seq_putc(m, c)			do { (void)(m); (void)(c); } while (0)
diff --git a/include/linux/slab.h b/include/linux/slab.h
index 2b374641534..f0c0add0cbd 100644
--- a/include/linux/slab.h
+++ b/include/linux/slab.h
@@ -42,6 +42,9 @@ 
 #ifndef __GFP_NOFAIL
 #define __GFP_NOFAIL	((gfp_t)0)
 #endif
+#ifndef GFP_NOIO
+#define GFP_NOIO	((gfp_t)0)
+#endif
 
 void *kmalloc(size_t size, gfp_t flags);