[Concept,11/33] ext4l: Move file_ functions to linux/fs.h

Message ID 20260121220857.2137568-12-sjg@u-boot.org
State New
Headers
Series Reorganise ext4l compatibility stubs |

Commit Message

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

Move file-related operations from ext4_uboot.h to the standard linux/fs.h
header. This includes file_modified(), file_accessed(), file_update_time(),
file_write_and_wait_range(), file_check_and_advance_wb_err(), file_path(),
and file_bdev().

Also remove redundant forward declarations (file_kattr, dir_context,
readahead_control, fiemap_extent_info, folio) that are already in fs.h.

This reduces ext4_uboot.h from 568 to 553 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 | 15 ---------------
 include/linux/fs.h    | 11 +++++++++++
 2 files changed, 11 insertions(+), 15 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index f12dbe2b76d..746d4e9a748 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -166,11 +166,6 @@  BUFFER_FNS(Cached, cached)
 struct pipe_inode_info;
 struct kstat;
 struct path;
-struct file_kattr;
-struct dir_context;
-struct readahead_control;
-struct fiemap_extent_info;
-struct folio;
 
 #define WHITEOUT_DEV	0
 #define WHITEOUT_MODE	0
@@ -213,9 +208,6 @@  struct dx_hash_info {
 	do { } while (0)
 #endif
 
-#define file_modified(file)		({ (void)(file); 0; })
-#define file_accessed(file)		do { (void)(file); } while (0)
-
 #define vfs_setpos(file, offset, maxsize)	({ (void)(file); (void)(maxsize); (offset); })
 
 #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; })
@@ -265,8 +257,6 @@  struct dx_hash_info {
 /* Sync operations - stubs */
 #define sync_mapping_buffers(m)			({ (void)(m); 0; })
 #define sync_inode_metadata(i, w)		({ (void)(i); (void)(w); 0; })
-#define file_write_and_wait_range(f, s, e)	({ (void)(f); (void)(s); (void)(e); 0; })
-#define file_check_and_advance_wb_err(f)	({ (void)(f); 0; })
 
 /* DAX stubs - DAX not supported in U-Boot */
 #define IS_DAX(inode)				(0)
@@ -293,7 +283,6 @@  extern struct inode *iget_locked(struct super_block *sb, unsigned long ino);
 #define posix_acl_chmod(m, i, mo)	({ (void)(m); (void)(i); (void)(mo); 0; })
 
 /* File operations */
-#define file_update_time(f)		do { } while (0)
 #define vmf_fs_error(e)			((vm_fault_t)VM_FAULT_SIGBUS)
 
 /* iomap stubs */
@@ -408,10 +397,6 @@  void trace_ext4_error(struct super_block *sb, const char *func, unsigned int lin
 /* Filesystem notification - declaration for stub.c */
 void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error);
 
-/* File path operations - declaration for stub.c */
-char *file_path(struct file *file, char *buf, int buflen);
-struct block_device *file_bdev(struct file *file);
-
 /* kobject_put is now in linux/kobject.h */
 /* wait_for_completion is now a macro in linux/completion.h */
 
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 3fa54146f44..ea4d1fdf97e 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -321,6 +321,17 @@  static inline struct inode *file_inode(struct file *f)
 	return f->f_inode;
 }
 
+/* File modification tracking - stubs for U-Boot */
+#define file_modified(file)		({ (void)(file); 0; })
+#define file_accessed(file)		do { (void)(file); } while (0)
+#define file_update_time(f)		do { } while (0)
+#define file_write_and_wait_range(f, s, e)	({ (void)(f); (void)(s); (void)(e); 0; })
+#define file_check_and_advance_wb_err(f)	({ (void)(f); 0; })
+
+/* File path operations - implemented in ext4l/stub.c */
+char *file_path(struct file *file, char *buf, int buflen);
+struct block_device *file_bdev(struct file *file);
+
 /* iattr - inode attributes for setattr */
 struct iattr {
 	unsigned int ia_valid;