From patchwork Tue Jan 20 23:43:24 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1713 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=1768952678; bh=kqmoeXh2IPqno86Av0JZ4B9IHi6NBKFhrQiaJKdhgRY=; 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=byGb11MmkPlN6PW0wpvLVAtYe20pCEPf/o1oc79/rUvfWgqRzcZmgkrjqguwAxdgu D1GzsXMJh9zAV8zxJLMbjxboXGKvpMSq56U5pLvEh3MUISWFEg4E0Mr4Llx6OAMrDf DUCDtnzbTtd4okuGxtamKKvg1jPvU7A0maXYE4r98U8JMsYICDnPV4GK96RAwDLF01 0Wuirh++/AMX2Hn+6P3GatO066uuRhorotrZaaeI50ixokDG6vUnQQEINHmccBWyBO 8+Ln8xddItM+30ZmHhjAChWgeLZPLsH8upI2yV3SmeC2TwuEgsY5E8zErfIeKARaIC 2SV0KWVhrUdFA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7AC6D695AE for ; Tue, 20 Jan 2026 16:44:38 -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 WgAn_De4WTHF for ; Tue, 20 Jan 2026 16:44:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952678; bh=kqmoeXh2IPqno86Av0JZ4B9IHi6NBKFhrQiaJKdhgRY=; 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=byGb11MmkPlN6PW0wpvLVAtYe20pCEPf/o1oc79/rUvfWgqRzcZmgkrjqguwAxdgu D1GzsXMJh9zAV8zxJLMbjxboXGKvpMSq56U5pLvEh3MUISWFEg4E0Mr4Llx6OAMrDf DUCDtnzbTtd4okuGxtamKKvg1jPvU7A0maXYE4r98U8JMsYICDnPV4GK96RAwDLF01 0Wuirh++/AMX2Hn+6P3GatO066uuRhorotrZaaeI50ixokDG6vUnQQEINHmccBWyBO 8+Ln8xddItM+30ZmHhjAChWgeLZPLsH8upI2yV3SmeC2TwuEgsY5E8zErfIeKARaIC 2SV0KWVhrUdFA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 66F0B695A6 for ; Tue, 20 Jan 2026 16:44:38 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952676; bh=jZAbkjS/TYgoUmN6f2M1Ps8vQ5ZhdpkM31/FMwkSADI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=SVcDmZNXEuF+/rof/kwSVN1qTXf66+3s0UJdWDOUQltRbVaewiVT0vEz9gJfZtR5r PIUkexj9IbLsQ4VI9N+T8r2PBtot7m2+5DunF7vKpvdL8evu57q7UF9Kilvc9lv2zW 9sTK987xBANM88h+bx72OwiQgtlDuPOFNzVfGEZwJIntNbxAuDIwfBPloaR4DpKfkS cFK1ct+nC/v7qNpefWgP0qRfMYT1SVkYO9kH5tzQmTztGxkDtHKphh8ARvpZ2U5Tg0 vii1+m3DUDNnnGM6WIhdxQcKjnEdEqAZUxQC2DXykF49+UMY4giP5K6CNXh0r6J9xx NewNBUTWlheEg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3353F69597; Tue, 20 Jan 2026 16:44:36 -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 SYcKlHXjSQIP; Tue, 20 Jan 2026 16:44:36 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952672; bh=axp5XtUOmDAf0aiZ8wFPFGTPaSB2dexjrcVWXMFItes=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=G3Q+kPw/wS3+6yQwfTrVYWmnnp1P2ZsnGWw7YgDNRtfYipKmLSzRsuJ97+057G6iB 5iIMqGIf3DXg5XmdeWfqn9X42jzUNMLy/YH0/SLVrdr+g30p0MVSQv5ms3oTXIQWgU upF4U50YvaZP7KNl5Dn2du6RTl3vM2Ld9BV+wOBc0TtjSsk21fKHaLc8vvPVeFUEI+ G++0B+XREnOEQzBk0sWofy95yRwlSEYoUCxVKuMU88YZaPkOKHtWE2AQ7VcExo+nND wcQ+VETvKt9xTok/Dth8baOLnhUByHfdEry2BossyywgS4gYcOV+JcumkmPm+JuHG4 LYT/Wbqs2CSGA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id D0FE269555; Tue, 20 Jan 2026 16:44:31 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:24 -0700 Message-ID: <20260120234344.495605-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260120234344.495605-1-sjg@u-boot.org> References: <20260120234344.495605-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: XN773OB5XL4JZHOGID4AXQQFDGW62IYQ X-Message-ID-Hash: XN773OB5XL4JZHOGID4AXQQFDGW62IYQ 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 04/17] ext4l: Move memory and kunit stubs to standard headers 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 Move several compatibility stubs to their canonical Linux header locations: - Create linux/sched/mm.h with memalloc_nofs_save/restore stubs - Create kunit/static_stub.h with KUNIT_STATIC_STUB_REDIRECT stub - Add IS_CASEFOLDED to linux/fs.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 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 12 +++++------- include/kunit/static_stub.h | 12 ++++++++---- include/linux/fs.h | 3 ++- include/linux/sched/mm.h | 32 ++++++++++++++++++++++++++++++++ 4 files changed, 47 insertions(+), 12 deletions(-) create mode 100644 include/linux/sched/mm.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 2274f24f426..a493fb58ad7 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -163,12 +163,10 @@ /* percpu rw semaphore is in linux/percpu.h */ -/* Memory allocation context - stubs */ -static inline unsigned int memalloc_nofs_save(void) { return 0; } -static inline void memalloc_nofs_restore(unsigned int flags) { } +/* Memory allocation context - use linux/sched/mm.h */ +#include -/* Inode flags - stubs */ -#define IS_CASEFOLDED(inode) (0) +/* IS_CASEFOLDED is in linux/fs.h */ /* IS_ENCRYPTED and FSCRYPT_SET_CONTEXT_MAX_SIZE are in ext4_fscrypt.h */ #define S_NOQUOTA 0 @@ -216,8 +214,8 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); #define __test_and_set_bit_le(nr, addr) \ ({ int __old = test_bit(nr, addr); set_bit(nr, addr); __old; }) -/* KUNIT stub */ -#define KUNIT_STATIC_STUB_REDIRECT(...) do { } while (0) +/* KUNIT stub - use kunit/static_stub.h */ +#include /* percpu_counter operations are in linux/percpu_counter.h */ diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h index 995a919f641..265622c519b 100644 --- a/include/kunit/static_stub.h +++ b/include/kunit/static_stub.h @@ -1,13 +1,17 @@ /* SPDX-License-Identifier: GPL-2.0 */ +/* + * KUnit static stub support for U-Boot + * + * Based on Linux include/kunit/static_stub.h + */ #ifndef _KUNIT_STATIC_STUB_H #define _KUNIT_STATIC_STUB_H /* - * Stub header for U-Boot ext4l. + * KUNIT_STATIC_STUB_REDIRECT - call a replacement stub if one exists * - * KUnit static stubs are for kernel unit testing - not needed in U-Boot. + * U-Boot doesn't support KUnit, so this is a no-op. */ - -#define KUNIT_STATIC_STUB_REDIRECT(func, args...) do { } while (0) +#define KUNIT_STATIC_STUB_REDIRECT(...) do { } while (0) #endif /* _KUNIT_STATIC_STUB_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 475085e18ee..993985f88f3 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -300,10 +300,11 @@ enum { /* inode_newsize_ok - check if new size is valid (always ok in U-Boot) */ #define inode_newsize_ok(i, s) ({ (void)(i); (void)(s); 0; }) -/* IS_SYNC, IS_APPEND, IS_IMMUTABLE - inode flag checks */ +/* IS_SYNC, IS_APPEND, IS_IMMUTABLE, IS_CASEFOLDED - inode flag checks */ #define IS_SYNC(inode) (0) #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) +#define IS_CASEFOLDED(inode) (0) /* Case-folding not supported */ /* inode_needs_sync - check if inode needs synchronous writes (always false) */ #define inode_needs_sync(inode) (0) diff --git a/include/linux/sched/mm.h b/include/linux/sched/mm.h new file mode 100644 index 00000000000..7a105f768cb --- /dev/null +++ b/include/linux/sched/mm.h @@ -0,0 +1,32 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Memory allocation context helpers for U-Boot + * + * Based on Linux include/linux/sched/mm.h + */ +#ifndef _LINUX_SCHED_MM_H +#define _LINUX_SCHED_MM_H + +/** + * memalloc_nofs_save() - Mark implicit GFP_NOFS allocation scope + * + * U-Boot stub - no filesystem allocation context tracking needed. + * + * Return: 0 (no flags to restore) + */ +static inline unsigned int memalloc_nofs_save(void) +{ + return 0; +} + +/** + * memalloc_nofs_restore() - End implicit GFP_NOFS scope + * @flags: flags returned by memalloc_nofs_save() + * + * U-Boot stub - no filesystem allocation context tracking needed. + */ +static inline void memalloc_nofs_restore(unsigned int flags) +{ +} + +#endif /* _LINUX_SCHED_MM_H */