From patchwork Sun Dec 21 21:20:23 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1029 Return-Path: X-Original-To: u-boot-concept@u-boot.org Delivered-To: u-boot-concept@u-boot.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352078; bh=mM1CKO0vbK+okbpgYJxgDAd/XVfRUySiYsx5mI5RK78=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=KKD/dIkp9EgLMVaYy/wkyrJr58HMpPI0yglxY+BD2wQ60MOPs+W8jb2ylFwa+S7yI V/WFduen3+mQ4oUbsH6BIrUePM1Pf0vxcuZ4MIYmjAEu/UFoOXOEmPmHOA0w+OAI90 4vb388tS1o4gBqbyyQz1hBfZlal6QqYxbgQRXoD2uR1SKqlL1nNtU86zrH/zbeW4lI uJTWZP4LnmNAy/89xm2wUV1Jv5ycvshh2P5cEkljmGMjQ1vZMWm3TJOlLXBTI0Kg4h 2YhFMwb/dGv7fw0SNAntUgOD8u1TNmXup5uneSpeEDskuqGQnRMEHeY73V3+TGdknO f8l36AwDgourQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9814C64CF3 for ; Sun, 21 Dec 2025 14:21:18 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id ylXJNTBIN4_Z for ; Sun, 21 Dec 2025 14:21:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352077; bh=mM1CKO0vbK+okbpgYJxgDAd/XVfRUySiYsx5mI5RK78=; h=From:To:Date:In-Reply-To:References:CC:Subject:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=lYILzL7r20q4tty1Vx1FaIPK4uiCYQU8oT7fcY4o+NhSPpOsnYeaBuYh5mLvfkF6S ezqy7tXzh0wRn0g1tit5jZU4V6GtEd9l+EPuSJvoVDqAq4Cb4aFO9bdIgFM0a7i3xp epKaM8qVmQTFNsj3qiUnQl5hxqLQPb/T1YpZPl0oe2e9wxf0+I03XzHkIffpKTHQfv /OfKxrKR0UCGd/QI1YLW7ZIHzwABBXpqY1Ts7QxPkc2YbeNNCA1QZUukM8XIK8jE6w KYUkuizQbi8E+88k0O5JlaD6I4hE3y967a4PHphsEBDNL1GN3WYrhoFU+vBy0BYH9I Iq9J4EjlsNJ2g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 92F1564CDE for ; Sun, 21 Dec 2025 14:21:17 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352075; bh=EqqUtfTUIDud0W7VHP5LePJpH1tSJz19Q/qgOxJ1oss=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=oDyykO95IOdl0FgyToQOiDCn+C/UczpZJ+iCQjc6bzz0i1tV+l3WlzguFdgxHjCFK 4hEHyIrM9ayR5JCUx0vShZdVLUzU2iA78z6r6v/7uCOuMNqGARv20UrCRXANbvEDoG 3mlQBrNeVQAhJE5l889DHQV0XbZenP4KmjE5omGtT/4JlQFGmKsfSvm6miBtMPlzhM E+L2ewC46mretz9Tcir2e9/rA3rfwbeChv/aK1RfoQIe6rIwBYylfyr0qU94I5QrIA ZigPkGpgVz2CmS9SXzIPtI6saHgW4eakrze+AzvPmMx3fJ0YIIuL6ofLVSKxaqFx3U 4PTJG24QkmX6w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9C70864CDE; Sun, 21 Dec 2025 14:21:15 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id ms-T8GZyTezf; Sun, 21 Dec 2025 14:21:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352071; bh=Y8Hc0AvB0unq377c6y5O7O8C32WCpEEJDoeLeDzIZUg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HSFhH0XjaNPE5ty5ljQ20zE9WaIqsvDHb/XugbA2w9QXC1cqhyDRGejoXBdJ/Pq5v E8NU62zzObBT2B8ZPmf2EPhSmMyZb3SZ/3eby1KnoMRJ0DxHjQ4ULphSqQqF8qiGi/ 7b48fw/nx51hOUIe441XjS9bLbaagPse9KhQAp8cCbRuAFVEo76uB94fzeQGtBgPX7 95CmwOupEoRnV5iZX3/vjI8yViPgP5gG7+o1hF8JDDrBPwXsRasO/zN+6WdEFy02b7 wRpu2DigrJMOfkRAof7XD547WJf0lFcXgPkqT04fn0nBHxVe0Fp+T20kXnxUoNjTkw ZI089QJQC47HA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 464E464CBD; Sun, 21 Dec 2025 14:21:11 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 21 Dec 2025 14:20:23 -0700 Message-ID: <20251221212028.857348-16-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251221212028.857348-1-sjg@u-boot.org> References: <20251221212028.857348-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: ZNR4ZNUQEU3APPU6A2HBAWXYJVYTI43R X-Message-ID-Hash: ZNR4ZNUQEU3APPU6A2HBAWXYJVYTI43R X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 15/15] ext4l: Add fsmap.c to the build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass 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 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 32 ++++++++++++++++++++++++++++++++ fs/ext4l/fsmap.c | 5 +---- 3 files changed, 34 insertions(+), 5 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index ee929539eb8..e99b900ca6d 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -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 \ diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 8a3143a6d27..1ad9ad7f47a 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -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__ */ diff --git a/fs/ext4l/fsmap.c b/fs/ext4l/fsmap.c index 22fc333244e..da9ee2fac8e 100644 --- a/fs/ext4l/fsmap.c +++ b/fs/ext4l/fsmap.c @@ -4,13 +4,10 @@ * * Author: Darrick J. Wong */ +#include "ext4_uboot.h" #include "ext4.h" -#include #include "fsmap.h" #include "mballoc.h" -#include -#include -#include /* Convert an ext4_fsmap to an fsmap. */ void ext4_fsmap_from_internal(struct super_block *sb, struct fsmap *dest,