From: Simon Glass <simon.glass@canonical.com>
Update fsmap.c to use ext4_uboot.h and add the required stubs:
- struct fsmap and related FMR_* macros
- trace_ext4_fsmap_* stub macros
- list_sort and sort stub macros
Co-developed-by: Claude Opus 4.5 <noreply@anthropic.com>
Signed-off-by: Simon Glass <simon.glass@canonical.com>
---
fs/ext4l/Makefile | 2 +-
fs/ext4l/ext4_uboot.h | 32 ++++++++++++++++++++++++++++++++
fs/ext4l/fsmap.c | 5 +----
3 files changed, 34 insertions(+), 5 deletions(-)
@@ -6,7 +6,7 @@
obj-y := interface.o stub.o
obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \
- extents_status.o file.o fsync.o hash.o ialloc.o \
+ extents_status.o file.o fsmap.o fsync.o hash.o ialloc.o \
indirect.o inline.o inode.o mballoc.o migrate.o \
mmp.o move_extent.o namei.o page-io.o readpage.o resize.o \
super.o symlink.o xattr.o \
@@ -2988,4 +2988,36 @@ static inline u64 div64_u64(u64 dividend, u64 divisor)
/* ext4_update_overhead - declaration for stub.c */
int ext4_update_overhead(struct super_block *sb, bool force);
+/*
+ * Stubs for fsmap.c
+ */
+
+/* fsmap.c stubs - struct fsmap from linux/fsmap.h */
+struct fsmap {
+ __u32 fmr_device; /* device id */
+ __u32 fmr_flags; /* mapping flags */
+ __u64 fmr_physical; /* device offset of segment */
+ __u64 fmr_owner; /* owner id */
+ __u64 fmr_offset; /* file offset of segment */
+ __u64 fmr_length; /* length of segment */
+ __u64 fmr_reserved[3]; /* must be zero */
+};
+
+#define FMR_OWN_FREE (-1ULL)
+#define FMR_OWN_UNKNOWN (-2ULL)
+#define FMR_OWNER(type, code) (((__u64)(type) << 32) | (__u64)(code))
+#define FMR_OF_SPECIAL_OWNER (1 << 0)
+#define FMH_IF_VALID 0
+#define FMH_OF_DEV_T (1 << 0)
+
+#define trace_ext4_fsmap_mapping(sb, d, a, p, l, o) do { } while (0)
+#define trace_ext4_fsmap_low_key(sb, d, a, p, l, o) do { } while (0)
+#define trace_ext4_fsmap_high_key(sb, d, a, p, l, o) do { } while (0)
+
+/* list_sort and sort stubs for fsmap.c */
+#define list_sort(priv, head, cmp) \
+ do { (void)(priv); (void)(head); (void)(cmp); } while (0)
+#define sort(base, num, size, cmp, swap) \
+ do { (void)(base); (void)(num); (void)(size); (void)(cmp); (void)(swap); } while (0)
+
#endif /* __EXT4_UBOOT_H__ */
@@ -4,13 +4,10 @@
*
* Author: Darrick J. Wong <darrick.wong@oracle.com>
*/
+#include "ext4_uboot.h"
#include "ext4.h"
-#include <linux/fsmap.h>
#include "fsmap.h"
#include "mballoc.h"
-#include <linux/sort.h>
-#include <linux/list_sort.h>
-#include <trace/events/ext4.h>
/* Convert an ext4_fsmap to an fsmap. */
void ext4_fsmap_from_internal(struct super_block *sb, struct fsmap *dest,