[Concept,15/34] ext4l: Move address_space_operations to linux/fs.h

Message ID 20260114225635.3407989-16-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 address_space_operations from ext4_uboot.h to linux/fs.h
where it belongs alongside struct address_space. This matches the Linux
kernel structure where both are defined in include/linux/fs.h.

Add necessary forward declarations for types used in the function
pointers (struct file, struct folio, struct readahead_control, etc.).

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

 fs/ext4l/ext4_uboot.h | 21 +--------------------
 include/linux/fs.h    | 31 ++++++++++++++++++++++++++++++-
 2 files changed, 31 insertions(+), 21 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index 9329d854bd3..715407b83d8 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -1224,26 +1224,7 @@  struct readahead_control {
 #define readahead_pos(rac)		({ (void)(rac); 0LL; })
 #define readahead_length(rac)		({ (void)(rac); 0UL; })
 
-/* Forward declarations for address_space_operations */
-struct writeback_control;
-struct swap_info_struct;
-
-/* address_space_operations stub */
-struct address_space_operations {
-	int (*read_folio)(struct file *, struct folio *);
-	void (*readahead)(struct readahead_control *);
-	sector_t (*bmap)(struct address_space *, sector_t);
-	void (*invalidate_folio)(struct folio *, size_t, size_t);
-	bool (*release_folio)(struct folio *, gfp_t);
-	int (*write_begin)(const struct kiocb *, struct address_space *, loff_t, unsigned, struct folio **, void **);
-	int (*write_end)(const struct kiocb *, struct address_space *, loff_t, unsigned, unsigned, struct folio *, void *);
-	int (*writepages)(struct address_space *, struct writeback_control *);
-	bool (*dirty_folio)(struct address_space *, struct folio *);
-	bool (*is_partially_uptodate)(struct folio *, size_t, size_t);
-	int (*error_remove_folio)(struct address_space *, struct folio *);
-	int (*migrate_folio)(struct address_space *, struct folio *, struct folio *, int);
-	int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *);
-};
+/* address_space_operations is in linux/fs.h */
 
 /* Stub for buffer_migrate_folio */
 static inline int buffer_migrate_folio(struct address_space *mapping,
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 54c0148ee72..241711eded1 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -15,7 +15,12 @@ 
 struct inode;
 struct super_block;
 struct buffer_head;
-struct address_space_operations;
+struct file;
+struct folio;
+struct readahead_control;
+struct kiocb;
+struct writeback_control;
+struct swap_info_struct;
 
 /* errseq_t - error sequence type */
 typedef u32 errseq_t;
@@ -55,6 +60,9 @@  struct path {
 #define FOLIO_CACHE_MAX 64
 #endif
 
+/* address_space_operations - forward declare for address_space */
+struct address_space_operations;
+
 /* address_space - extended for inode.c */
 struct address_space {
 	struct inode *host;
@@ -70,6 +78,27 @@  struct address_space {
 #endif
 };
 
+/* address_space_operations - filesystem address space methods */
+struct address_space_operations {
+	int (*read_folio)(struct file *, struct folio *);
+	void (*readahead)(struct readahead_control *);
+	sector_t (*bmap)(struct address_space *, sector_t);
+	void (*invalidate_folio)(struct folio *, size_t, size_t);
+	bool (*release_folio)(struct folio *, gfp_t);
+	int (*write_begin)(const struct kiocb *, struct address_space *,
+			   loff_t, unsigned, struct folio **, void **);
+	int (*write_end)(const struct kiocb *, struct address_space *,
+			 loff_t, unsigned, unsigned, struct folio *, void *);
+	int (*writepages)(struct address_space *, struct writeback_control *);
+	bool (*dirty_folio)(struct address_space *, struct folio *);
+	bool (*is_partially_uptodate)(struct folio *, size_t, size_t);
+	int (*error_remove_folio)(struct address_space *, struct folio *);
+	int (*migrate_folio)(struct address_space *, struct folio *,
+			     struct folio *, int);
+	int (*swap_activate)(struct swap_info_struct *, struct file *,
+			     sector_t *);
+};
+
 /* block_device - minimal stub */
 struct block_device {
 	struct address_space *bd_mapping;