From patchwork Sun Dec 21 21:20:20 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1026 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=1766352071; bh=Rf1GrwSRvQW1GYoodsMgNSrxo9rvvD4MoVjz2Hm6KuM=; 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=QDIw4aET0wkx/k+bUadktZ1TM84vsJQM2dxS56V6YUnkdIRuNcbE3Bb6d7DBRWsep aotSUBhPU+RdWyVZ+/K0bvKfepwStxTWNchaTSuDtAMbNP+nJtQsaFfuXpFDbYw+8j 0iqzv4QpbJM93xZPOK9+lwJ9HPitwy3tEPRrMJtXQwSbhgz4cq2URdIpl6vk7M8IkA FuvLi5GWVk94hBMBkCG4VLzFxqbuEtDYd/YxwlSeV5GcpuCt8pjcZBJw2zB7QOesci wPvG73hEwCMVRKculuSRzEXOTLcsGVGYdSTBUNBD+aSVvxtzSD8fOeKd9AEertm0VS TfA7gd2j2t1Cg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 88B9B64D26 for ; Sun, 21 Dec 2025 14:21:11 -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 USbjhiBDM-SZ for ; Sun, 21 Dec 2025 14:21:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352069; bh=Rf1GrwSRvQW1GYoodsMgNSrxo9rvvD4MoVjz2Hm6KuM=; 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=PLLO3FohqUBzYHm2bOcNbZRUsNS5jzpsseY09z85imFzOFQltWZpAfm9Ofo5YC7p4 1z+vQJVBwKqZRBhDj0W910x0TKF84ENyUdXmndnvy534p/L+VGMKv0yZCg6Ngu4uYs FSrhc7wi6fzBXdMWZosjWeWZe8Bsb0y0Ojzc4eslhEbunkSMNKSvZOPCWHsnPbLTIK 41xZaFJqhkjlTXoAyuQShvMSFajOIJdbHWfVXQ8WSG+61yOn98J+MaYrpG1tV2pHC2 qB0wZ2IlBAgYTX0V5rt6PVsmk9tup9+EtkerHpBF+UvKkfRmHMJepkLsD8m0UMdTO6 G08cbzVsrf0OA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id ECE1C64CD8 for ; Sun, 21 Dec 2025 14:21:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352065; bh=jY7Q/AzZGzccLfIVKEBVyQWrc+jecNiw2b1wdR/vr9o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bD7d9LDWAMf3XfDD7cSoK4UfzXhs8mbHGiY+R8Rr9DbOzG032MlE7BH/zdC2LrCJT 2rhgb8y0Tl0DPPLem4s2CqZYy1J05Nti/Zi8KvF4LlrxLbMiDfWPeouNmFlJ1hFvhB 0jgfBMnYrEqlzT0/wQVZbYAJFSJpGFOf4hXgRRaYcaAEr/Uut2G1GGOdp5f1Fp7S17 q7FeHE77MJrLU6bCadwTe5Uh+85hgOvt7ddv98XkeA4ORxI/ybcv9QuVY6eJc6VPeF 1Q/w2ZATuXrIL4HFeldaegaVUD59+EwLk9FrGdma5u1SrWtadeD37yuL1FWXcwTA/h Aq8r8sedoRHjA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DEB3B64D14; Sun, 21 Dec 2025 14:21:05 -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 4wYdNP7yqY3J; Sun, 21 Dec 2025 14:21:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766352064; bh=pc9zAJafX7wb/CJsO527gDA4Of0APebGOcGsyW2+WDQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H3ZChlkyZWNnQua6cDHQz9IlvxefPS4I0AjcPRJc6sLnoOqf9B0oJe42DAkUh5TZv sgZzb3owKfI6BPEFVn4zJa+jynjK9PTxgmSTNvj3GR1QGTho1HA1vZfwLhe6498nH4 tj1BvM7ynbNSOITYnUlMUfG3uwyZTNxfAoAokw7hjCHTOrDYraXopd/ReqCmH6YTdA vcKL8aoJD7wx9UU6ZWOY+xnYwMmhXGW1XXQ+j64TBUMbioaB9laNF/coLuIs63mFku pmqgGZQZpej09SgNC7oDigV7xuQUVmvyKnPym7UGYunQxVSAodR95iH7TrOnepSHOD rnp4lRkdJD49A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A87BC64CDE; Sun, 21 Dec 2025 14:21:04 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sun, 21 Dec 2025 14:20:20 -0700 Message-ID: <20251221212028.857348-13-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: QKXGJ5VAMIBT4FYYNGG5ADVR5FN3SUNV X-Message-ID-Hash: QKXGJ5VAMIBT4FYYNGG5ADVR5FN3SUNV 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 12/15] ext4l: Add mmp.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 Add support for multi-mount protection. Use ext4_uboot.h compatibility layer and add stubs for: - init_utsname() - returns static node name "u-boot" - sb_start_write/sb_end_write - no-op stubs Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 17 ++++++++++++++++- fs/ext4l/mmp.c | 6 +----- fs/ext4l/stub.c | 11 ++--------- 4 files changed, 20 insertions(+), 16 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 784ba7203b1..df3c016e3c1 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -8,7 +8,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 \ indirect.o inline.o inode.o mballoc.o migrate.o \ - namei.o page-io.o readpage.o \ + mmp.o namei.o page-io.o readpage.o \ super.o symlink.o xattr.o \ xattr_hurd.o xattr_trusted.o \ xattr_user.o fast_commit.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index e57e479a462..409391dda20 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -2271,10 +2271,11 @@ int is_power_of_2(unsigned long n); /* Superblock write operations */ #define sb_start_write_trylock(sb) ({ (void)(sb); 1; }) +#define sb_start_write(sb) do { } while (0) #define sb_end_write(sb) do { } while (0) /* Scheduler stubs */ -#define schedule_timeout_interruptible(t) do { } while (0) +#define schedule_timeout_interruptible(t) ({ (void)(t); 0; }) /* Page allocation - declarations for stub.c */ unsigned long get_zeroed_page(gfp_t gfp); @@ -2928,4 +2929,18 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); /* Ratelimited printk for journal.c */ #define pr_notice_ratelimited(fmt, ...) pr_notice(fmt, ##__VA_ARGS__) +/* + * Stubs for mmp.c + */ + +/* init_utsname - returns pointer to system name structure */ +struct new_utsname { + char nodename[65]; +}; +static inline struct new_utsname *init_utsname(void) +{ + static struct new_utsname uts = { .nodename = "u-boot" }; + return &uts; +} + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/mmp.c b/fs/ext4l/mmp.c index ab1ff51302f..2da65c022f4 100644 --- a/fs/ext4l/mmp.c +++ b/fs/ext4l/mmp.c @@ -1,10 +1,6 @@ // SPDX-License-Identifier: GPL-2.0 -#include -#include -#include -#include -#include +#include "ext4_uboot.h" #include "ext4.h" /* Checksumming functions */ diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 5448040e14c..1bf1e958e48 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -461,10 +461,7 @@ int dquot_suspend(void *sb, int flags) return 0; } -/* MMP daemon */ -void ext4_stop_mmpd(void *sbi) -{ -} +/* MMP daemon - now in mmp.c */ /* Sysfs */ void ext4_unregister_sysfs(void *sb) @@ -552,11 +549,7 @@ u64 sb_bdev_nr_blocks(struct super_block *sb) /* bdev_can_atomic_write is now a macro in ext4_uboot.h */ /* bdev_atomic_write_unit_max_bytes is now a macro in ext4_uboot.h */ -/* Multi-mount protection */ -int ext4_multi_mount_protect(void *sb, unsigned long long mmp_block) -{ - return 0; -} +/* Multi-mount protection - now in mmp.c */ /* Generic dentry ops */ void generic_set_sb_d_ops(struct super_block *sb)