From: Simon Glass <simon.glass@canonical.com>
Move definitions to their appropriate standard headers:
- sync_mapping_buffers(), sync_inode_metadata() to linux/fs.h
- DAX stubs (IS_DAX, dax_break_layout_final, dax_writeback_mapping_range,
dax_zero_range, dax_break_layout_inode, daxdev_mapping_supported) to
linux/dax.h
- ktime_get_coarse_real_ts64() to linux/ktime.h
- Remove duplicate truncate_inode_pages_range (already in pagemap.h)
Also fix linux/dax.h to use mm_types.h for vm_fault_t and VM_FAULT_*
definitions, and update daxdev_mapping_supported to use the 3-arg
signature expected by ext4.
This reduces ext4_uboot.h from 545 to 528 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 | 19 +------------------
include/linux/dax.h | 23 +++++++++++++----------
include/linux/fs.h | 4 ++++
include/linux/ktime.h | 9 +++++++++
4 files changed, 27 insertions(+), 28 deletions(-)
@@ -210,8 +210,6 @@ struct dx_hash_info {
#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; })
-
#include <linux/minmax.h>
/* Memory retry wait */
@@ -254,18 +252,8 @@ struct dx_hash_info {
#define finish_open_simple(f, e) (e)
#define ihold(i) do { (void)(i); } while (0)
-/* Sync operations - stubs */
-#define sync_mapping_buffers(m) ({ (void)(m); 0; })
-#define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; })
-
-/* DAX stubs - DAX not supported in U-Boot */
-#define IS_DAX(inode) (0)
-#define dax_break_layout_final(inode) do { } while (0)
-#define dax_writeback_mapping_range(m, bd, wb) ({ (void)(m); (void)(bd); (void)(wb); 0; })
-#define dax_zero_range(i, p, l, d, op) ({ (void)(i); (void)(p); (void)(l); (void)(d); (void)(op); -EOPNOTSUPP; })
-#define dax_break_layout_inode(i, m) ({ (void)(i); (void)(m); 0; })
-
#include <linux/path.h>
+#include <linux/dax.h>
#include <linux/fsverity.h>
#include <linux/iversion.h>
@@ -466,7 +454,6 @@ int sync_filesystem(void *sb);
/* JBD2 checkpoint.c and commit.c stubs */
#include <asm-generic/bitops/lock.h>
/* smp_mb__after_atomic is now in linux/smp.h */
-#define ktime_get_coarse_real_ts64(ts) do { (ts)->tv_sec = 0; (ts)->tv_nsec = 0; } while (0)
#define crc32_be(crc, p, len) crc32(crc, p, len)
/* ext4l support functions (support.c) */
@@ -490,10 +477,6 @@ int bmap(struct inode *inode, sector_t *block);
#include <linux/proc_fs.h>
-/* Block device operations for journal.c */
-#define truncate_inode_pages_range(m, s, e) \
- do { (void)(m); (void)(s); (void)(e); } while (0)
-
/* Memory allocation for journal.c */
#define __get_free_pages(gfp, order) ((unsigned long)memalign(PAGE_SIZE, PAGE_SIZE << (order)))
#define free_pages(addr, order) free((void *)(addr))
@@ -4,6 +4,7 @@
#include <linux/types.h>
#include <linux/pfn_t.h>
+#include <linux/mm_types.h>
struct address_space;
struct dax_device;
@@ -12,11 +13,8 @@ struct iomap_ops;
struct kiocb;
struct iov_iter;
struct vm_fault;
-
-typedef unsigned int vm_fault_t;
-
-#define VM_FAULT_SIGBUS 0x0002
-#define VM_FAULT_NOPAGE 0x0100
+struct file;
+struct inode;
/* DAX is not supported in U-Boot - provide stubs */
static inline ssize_t
@@ -44,10 +42,15 @@ static inline bool dax_mapping(struct address_space *mapping)
return false;
}
-static inline bool daxdev_mapping_supported(struct vm_area_struct *vma,
- struct dax_device *dax_dev)
-{
- return false;
-}
+/* 3-arg version used by ext4 */
+#define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; })
+
+/* DAX stubs */
+#define IS_DAX(inode) (0)
+#define dax_break_layout_final(inode) do { } while (0)
+#define dax_writeback_mapping_range(m, bd, wb) ({ (void)(m); (void)(bd); (void)(wb); 0; })
+#define dax_zero_range(i, p, l, d, op) \
+ ({ (void)(i); (void)(p); (void)(l); (void)(d); (void)(op); -EOPNOTSUPP; })
+#define dax_break_layout_inode(i, m) ({ (void)(i); (void)(m); 0; })
#endif /* _LINUX_DAX_H */
@@ -667,6 +667,10 @@ struct inode_operations {
#define generic_buffers_fsync_noflush(f, s, e, d) \
({ (void)(f); (void)(s); (void)(e); (void)(d); 0; })
+/* Sync operations - stubs */
+#define sync_mapping_buffers(m) ({ (void)(m); 0; })
+#define sync_inode_metadata(i, w) ({ (void)(i); (void)(w); 0; })
+
/* Generic attribute operations */
#define generic_fillattr(m, req, i, s) do { } while (0)
#define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0)
@@ -67,4 +67,13 @@ static inline ktime_t ktime_add_ns(ktime_t kt, s64 ns)
*/
#define ktime_get_ns() (0ULL)
+/**
+ * ktime_get_coarse_real_ts64() - get coarse real time
+ * @ts: timespec64 to fill
+ *
+ * U-Boot stub - sets time to 0.
+ */
+#define ktime_get_coarse_real_ts64(ts) \
+ do { (ts)->tv_sec = 0; (ts)->tv_nsec = 0; } while (0)
+
#endif /* _LINUX_KTIME_H */