[Concept,08/17] ext4l: Move buffer and filesystem helpers to standard headers

Message ID 20260120234344.495605-9-sjg@u-boot.org
State New
Headers
Series ext4l: Move compatibility stubs to standard Linux headers |

Commit Message

Simon Glass Jan. 20, 2026, 11:43 p.m. UTC
  From: Simon Glass <simon.glass@canonical.com>

Move several definitions to their canonical Linux header locations:

- MAX_LFS_FILESIZE to linux/fs.h
- end_buffer_read_sync() to linux/buffer_head.h

This continues reducing ext4_uboot.h by placing these definitions in
their proper locations in the Linux header hierarchy.

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

 fs/ext4l/ext4_uboot.h       | 13 ++-----------
 include/linux/buffer_head.h | 14 ++++++++++++++
 include/linux/fs.h          |  3 +++
 3 files changed, 19 insertions(+), 11 deletions(-)
  

Patch

diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h
index d1ec4a84b97..b44939bfe5a 100644
--- a/fs/ext4l/ext4_uboot.h
+++ b/fs/ext4l/ext4_uboot.h
@@ -979,15 +979,7 @@  static inline const char *simple_get_link(struct dentry *dentry,
 
 /* QFMT_VFS_* quota format constants are in linux/quotaops.h */
 
-/* Buffer read sync */
-static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
-{
-	if (uptodate)
-		set_buffer_uptodate(bh);
-	else
-		clear_buffer_uptodate(bh);
-	unlock_buffer(bh);
-}
+/* end_buffer_read_sync is in linux/buffer_head.h */
 
 /* REQ_OP_READ is in linux/blk_types.h */
 /* SB_ACTIVE is in linux/fs.h */
@@ -1103,8 +1095,7 @@  void end_buffer_write_sync(struct buffer_head *bh, int uptodate);
 /* EXT4 magic number */
 #define EXT4_SUPER_MAGIC		0xEF53
 
-/* Max file size for large files */
-#define MAX_LFS_FILESIZE		((loff_t)LLONG_MAX)
+/* MAX_LFS_FILESIZE is in linux/fs.h */
 
 /* blockgroup_lock - use linux/blockgroup_lock.h */
 #include <linux/blockgroup_lock.h>
diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h
index a160b7d1a67..591f2ec1cbb 100644
--- a/include/linux/buffer_head.h
+++ b/include/linux/buffer_head.h
@@ -213,4 +213,18 @@  static inline bool noop_dirty_folio(struct address_space *mapping,
 	return false;
 }
 
+/*
+ * end_buffer_read_sync - completion handler for synchronous buffer reads
+ * @bh: buffer head that completed
+ * @uptodate: whether the read was successful
+ */
+static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate)
+{
+	if (uptodate)
+		set_buffer_uptodate(bh);
+	else
+		clear_buffer_uptodate(bh);
+	unlock_buffer(bh);
+}
+
 #endif /* _LINUX_BUFFER_HEAD_H */
diff --git a/include/linux/fs.h b/include/linux/fs.h
index 993985f88f3..5f1d702bab4 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -318,6 +318,9 @@  enum {
 #define I_DIRTY_DATASYNC	(1 << 2)
 #define I_DIRTY_TIME		(1 << 3)
 
+/* Maximum file size for large files */
+#define MAX_LFS_FILESIZE	((loff_t)LLONG_MAX)
+
 /**
  * struct fstrim_range - fstrim ioctl argument
  * @start: first byte to trim