From patchwork Tue Jan 20 23:43:21 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1710 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=1768952663; bh=0N73GxSB6ua3S69NdhOZwyJaHTZyZvQFLUTKuzA0iVU=; 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=JPS+UURm2Qqj1Z6D6rpRibRM4HZRFnIFwSTcGjRDBchAG93ZcXi/J4VZeapVcT/qm 8lYMnQP8FLpJ3kxGQRX2xPcXDpDjudrP/sNdQHuEZvtB0CHsD+nBYJpum2rYgKT/NJ XaeySa92TV6i0MZ8XQdqQKlXMroNOORwoAJv8CohyTi3ateAU6kCrQZGr5iLPDQY7u oN1v0tx6XaJPGtpcwtx85mb3Lt+yI3jdm8zyUS4rpO0SpvZubtE6w8NW0hE5pNwY75 nNaxhkQ0wdRrwNOjjao9bFmO5s/JldhXKf9nN1eDp5D5VQFq3dK8WH5xL2FXRDpJpo ehZPl44B/umEA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EA0AA695A6 for ; Tue, 20 Jan 2026 16:44:23 -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 UhQvCMbfeqjn for ; Tue, 20 Jan 2026 16:44:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952663; bh=0N73GxSB6ua3S69NdhOZwyJaHTZyZvQFLUTKuzA0iVU=; 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=JPS+UURm2Qqj1Z6D6rpRibRM4HZRFnIFwSTcGjRDBchAG93ZcXi/J4VZeapVcT/qm 8lYMnQP8FLpJ3kxGQRX2xPcXDpDjudrP/sNdQHuEZvtB0CHsD+nBYJpum2rYgKT/NJ XaeySa92TV6i0MZ8XQdqQKlXMroNOORwoAJv8CohyTi3ateAU6kCrQZGr5iLPDQY7u oN1v0tx6XaJPGtpcwtx85mb3Lt+yI3jdm8zyUS4rpO0SpvZubtE6w8NW0hE5pNwY75 nNaxhkQ0wdRrwNOjjao9bFmO5s/JldhXKf9nN1eDp5D5VQFq3dK8WH5xL2FXRDpJpo ehZPl44B/umEA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D8FCA69597 for ; Tue, 20 Jan 2026 16:44:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952662; bh=kq9o2HMBfMmSFpQEuRXDe3oEdVTaOMvTnnd4LQRjQsU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qsDleTX2abTkrUYYljvnn1RwtS2aXx8Ecg9IXIVZVSVLOwGiqVRrNAchta72+WPNe fM5eTetYSAVx+NZwqcwGuyvw9G2HuLYuqx+8Vm0uWlzsqvLILJoVfrCmdEV/WUV1yg W1efZT3efFQnktz30ouckxTBC+i8NaVzwLgpJiz6KNVuinJ5ozEdf2QK1a4pu6qipx +jORSqiW7dVb6kjZCTnlIop4y6lY0jZHrCwVTlbZCXARjXl5hpT6ufezqzhFBREG3i XLZ5OUbd/x7coz97uMhNZJ/Mq7HwkWtg5lG+2sHp2/QXf1rKpkUTsswrUz9IWGMq6j yUj8tr8CM20mw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5F2BD69590; Tue, 20 Jan 2026 16:44:22 -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 a6uX44edhXEK; Tue, 20 Jan 2026 16:44:22 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952658; bh=14cgxHswjIz4R/IHWOY/+niW/vWYS4QW/thq0MrK5Ns=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=RK8UYjRQM6UQWex+U5mzBasOE+1RJL8AJ7mFbxZmdU3wy3UIrO1v5eFzwJPePw/fp xYB+aZ39x/+RdMhu1CoXA4QeOF4EiHCNnAu7pX7v7n+5j8kqhOPK1plvH4sWcAitie 71BwGQSeSDFt8GpeE8XE3K0n1fz8QmqqU6T5n6mreYIcSD7gAjWx0CUTg+cRgCKfVn mbTD4sqIFyqos5hA97beOL9JqAwHyAKrhASw7imu99lp20RR6iTKdtOZxeVykEptY4 0MIfvWAEfgqDzwzrGfVVn8rdv1M0fcq1wA6nT1PZuq8jczcSKRL61IWWxVhmbSVjp6 y5+ylDIdEJW7g== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0EEED69555; Tue, 20 Jan 2026 16:44:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:21 -0700 Message-ID: <20260120234344.495605-2-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: IHSDG7QW5ATZKS4HT4JEHNH5M6Y4O4R5 X-Message-ID-Hash: IHSDG7QW5ATZKS4HT4JEHNH5M6Y4O4R5 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 01/17] ext4l: Move cache alignment and pointer macros to 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 macros to their proper Linux headers: - Create linux/cache.h with ____cacheline_aligned_in_smp stub - Move ZERO_OR_NULL_PTR to linux/slab.h - Add __counted_by stub to linux/compiler_attributes.h This reduces ext4_uboot.h by moving these definitions to their canonical locations in the Linux header hierarchy. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 10 ++++------ include/linux/cache.h | 22 ++++++++++++++++++++++ include/linux/compiler_attributes.h | 10 ++++++++++ include/linux/slab.h | 9 +++++++++ 4 files changed, 45 insertions(+), 6 deletions(-) create mode 100644 include/linux/cache.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index eadff92aecb..2255458a46d 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -118,11 +118,10 @@ /* completion - use Linux header */ #include -/* Cache alignment - stub */ -#define ____cacheline_aligned_in_smp +/* Cache alignment - use linux/cache.h */ +#include -/* Pointer check macros */ -#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= PAGE_SIZE) +/* ZERO_OR_NULL_PTR is in linux/slab.h */ /* data_race is in linux/compiler.h */ /* REQ_META, REQ_PRIO, REQ_RAHEAD are in linux/blk_types.h */ @@ -154,8 +153,7 @@ /* kiocb, iov_iter - use linux/uio.h */ #include -/* __counted_by attribute - not available in U-Boot */ -#define __counted_by(x) +/* __counted_by is in linux/compiler_attributes.h */ /* dir_context, filldir_t are in linux/fs.h */ diff --git a/include/linux/cache.h b/include/linux/cache.h new file mode 100644 index 00000000000..2fb4e00faa7 --- /dev/null +++ b/include/linux/cache.h @@ -0,0 +1,22 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Cache alignment definitions for U-Boot + * + * Based on Linux include/linux/cache.h + */ +#ifndef _LINUX_CACHE_H +#define _LINUX_CACHE_H + +/* + * U-Boot is single-threaded, so cache line alignment for SMP is not needed. + * These are provided for compatibility with Linux code. + */ +#ifndef ____cacheline_aligned_in_smp +#define ____cacheline_aligned_in_smp +#endif + +#ifndef __cacheline_aligned_in_smp +#define __cacheline_aligned_in_smp +#endif + +#endif /* _LINUX_CACHE_H */ diff --git a/include/linux/compiler_attributes.h b/include/linux/compiler_attributes.h index 44c9a08d734..097fce857c5 100644 --- a/include/linux/compiler_attributes.h +++ b/include/linux/compiler_attributes.h @@ -270,4 +270,14 @@ */ #define __weak __attribute__((__weak__)) +/* + * __counted_by(member) - flexible array bounds annotation + * + * Used to annotate flexible array members with the struct member that + * holds the count. Not available in all compilers, so stub it out. + */ +#ifndef __counted_by +#define __counted_by(member) +#endif + #endif /* __LINUX_COMPILER_ATTRIBUTES_H */ diff --git a/include/linux/slab.h b/include/linux/slab.h index 15d561f0527..628126e0a3b 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -56,6 +56,15 @@ #define SLAB_RECLAIM_ACCOUNT 0x00020000UL /* Track pages reclaimed */ #define SLAB_ACCOUNT 0x00000000UL /* Account to memcg (no-op) */ +/* + * Check if pointer is zero or in the zero page (used by SLUB allocator). + * PAGE_SIZE fallback for when this header is included standalone. + */ +#ifndef PAGE_SIZE +#define PAGE_SIZE 4096 +#endif +#define ZERO_OR_NULL_PTR(x) ((unsigned long)(x) <= PAGE_SIZE) + void *kmalloc(size_t size, gfp_t flags); static inline void *kzalloc(size_t size, gfp_t flags) From patchwork Tue Jan 20 23:43:22 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1711 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=1768952668; bh=Nptn9nbutQudFpuZtiMDFz6o/EOLdo4G8l6ZmIFPwio=; 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=AngXi7pQ7i12lFxxuVSsCNsPpbGDPsrrPEhKl+95KcBhlkegz/Iue9kHp+TiZ34HZ fU1vPvG1kmI9X1j5e5oJhw4h2Lh6/O9ehTytwlcSucZQvnmVb/9EXi5MRWyPgwzbHn IqQR69AGuFaDchPARUDb1g7WzWvi/v7hO9HJMykzZChSOmBlwWVtKey6BQPuD6NmCo 3ikG9Qc32GZkUAD0wAIPck20xduF2sIBeAkUhViLvMd7Ak/u+FXHhYTRNTVac248/B xCvzkOwfwGmLtAmsoOGoyj48PPil0t/XtZHxGLCfrxVE6Mt2MFgBwpi9aE8e7LB+Qr rO42oQvNq3F0Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8B3F4695AE for ; Tue, 20 Jan 2026 16:44:28 -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 AZyjsa2vU0W8 for ; Tue, 20 Jan 2026 16:44:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952668; bh=Nptn9nbutQudFpuZtiMDFz6o/EOLdo4G8l6ZmIFPwio=; 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=AngXi7pQ7i12lFxxuVSsCNsPpbGDPsrrPEhKl+95KcBhlkegz/Iue9kHp+TiZ34HZ fU1vPvG1kmI9X1j5e5oJhw4h2Lh6/O9ehTytwlcSucZQvnmVb/9EXi5MRWyPgwzbHn IqQR69AGuFaDchPARUDb1g7WzWvi/v7hO9HJMykzZChSOmBlwWVtKey6BQPuD6NmCo 3ikG9Qc32GZkUAD0wAIPck20xduF2sIBeAkUhViLvMd7Ak/u+FXHhYTRNTVac248/B xCvzkOwfwGmLtAmsoOGoyj48PPil0t/XtZHxGLCfrxVE6Mt2MFgBwpi9aE8e7LB+Qr rO42oQvNq3F0Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7B01169597 for ; Tue, 20 Jan 2026 16:44:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952667; bh=syqP0LKNIrEq2XXUJn7d4SOxFff/c8IZwJu8ewwljYU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=HJ6utOCeBQwHJqdodQiWaJjnlexBd+G7qpApERJ3uzx/xt2/1mwEX2LMl2DcPMozs hKJfJQd1HIMJfrqBHb1KyX6QRvOXwu/3d9fIZJUga6jGfeCggOtlATXiwSrstV7SEO m3RtNB4UXQoHpoYKL9dQBx4kWdWXKB5S4Zp1CWU10QviRZLV4sGF18DqxmUMShGSw3 2eP8mUxSzIobKOcsvg42bE43moW/67m09lvLFmXPsYGwQfuaV4YW1Hia5CvvRGLho4 qcFjBQy+fxD4mthZJhqi7e+I/KibwaJAUNXXH3CqlkWeW/8KsTk+8UQQz38pMasf5a 52EtMJNAkMcwg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0015969590; Tue, 20 Jan 2026 16:44:27 -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 ShL61T8R8_5W; Tue, 20 Jan 2026 16:44:26 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952662; bh=l6rgvFLEFtHFN1WLqih3zzg9egWrDtT4KvrSrS042hw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ROtrOEucNjpy745COzmp04yyyi9OmifDhnlOczMaJ5Dm6SxQ6WAah/15YGK9+eOU6 J8cTROToGjlaM8AWWMpmW2S/aWK7xfEZZozkBS4gzavE8cOWm7Ub5WRRycBOtRQFiB cfnJ5lfh7CY1ALIe+JWJh7Yv5nrDNwqmPsxvQubFtuPk7B6/VQFpUk11BZ5xyOHzMQ nBLMWQLy1wUXCoKjNHe2zRQIS6TdTYmQQLDWmh2n+VV6AktvdTML4Xa8wOhYn029tz KFA44WpMVUAJMunVQ7hXo6s2V89i6RkvcXsZsysDsdFckgvitSleUupHfa55kxSlg0 TvnCzLJoC43Ow== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id A644F69555; Tue, 20 Jan 2026 16:44:22 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:22 -0700 Message-ID: <20260120234344.495605-3-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: KTVYB3NKJP5K3QGHXGGL3LWICIEAYZJL X-Message-ID-Hash: KTVYB3NKJP5K3QGHXGGL3LWICIEAYZJL 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 02/17] ext4l: Move inode helpers to standard linux 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 inode-related stubs to their canonical Linux header locations: - inode_needs_sync and is_bad_inode to linux/fs.h - in_group_p to linux/cred.h These are standard Linux kernel interfaces that belong in their respective headers rather than in the ext4l compatibility layer. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 9 +++------ include/linux/cred.h | 3 +++ include/linux/fs.h | 6 ++++++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 2255458a46d..d21462407a8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -197,8 +197,7 @@ static inline void memalloc_nofs_restore(unsigned int flags) { } struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); /* wait_on_bit_io is now in linux/wait_bit.h */ -/* inode_needs_sync - stub */ -#define inode_needs_sync(inode) (0) +/* inode_needs_sync is in linux/fs.h */ /* Memory barriers are now in linux/smp.h */ @@ -222,8 +221,7 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); /* percpu_counter operations are in linux/percpu_counter.h */ -/* Group permission - stub */ -#define in_group_p(gid) (0) +/* in_group_p is in linux/cred.h */ /* Quota operations - use linux/quotaops.h */ #include @@ -270,8 +268,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, #endif /* ext4_init_security is provided by xattr.h */ -/* inode state stubs */ -#define is_bad_inode(inode) (0) +/* is_bad_inode is in linux/fs.h */ /* Block device operations - stubs */ #define sb_issue_zeroout(sb, blk, num, gfp) ({ (void)(sb); (void)(blk); (void)(num); (void)(gfp); 0; }) diff --git a/include/linux/cred.h b/include/linux/cred.h index a3a972a5a73..32b15dfc72e 100644 --- a/include/linux/cred.h +++ b/include/linux/cred.h @@ -59,4 +59,7 @@ struct user_namespace { extern struct user_namespace init_user_ns; +/* in_group_p - check if current process is in group (always false in U-Boot) */ +#define in_group_p(gid) (0) + #endif /* _LINUX_CRED_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 1b0059ca1a7..b6a0596a9de 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -305,6 +305,12 @@ enum { #define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) #define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) +/* inode_needs_sync - check if inode needs synchronous writes (always false) */ +#define inode_needs_sync(inode) (0) + +/* is_bad_inode - check if inode is marked bad (always false in U-Boot) */ +#define is_bad_inode(inode) (0) + /** * struct fstrim_range - fstrim ioctl argument * @start: first byte to trim From patchwork Tue Jan 20 23:43:23 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1712 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=1768952673; bh=gT/wCfI1U7tL+Jq2UAA72aInlKl69S6dCILg0/LH/b0=; 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=fMnJ4RH7W1bFZJkSg+VkrtQMUCp32QMfAJLmWdpvdL3h620OzSftvcy3Uqmejvizh B5eY9065/fPpEFwDfVHPTAZcNVTGUaziXBfjHQXVs6JizcWyNcPBL+psVlbhJgQjh6 KnHuNHcj7Nf3m3zcCbYL+ufoB/70OPM6V0QrDr5AOSzm+UN0qv+BjC+VyB7Sy/cNcE VM4iiUFIFJesdWBBIqpL7lA2lRrDRgX8wgtpULaX/J/DgLGPbRD5nvyZXAYARLIMfr LBeSkg4MPQbp8aKGpAyfG17Zh1/Rn/LqwZKtkEI6abCE6JKJges/ZJF/cY9gum10mL IuxUOJ/OjU7fQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 08AB6695AE for ; Tue, 20 Jan 2026 16:44:33 -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 S0SS4d-kfchT for ; Tue, 20 Jan 2026 16:44:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952672; bh=gT/wCfI1U7tL+Jq2UAA72aInlKl69S6dCILg0/LH/b0=; 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=gsxQUzIhjmiUwK7QcCbTIDpZ6jofqQis2r5TCcplDvXfgpQULSuuAI7ewRCOWJdOs hiu9d0yID58mOp+qHG6OAR3AmFK3xy/fjpnsCjWvxY/CKO4Wk3canwBvmLbWzYXxE0 ++mBEsKwGppbKv9A5eOyrMDpw8+n8g9qo94rgf/bdZgSAodx7pEbBz34MpFgvY+sSN AvcI850N3+uQtq14G1xo0DeBS52Xp69sWIHk+AAwy+CumK5RGVYkNzqcErtQ9XM91X hRURbp/ceon/URG1fb6+q23CsmkmU1vIhkxTcVB0TrxkrLE0sPdwNBiGiDbq6aE8cd J7z7P8OI0ykEQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id EB468695A6 for ; Tue, 20 Jan 2026 16:44:32 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952671; bh=jRPx4cEDkmlAkQUUA5lxe7Al0IO4wI9ibTr6xX2Ctis=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=rD966C9lb7V78oATFXq6hgE1pT7RgmfJr/Ov07DFmPOBPldf46un5nSPL5nHbNYAE mMDqDIq1FwDp/n6q86zMwHbekczTIIz9sxfMIlszxH4aFji+RIwWbbGDVDRii+qsFP Y9jNFlMeJfQPlnUiYIrWNSzeIpRM1xzTJ8UhANk5hh0ohxJomRxlGTgO6beyVjjSsU hmCRUabBrdLnxgSiVAal+AXKIxRlHiYJ+y/ZffDqu+H57m+nZdGpYiDbiKtRVxg/GX 9sGlFRsEsAwiCr6FpYEr4B61d+4si0jAZK4UxdVVzdX2UduKUm7fnBwyQL+5gHprHW 4x/4Y4K9Qd/7w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8E58C69597; Tue, 20 Jan 2026 16:44:31 -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 6GKDr8y3fLSG; Tue, 20 Jan 2026 16:44:31 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952667; bh=s8e4kUNi1QFw/4/9gl4dXZDVrE1FtMTPnPsNvNWpVUw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=MXhseLxO9fXYsp4d6APMtWNYqvgxQqG2WNFDgQaSqHUR/wQUGyiF925l6X8fHl1Xg V5JjQTDU062jp34NFexlgRgM+qeP52SnUmJnIcg6RL+aOBHliKzbyzsPvY4RLh5gid Xl3TW1g9iZJOnwZh/i2d2/FXpQCsh+PgbNU9Uba4yaenD5Ezs0TrjwgV0R936HnKPv uJgQ9kT2xTc8FtG8O2mBo1G466NzdZITZc0XBPefTtW7R4dIQBxjhYl1e+C97BBxrI tkrBKx3dESaK4VghmcxiS86FxaWqSlPkBIScPhMqY2yioRb+bcJEw9g6M4iR1Ot0wM 0d2LmTOhuLzKg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4651669555; Tue, 20 Jan 2026 16:44:27 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:23 -0700 Message-ID: <20260120234344.495605-4-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: Q7FR5QVQGLXKSQ3LPSTPO2KOOBJOPNBD X-Message-ID-Hash: Q7FR5QVQGLXKSQ3LPSTPO2KOOBJOPNBD 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 03/17] ext4l: Move inode state bits to linux/fs.h 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 the inode state bit definitions (I_NEW, I_FREEING, I_DIRTY_DATASYNC, I_DIRTY_TIME) to linux/fs.h where they belong in the Linux kernel header hierarchy. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 10 ++-------- include/linux/fs.h | 6 ++++++ 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index d21462407a8..2274f24f426 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -410,11 +410,7 @@ static inline int bdev_read_only(struct block_device *bdev) /* kuid_t and kgid_t - from linux/cred.h */ #include -/* Inode state bits */ -#define I_NEW (1 << 0) -#define I_FREEING (1 << 1) -#define I_DIRTY_DATASYNC (1 << 2) - +/* Inode state bits (I_NEW, I_FREEING, etc.) are in linux/fs.h */ /* S_SYNC, S_NOATIME, etc. inode flags are in linux/fs.h */ /* S_IRWXUGO is in linux/fs.h */ @@ -423,9 +419,7 @@ static inline int bdev_read_only(struct block_device *bdev) #define WHITEOUT_MODE 0 /* RENAME_* flags are in linux/fs.h */ - -/* Inode dirty state flags */ -#define I_DIRTY_TIME (1 << 3) +/* I_DIRTY_TIME is in linux/fs.h */ /* SB_LAZYTIME is in linux/fs.h */ /* ATTR_* iattr valid flags are in linux/fs.h */ diff --git a/include/linux/fs.h b/include/linux/fs.h index b6a0596a9de..475085e18ee 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -311,6 +311,12 @@ enum { /* is_bad_inode - check if inode is marked bad (always false in U-Boot) */ #define is_bad_inode(inode) (0) +/* Inode state bits for i_state field */ +#define I_NEW (1 << 0) +#define I_FREEING (1 << 1) +#define I_DIRTY_DATASYNC (1 << 2) +#define I_DIRTY_TIME (1 << 3) + /** * struct fstrim_range - fstrim ioctl argument * @start: first byte to trim 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 */ From patchwork Tue Jan 20 23:43:25 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1714 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=1768952681; bh=zLxp9ZLzqqLD39gIcF6LQ0VYCJF5zlXP5372OmNrPZc=; 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=ZzvchWXOl+JQVQmLTNV+s/DhqlpFOgGhZYmmsrwGYCgqsfjny1kJULs0jGdR9UIxm 8YO9044oSN87lLNiPwvlOrlo8qujAkR4IM17eUs+t/4oEBY+Znx1YvDC2wWAhHWfMT 7nbDvAk1OfMw4c+2I0kBKPlAUTBUWM/avVZKmO1yA4wfJW6Up6O6Cu3yzqNYKkqU1t rlU5FnVH3xX0vp05pLJndPoo0CUh/l17hUVRpL7KVxSB1yqYWSjFeaM5NMe1/kaPwo RaAGybqUzfIC+peF7Qds8NTJNexFLfOuFG6I+aQoLjn/MaDR6riHJT+wzOea9g3lWu Ju8+iayCCOPnA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id F39E8695AE for ; Tue, 20 Jan 2026 16:44:41 -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 cWdy4BvDCaj7 for ; Tue, 20 Jan 2026 16:44:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952681; bh=zLxp9ZLzqqLD39gIcF6LQ0VYCJF5zlXP5372OmNrPZc=; 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=ZzvchWXOl+JQVQmLTNV+s/DhqlpFOgGhZYmmsrwGYCgqsfjny1kJULs0jGdR9UIxm 8YO9044oSN87lLNiPwvlOrlo8qujAkR4IM17eUs+t/4oEBY+Znx1YvDC2wWAhHWfMT 7nbDvAk1OfMw4c+2I0kBKPlAUTBUWM/avVZKmO1yA4wfJW6Up6O6Cu3yzqNYKkqU1t rlU5FnVH3xX0vp05pLJndPoo0CUh/l17hUVRpL7KVxSB1yqYWSjFeaM5NMe1/kaPwo RaAGybqUzfIC+peF7Qds8NTJNexFLfOuFG6I+aQoLjn/MaDR6riHJT+wzOea9g3lWu Ju8+iayCCOPnA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DFB00695A6 for ; Tue, 20 Jan 2026 16:44:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952680; bh=SVnysCULzSHtk2+Ss+GOStDPo5SIA3NVvCJwSBpnnaI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OWOqeaVsW9pvEKNkCiiRrYMwp9xX1iqj2YpVUu63UuvhekeqOwAaj+Z5ISHpoFwkS 3++rmFokM4637A+GJ51WAR/e+B9GSpI7FBtcXayk4yn+XToHXeQqNOJKPAPz5U70+E /CGuXg1/kdXPcr5kmpF9thE48R60bfkR6Itf1ijsV7fQ9Zg4JufkS0aJS90jsZFORH B8EsKv/jk1gN6wcYLseHN3c+Jt+gOSh3e7kmw2zbG1/mnd5Ljqde4gcFy4K3FAMdUd 6DuPQ+fEMAJjTafpWZ2Oy+co3yTzbBDlW6kb+Ex1velDAyJezuakagnpi0qt4NYC6q EPlNuvtLjf33g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DE1BB69597; Tue, 20 Jan 2026 16:44:40 -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 PkBQyXD2o7Zl; Tue, 20 Jan 2026 16:44:40 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952676; bh=Q20/7xcl5vlJqEtwg6a/mulNeFhANtqlC8TykXUpUGY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=eQGAJZpXpnMy1jUs8F4n6GbpBUsD6K/WvGUV329+uy7+6zz4j6z/CMz2RFu2GnjzY Ysfy7byLX+w6+YLbKAN+QD7ivARIBk1JAy16sREAaAOORr1QuPSv6lm0+UMH9yLlPd 8JLlvJMtkyxi6lLUaFm5MC4w0tN8IXRWJUo/o8GT0GzMmc7IF79FGXtNhyyyHvVLOp ULig4yEtfwQ7UJsTYhpnG1aDltAbcBHQPc1Hmzs8PNba7zCbisx9tyrQCBWNuBZCwV HA3HSUU52n9KiMT7uLhwNcLaW1VTTxs190hauN9bfGJ7nC1U7Hvh6+zOV6+Y/S0Js7 djpuQXlOOEEOw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 759BC69555; Tue, 20 Jan 2026 16:44:36 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:25 -0700 Message-ID: <20260120234344.495605-6-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: URZ27TIWFFKJHMLCVD7UV5NVHUXSFI7D X-Message-ID-Hash: URZ27TIWFFKJHMLCVD7UV5NVHUXSFI7D 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 05/17] ext4l: Create asm-generic/bitops/le.h for little-endian bitops 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 little-endian bit operations to asm-generic/bitops/le.h: - find_next_zero_bit_le, find_next_bit_le - test_bit_le, __set_bit_le, __clear_bit_le - __test_and_set_bit_le, __test_and_clear_bit_le This matches the Linux kernel header organisation and removes duplicate implementations from ext4_uboot.h. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 38 ++--------------- include/asm-generic/bitops/le.h | 76 +++++++++++++++++++++++++++++++++ 2 files changed, 79 insertions(+), 35 deletions(-) create mode 100644 include/asm-generic/bitops/le.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index a493fb58ad7..6f2ea69a888 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -204,15 +204,8 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); * We implement them in interface.c for sandbox. */ -/* Little-endian bit operations - use arch-provided find_next_zero_bit */ -#define find_next_zero_bit_le(addr, size, offset) \ - find_next_zero_bit((void *)addr, size, offset) -#define __set_bit_le(nr, addr) set_bit(nr, addr) -#define test_bit_le(nr, addr) test_bit(nr, addr) -#define __test_and_clear_bit_le(nr, addr) \ - ({ int __old = test_bit(nr, addr); clear_bit(nr, addr); __old; }) -#define __test_and_set_bit_le(nr, addr) \ - ({ int __old = test_bit(nr, addr); set_bit(nr, addr); __old; }) +/* Little-endian bit operations - use asm-generic/bitops/le.h */ +#include /* KUNIT stub - use kunit/static_stub.h */ #include @@ -1280,32 +1273,7 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* XArray is now in linux/xarray.h */ /* Per-CPU stubs are in linux/percpu.h */ -/* Bit operations for little-endian bitmaps */ -#define __clear_bit_le(bit, addr) clear_bit_le(bit, addr) - -static inline void clear_bit_le(int nr, void *addr) -{ - unsigned char *p = (unsigned char *)addr + (nr >> 3); - - *p &= ~(1 << (nr & 7)); -} - -#define find_next_bit_le(addr, size, offset) \ - ext4_find_next_bit_le(addr, size, offset) - -static inline unsigned long ext4_find_next_bit_le(const void *addr, - unsigned long size, - unsigned long offset) -{ - const unsigned char *p = addr; - unsigned long bit; - - for (bit = offset; bit < size; bit++) { - if (p[bit >> 3] & (1 << (bit & 7))) - return bit; - } - return size; -} +/* Little-endian bit operations are in asm-generic/bitops/le.h */ /* atomic64 operations are now in asm-generic/atomic.h */ diff --git a/include/asm-generic/bitops/le.h b/include/asm-generic/bitops/le.h new file mode 100644 index 00000000000..78c7207c691 --- /dev/null +++ b/include/asm-generic/bitops/le.h @@ -0,0 +1,76 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Little-endian bitops for U-Boot + * + * Based on Linux include/asm-generic/bitops/le.h + */ +#ifndef _ASM_GENERIC_BITOPS_LE_H +#define _ASM_GENERIC_BITOPS_LE_H + +#include + +/* + * Little-endian bit operations. + * These operate on byte boundaries regardless of CPU endianness. + */ + +#define find_next_zero_bit_le(addr, size, offset) \ + find_next_zero_bit((void *)(addr), (size), (offset)) + +#define find_next_bit_le(addr, size, offset) \ + ext4_find_next_bit_le((addr), (size), (offset)) + +static inline int test_bit_le(int nr, const void *addr) +{ + return test_bit(nr, addr); +} + +static inline void __set_bit_le(int nr, void *addr) +{ + set_bit(nr, addr); +} + +static inline void __clear_bit_le(int nr, void *addr) +{ + clear_bit(nr, addr); +} + +static inline int __test_and_set_bit_le(int nr, void *addr) +{ + int old = test_bit(nr, addr); + + set_bit(nr, addr); + return old; +} + +static inline int __test_and_clear_bit_le(int nr, void *addr) +{ + int old = test_bit(nr, addr); + + clear_bit(nr, addr); + return old; +} + +/* + * ext4_find_next_bit_le - find next set bit in little-endian bitmap + * @addr: bitmap address + * @size: bitmap size in bits + * @offset: starting bit position + * + * Return: bit position of next set bit, or @size if none found + */ +static inline unsigned long ext4_find_next_bit_le(const void *addr, + unsigned long size, + unsigned long offset) +{ + const unsigned char *p = addr; + unsigned long bit; + + for (bit = offset; bit < size; bit++) { + if (p[bit >> 3] & (1 << (bit & 7))) + return bit; + } + return size; +} + +#endif /* _ASM_GENERIC_BITOPS_LE_H */ From patchwork Tue Jan 20 23:43:26 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1715 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=1768952687; bh=Axss7PPHLQc2R8wPNlanOUAPP/8UrpFcP8aPofDuHOw=; 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=RtcY9HsOZ/eAoZOde4P3xgL0RPCJBenLWVlOsc3ihjPfpkyc18NBYVddQc3SnChIC ufyKpDhWMMHxuUwyRoL1fi8XLv9Xrpp9AOihek+hBOIvBddChBBBPv73KILn32Uzgn MnVwP7sACjfNTdRQB9bZChf7CmuS6EpTHc1hsntgsAaK2nlBedIBaljigI/dy4V0gt spxElP8CdG/zuQsc9JQUqTGrrDQQhlOnhhe23azwgl1tjh4PaR2XCFDudllQTTtEu1 PSfmv8VupRwSrCvMCLtFfLsrTzE06Y72KrfaVeiKx5qOOw3FSjym9qfk5uSBpWejOM Fd4WJhuBxG6Ug== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C5687695AE for ; Tue, 20 Jan 2026 16:44:47 -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 hlzf7n1AUDyz for ; Tue, 20 Jan 2026 16:44:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952687; bh=Axss7PPHLQc2R8wPNlanOUAPP/8UrpFcP8aPofDuHOw=; 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=RtcY9HsOZ/eAoZOde4P3xgL0RPCJBenLWVlOsc3ihjPfpkyc18NBYVddQc3SnChIC ufyKpDhWMMHxuUwyRoL1fi8XLv9Xrpp9AOihek+hBOIvBddChBBBPv73KILn32Uzgn MnVwP7sACjfNTdRQB9bZChf7CmuS6EpTHc1hsntgsAaK2nlBedIBaljigI/dy4V0gt spxElP8CdG/zuQsc9JQUqTGrrDQQhlOnhhe23azwgl1tjh4PaR2XCFDudllQTTtEu1 PSfmv8VupRwSrCvMCLtFfLsrTzE06Y72KrfaVeiKx5qOOw3FSjym9qfk5uSBpWejOM Fd4WJhuBxG6Ug== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B4469695A6 for ; Tue, 20 Jan 2026 16:44:47 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952685; bh=zx/TUUch3FwICodDBs4lD9q+O9lhQ/YHVLJ1b94T4Vo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ASOIgNNZnvNRQ2vuYBdksT9VVoeItbZZodQ69jX+VTxbICP+4ru4keGc2Hzg+AhSl fHKSEO1atmnBSJih5AoVAbHpzjnWOoEPqLpo6W1fJorj+d2Sj9CAD8ZQ00d8i4qWS5 r2GhL7cc7QveM+TyFBWYc5s1jZ1zfDaFtPinXqk+sphTAwh8YrYShUr5xtLlEJJr+D pgYlNCI8clIt02l1GMShrebICCvfnguikG8jFfBmfvw+S7iAy6a7utH82xkyljSzr0 Wee1Ic+eIsQqCGQlMhyPpZjgjdp8tqwskVd8odkCHxSu880z4EXZXh+tgfvwFjqPvl SM22ZRGGWWGpA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5C8DD69597; Tue, 20 Jan 2026 16:44:45 -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 IRGF4FEOIi_Q; Tue, 20 Jan 2026 16:44:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952681; bh=xofiKXHk+36VVe2YzAX0CNp86PbQ9T7WURoNfK63QEY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=htzZNp7Gtlnob2WHeLkuorq1EU/O7Ex7whzAzOHYDuw2TFI19gC3ITuKv5uMV/vuC xGbRCaW0/VXFXNn8Hb0Xc+klQcaA1XEwWT7CgrnNbQeP8WOgcyjBx5jqhAZZ1Wszg8 5Iqx5cBEP4/TBQyAZ0exNcGiBn+gfeyRiJ30Xa/aJSXGCvGdKIglhjU1foGi6gLSkO PIZc1EYIAcmvvS9MFldUS947tx2YmZcrr2vQ3CM+lK5seTyjS5W6r3dqdbfbOo3K9n HdMYC72RmoPsUefJRS2WA4V+RXWLjXV6cVoslux60+RT7NLRRVDKpmWp+8Pm8brkbQ vWk6/TJsTTxdQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0FD6469555; Tue, 20 Jan 2026 16:44:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:26 -0700 Message-ID: <20260120234344.495605-7-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: HYRKXR6JARL3Z7SEHI7CQT4DK5XCYAHP X-Message-ID-Hash: HYRKXR6JARL3Z7SEHI7CQT4DK5XCYAHP 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 06/17] ext4l: Move uuid_to_fsid to linux/statfs.h and use hexdump.h 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 uuid_to_fsid() to linux/statfs.h where it belongs in the Linux kernel header hierarchy. Also use hexdump.h for DUMP_PREFIX_* types, with a stub for print_hex_dump since the Linux kernel has a different function signature than U-Boot. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 21 ++++++++------------- include/linux/statfs.h | 19 +++++++++++++++++++ 2 files changed, 27 insertions(+), 13 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6f2ea69a888..09e58989888 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1003,8 +1003,13 @@ static u64 __attribute__((unused)) __ext4_sectors[2]; /* system_state, SYSTEM_HALT, etc. are in linux/kernel.h */ -/* Hex dump */ -#define DUMP_PREFIX_ADDRESS 0 +/* + * Hex dump - DUMP_PREFIX_* types are in hexdump.h. + * However, the Linux kernel print_hex_dump has a different signature + * (includes log level) than U-Boot's, so we stub it out here. + */ +#include +#undef print_hex_dump #define print_hex_dump(l, p, pt, rg, gc, b, len, a) do { } while (0) /* SLAB_RECLAIM_ACCOUNT, SLAB_ACCOUNT are in linux/slab.h */ @@ -1037,17 +1042,7 @@ struct super_operations { /* export_operations and fid - use linux/exportfs.h */ #include -/* uuid_to_fsid - convert UUID to fsid */ -static inline __kernel_fsid_t uuid_to_fsid(const u8 *uuid) -{ - __kernel_fsid_t fsid; - - fsid.val[0] = (uuid[0] << 24) | (uuid[1] << 16) | - (uuid[2] << 8) | uuid[3]; - fsid.val[1] = (uuid[4] << 24) | (uuid[5] << 16) | - (uuid[6] << 8) | uuid[7]; - return fsid; -} +/* uuid_to_fsid is in linux/statfs.h */ /* kstatfs - use linux/statfs.h */ #include diff --git a/include/linux/statfs.h b/include/linux/statfs.h index bdc3f9b9e87..6ba93c5b292 100644 --- a/include/linux/statfs.h +++ b/include/linux/statfs.h @@ -39,4 +39,23 @@ struct kstatfs { long f_spare[4]; }; +/** + * uuid_to_fsid - convert UUID to filesystem ID + * @uuid: UUID to convert (at least 8 bytes) + * + * Converts the first 8 bytes of a UUID to a filesystem ID. + * + * Return: the filesystem ID + */ +static inline __kernel_fsid_t uuid_to_fsid(const u8 *uuid) +{ + __kernel_fsid_t fsid; + + fsid.val[0] = (uuid[0] << 24) | (uuid[1] << 16) | + (uuid[2] << 8) | uuid[3]; + fsid.val[1] = (uuid[4] << 24) | (uuid[5] << 16) | + (uuid[6] << 8) | uuid[7]; + return fsid; +} + #endif /* _LINUX_STATFS_H */ From patchwork Tue Jan 20 23:43:27 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1716 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=1768952692; bh=OsES4VwkHfAUgfdLfR4U/KjJb+V2WVcR+MnarQL9r8w=; 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=Yx9Gq+xTDWdcko1mUYIdrFWO0NI7TvCkAGBQs4GQycxA2uihfy0wAH/MNIuH272Gc WI8V84WeAEhaWbNIL3DJ9FD/nFrdpz+VUWUXpCUg6/Qe67fEvJN4uaXiBWc9lZwnU6 viXxxU3pUilzaNzLpTto8j+KXVCldOnNe8+MdbTbktUGkkFvFOA2zmJ0IM9J0UYszz xaynK6ti0UfnIwhnvENR9dHOKb1Myl8QuA9XEZ6ZCmX/LTaZoFNbhpbPrO1AKKespg moUAL2YWcfQqEA2sQetL4GZUqERmyj99Lg727PxsKKXpG70W8Yy5vnWI+aBuvK0cAs su1VjDvYzZdtw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3A089695AE for ; Tue, 20 Jan 2026 16:44:52 -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 eq1caRoagkHL for ; Tue, 20 Jan 2026 16:44:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952692; bh=OsES4VwkHfAUgfdLfR4U/KjJb+V2WVcR+MnarQL9r8w=; 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=Yx9Gq+xTDWdcko1mUYIdrFWO0NI7TvCkAGBQs4GQycxA2uihfy0wAH/MNIuH272Gc WI8V84WeAEhaWbNIL3DJ9FD/nFrdpz+VUWUXpCUg6/Qe67fEvJN4uaXiBWc9lZwnU6 viXxxU3pUilzaNzLpTto8j+KXVCldOnNe8+MdbTbktUGkkFvFOA2zmJ0IM9J0UYszz xaynK6ti0UfnIwhnvENR9dHOKb1Myl8QuA9XEZ6ZCmX/LTaZoFNbhpbPrO1AKKespg moUAL2YWcfQqEA2sQetL4GZUqERmyj99Lg727PxsKKXpG70W8Yy5vnWI+aBuvK0cAs su1VjDvYzZdtw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 29AE5695A6 for ; Tue, 20 Jan 2026 16:44:52 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952690; bh=KBrXOyFtvc75GQ4u//8CZx+NTPxVWJUHFBDwBIPrUKE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DzuK6o5xlO1iKflMwPNbTV3FTtYzXEqjUN1qhg3l1bX2t+xznt26LHiV+JvKZsIAQ hUcwpbv5JK8FZUmva7IbgC3Zkk3G50063kQsGgsPO7+477dIVeqWXNVwhPbMDBv2nP 3rQsDw0SZ+biHzMPIWoC1FBo+2jXBFfy1Naet+SdegO3/Kh8nb2mrRZ3/QdMSfEvTZ GRdBzpBAqvFo8SYrItzKWIOBAF0W0rwKVk8w3C8GvCl0/R6XuUtT3UfakOB8Dh+Fah nHhqPAnGrAnGrdCshg1qnvoXpQJ8CtBeUrcLuyKv1X0xFr8U0l3V6weTqUqg1sNv/l BNKpVGyTXqgZw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CEF669597; Tue, 20 Jan 2026 16:44:50 -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 z4qdHtaHvjPN; Tue, 20 Jan 2026 16:44:50 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952685; bh=Yv6ONqeQLTF0iffS6D8aLvt34QhyCP9mS+KQQ5XRpMw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=DE10ctHa8sXvkUz7wDhuo9rMYCsJ6J976gpq2J9DfnTxlwwfBHRbk2Hxk2qHbLaVU O8NMHUVmRNr4wN55Xwla6meuBhnO3+08q0d+L+5N4hxbToSs2LlfbkJqPXPXQhB2Ts FHiCxCQIzsLC5S8/m/wI7YzNSYgpVIC6xLIG7oNwk9m2FUdk08U59+7AxqWjtunE8j 4vueYn5t6AY6vJlk0gC9JvPCAIohjamOUm9zT1xFqPwC7IG9t5s7GBDxbiUJh6MWbJ iK1c/8GxASkRfk3EJkaXu8mJoKNyFBxc4RrTmLQ4EfAeKRZT4gqlmF5REcZNCMvXX0 Y8Pgdz5jUUj9Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9F30D69555; Tue, 20 Jan 2026 16:44:45 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:27 -0700 Message-ID: <20260120234344.495605-8-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: RGFBPWE2GYZ3454RC4KBGHWKLC5LANXR X-Message-ID-Hash: RGFBPWE2GYZ3454RC4KBGHWKLC5LANXR 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 07/17] ext4l: Move time functions to linux/time.h 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 ktime_get_real_seconds() and time_before32() to linux/time.h where they belong in the Linux kernel header hierarchy. This removes these stubs from ext4_uboot.h. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 4 +--- include/linux/time.h | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 09e58989888..d1ec4a84b97 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -229,9 +229,7 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); #define sb_find_get_block(sb, block) ((struct buffer_head *)NULL) #define sync_dirty_buffer(bh) submit_bh(REQ_OP_WRITE, bh) -/* Time functions - use boot-relative time for timestamps */ -#define ktime_get_real_seconds() (get_timer(0) / 1000) -#define time_before32(a, b) (0) +/* Time functions - ktime_get_real_seconds, time_before32 are in linux/time.h */ /* Inode operations - iget_locked and new_inode are in interface.c */ extern struct inode *new_inode(struct super_block *sb); diff --git a/include/linux/time.h b/include/linux/time.h index b23598295c2..17471d2c26c 100644 --- a/include/linux/time.h +++ b/include/linux/time.h @@ -174,4 +174,18 @@ struct timespec64 { long tv_nsec; }; +/* + * time_before32 - check if 32-bit time @b is before time @a + * + * U-Boot stub - time comparison not supported, always returns false. + */ +#define time_before32(b, a) (0) + +/* + * ktime_get_real_seconds - get current wall-clock time in seconds + * + * U-Boot implementation uses get_timer() to return boot-relative time. + */ +#define ktime_get_real_seconds() (get_timer(0) / 1000) + #endif From patchwork Tue Jan 20 23:43:28 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1717 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=1768952696; bh=DEwAl6koWB9AO5qQrdUFkbUnA5Rw75yVKgcyylL6XR4=; 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=ao6qUNQQE/+dtD6LF1O0XkmakeHzdqr2/PEzCWpomEd09Lqid8+bfqlpevmYHOLCs ESYwpNdZvTIVNqhp2ac3lU28Ur1U0b/J+9BhwIXICq1Ds68dayycxEB6d3gDBdAOiy vacysuD56CXkXil3dPmNqO6bFwUd3UbXkbz9MFjU8uSVhAWGmUiEpEIxALRTI4b133 ojV/etehdmQrMDi5pYSmg7q07hZyYdWqfMkjaJeUBkrEVnNlnPZY2KkL4fi7i7mFNf sIkibIsrd+fa7yr59jYEFl+tfQX3d5p9zwvHhiJ5pIBC/ys+6UUXv6yMQkAgLfDqzo sfP65FsWCH29g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A567A695AE for ; Tue, 20 Jan 2026 16:44:56 -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 bHBsvmk3i2ro for ; Tue, 20 Jan 2026 16:44:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952696; bh=DEwAl6koWB9AO5qQrdUFkbUnA5Rw75yVKgcyylL6XR4=; 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=ao6qUNQQE/+dtD6LF1O0XkmakeHzdqr2/PEzCWpomEd09Lqid8+bfqlpevmYHOLCs ESYwpNdZvTIVNqhp2ac3lU28Ur1U0b/J+9BhwIXICq1Ds68dayycxEB6d3gDBdAOiy vacysuD56CXkXil3dPmNqO6bFwUd3UbXkbz9MFjU8uSVhAWGmUiEpEIxALRTI4b133 ojV/etehdmQrMDi5pYSmg7q07hZyYdWqfMkjaJeUBkrEVnNlnPZY2KkL4fi7i7mFNf sIkibIsrd+fa7yr59jYEFl+tfQX3d5p9zwvHhiJ5pIBC/ys+6UUXv6yMQkAgLfDqzo sfP65FsWCH29g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 94C9A695A6 for ; Tue, 20 Jan 2026 16:44:56 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952694; bh=pYyFvRhz6bj6LXCU+Awg8Cge0OL+J9BUEEM9G07xB4Q=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=A3JIyTBxtv9AftmfAlLG0DXKPgCilXvCzUcy1irMsaR2oi/3AW3JOBbZIlXmk6sLZ hfJmdYjMVIRQJ9AfMrS3tFbswwkiLelZLLYBdoXkZ4OOM5bBiOn9ARysjvBaXd221D 3grnj7nkkV7dQqy10fJwbzbUtcDPBxLr8xAupW4v1xdsybm5OMmMv6o0ONX0xZ0F88 4u5+ezSXd75eLVqLgA2iiZbrcFflhpFIOybP2OAUviTj2KQ+umkcazwMOTJzR776DS AKIg8f6ASOKKxg9FyNmq9cLYJa+QPzavizIK2+Ki+ImKNUQwsCVKQYpGvB8QvkcoYn AadeIP4B+ZtoA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9538169597; Tue, 20 Jan 2026 16:44:54 -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 qBNlng8e6hVz; Tue, 20 Jan 2026 16:44:54 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952690; bh=WoXXvTlXj05fOguo5y0j3xhFzv5K5Tag96UUpIE5IpI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=tqjf4795Uy7XmVzdXLdEFyXINCByh9LiUFsLY68h6SlfpD2V9+FTOJoXii0BaY0B8 8TodSa9Yco1xNYcutQfeu85HjQQRpDigz/Ffd46TQHp3xIJYb48lHOs8zxh4yIfshM nW6xihKHJWoQe5dVfF6zEmojGFbLl9f80L/QLGHJIqfne5AOwzbcVRt4BTJQlp2J+O K9wPLwUApDZneMFA4Ty9/36GBEMIBcvtDKwgRcSl4TbZ3dFLqB1YoChjcQQTJfIoZE NQ/8U538Vp00KkW1TQkgeAZJjRLqRmtiO9po2h+e1jZngs2HjA3tmEokY5soXfuLbb BAsIjw9qOsexg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 419FA69555; Tue, 20 Jan 2026 16:44:50 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:28 -0700 Message-ID: <20260120234344.495605-9-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: 3GSXMV6MQF2NNUH2EFQKJNN64XUXY4VH X-Message-ID-Hash: 3GSXMV6MQF2NNUH2EFQKJNN64XUXY4VH 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 08/17] ext4l: Move buffer and filesystem helpers 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 definitions to their canonical Linux header locations: - MAX_LFS_FILESIZE to linux/fs.h - end_buffer_read_sync() to linux/buffer_head.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 | 13 ++----------- include/linux/buffer_head.h | 14 ++++++++++++++ include/linux/fs.h | 3 +++ 3 files changed, 19 insertions(+), 11 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index d1ec4a84b97..b44939bfe5a 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -979,15 +979,7 @@ static inline const char *simple_get_link(struct dentry *dentry, /* QFMT_VFS_* quota format constants are in linux/quotaops.h */ -/* Buffer read sync */ -static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate) -{ - if (uptodate) - set_buffer_uptodate(bh); - else - clear_buffer_uptodate(bh); - unlock_buffer(bh); -} +/* end_buffer_read_sync is in linux/buffer_head.h */ /* REQ_OP_READ is in linux/blk_types.h */ /* SB_ACTIVE is in linux/fs.h */ @@ -1103,8 +1095,7 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* EXT4 magic number */ #define EXT4_SUPER_MAGIC 0xEF53 -/* Max file size for large files */ -#define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) +/* MAX_LFS_FILESIZE is in linux/fs.h */ /* blockgroup_lock - use linux/blockgroup_lock.h */ #include diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index a160b7d1a67..591f2ec1cbb 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -213,4 +213,18 @@ static inline bool noop_dirty_folio(struct address_space *mapping, return false; } +/* + * end_buffer_read_sync - completion handler for synchronous buffer reads + * @bh: buffer head that completed + * @uptodate: whether the read was successful + */ +static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate) +{ + if (uptodate) + set_buffer_uptodate(bh); + else + clear_buffer_uptodate(bh); + unlock_buffer(bh); +} + #endif /* _LINUX_BUFFER_HEAD_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index 993985f88f3..5f1d702bab4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -318,6 +318,9 @@ enum { #define I_DIRTY_DATASYNC (1 << 2) #define I_DIRTY_TIME (1 << 3) +/* Maximum file size for large files */ +#define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) + /** * struct fstrim_range - fstrim ioctl argument * @start: first byte to trim From patchwork Tue Jan 20 23:43:29 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1718 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=1768952701; bh=NqP5ieX4dp+2gGHG8M8KtpYEUJIunNGeYKO/jKZpNFQ=; 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=WZcQ0lg+7Vp4NhX5cpWPCUz8hIY0Aw3/fTqI4F/WCQxzinv4K7dWwJRXLVxe5Lm8c 3D0pyCjoooJ864d8kePObkruzPiGAmdHuZejTLSTXKpwXgDi88bLzgXK3wD/RyJHAw JGbfYzjcVlbBMw7Ffym7jnXLNKcBZHqw2OkZbIACXwUn8fWuU5Cr5oUpSy6rIorcLo CqeIWUgrOzrE8DNbviE5wBtnwsVBKKJFpjQgrOvOs1llLvEX69WzCbvec4mRABZOoj CeFEK+6EPF7UoiHzkhCVCuGeBhWtI0IGoCQj37gUz6QblXmuKgV6dtLRMH79jhsauD +OXAG6qoBYl1g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1E47369597 for ; Tue, 20 Jan 2026 16:45:01 -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 7Cvib870ys3n for ; Tue, 20 Jan 2026 16:45:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952701; bh=NqP5ieX4dp+2gGHG8M8KtpYEUJIunNGeYKO/jKZpNFQ=; 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=WZcQ0lg+7Vp4NhX5cpWPCUz8hIY0Aw3/fTqI4F/WCQxzinv4K7dWwJRXLVxe5Lm8c 3D0pyCjoooJ864d8kePObkruzPiGAmdHuZejTLSTXKpwXgDi88bLzgXK3wD/RyJHAw JGbfYzjcVlbBMw7Ffym7jnXLNKcBZHqw2OkZbIACXwUn8fWuU5Cr5oUpSy6rIorcLo CqeIWUgrOzrE8DNbviE5wBtnwsVBKKJFpjQgrOvOs1llLvEX69WzCbvec4mRABZOoj CeFEK+6EPF7UoiHzkhCVCuGeBhWtI0IGoCQj37gUz6QblXmuKgV6dtLRMH79jhsauD +OXAG6qoBYl1g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0ABF6695A6 for ; Tue, 20 Jan 2026 16:45:01 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952699; bh=3FB/vhGocCPG/dheCbKFlGGbp93SvOKZnLbsLbshXdU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hrbfAPvrEp6hvjkKyVNv/+Bx8E0Y7ORHh31jN/QYHaZeISq8+qlYs/TMre5Rwf3CN x0x3N+DTc1q/+d6LzPeOiVj6uCrp8CUYEwEI4uHkVy+uduxk1XW3HAU+DBgNafsum4 57V7xlafrTn2PeV8VtqYMCCUQf/tDCkUk32hAyclxxpQIT2RtP6Itx+xflt5DiDmaf w4e20+6IPf3b/r7Y82mtpwaEHWs/SwoKGV8IGxiVfd2C+ivJmFOYy/H0afGq0ywnbQ qlasirmXJKDt1xJEecu3fdWrltGpK/owa77qak1Yf1deiqc6YlNS+qPUZ8SSm8Aswz PcNQ97hsTA1mQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2711569597; Tue, 20 Jan 2026 16:44:59 -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 8whUwV1RdDaX; Tue, 20 Jan 2026 16:44:59 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952695; bh=22jSGEGjEJC7R4itmmvgNoFX7yeGQ5M4MZwrELTM6KE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OUksnKK6mua69pZID0gg1Bn39uyVQy+2OisBgxYINXZWurS157KKbo3cTnwgI/3YC LdQ8Ji/mj1ncu+b7hNXwh+9W3/dijwb+6hFAZnbbcIWBbVClmFwCbHLvZrwplZx9FI m/ixp488zf+QJmiJiT/lvOIj1VUPkQH8tdVq1U9i6Z/7SHktst+RYiErE9HyXZjfYx yk/iVMIQ7qsKVjgOacDXr7u0CnKtydB0YQ8krXERAt8RR0t99trpU2CA9AB7UtsOY9 ASYd7abSrnlPYbkEhI5uxQmQetxeOjSs67xD4kB4KeUYRx1Rbwn3J2G1vqgDejYrj+ OCqA3Tc681ezg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id CE27569555; Tue, 20 Jan 2026 16:44:54 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:29 -0700 Message-ID: <20260120234344.495605-10-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: D372F27YVHXLQKCW4PX4DYLAISQ4UQLL X-Message-ID-Hash: D372F27YVHXLQKCW4PX4DYLAISQ4UQLL 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 09/17] ext4l: Move block device atomic write stubs to linux/blkdev.h 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 bdev_can_atomic_write(), bdev_atomic_write_unit_max_bytes(), and bdev_atomic_write_unit_min_bytes() stubs to linux/blkdev.h where they belong in the Linux kernel header hierarchy. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 5 +---- include/linux/blkdev.h | 5 +++++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b44939bfe5a..b44126a733a 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1181,10 +1181,7 @@ void free_page(unsigned long addr); void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, void *holder); -/* Block device atomic write stubs */ -#define bdev_can_atomic_write(bdev) ({ (void)(bdev); 0; }) -#define bdev_atomic_write_unit_max_bytes(bdev) ({ (void)(bdev); (unsigned int)0; }) -#define bdev_atomic_write_unit_min_bytes(bdev) ({ (void)(bdev); 0UL; }) +/* Block device atomic write stubs are in linux/blkdev.h */ /* Superblock blocksize - declaration for stub.c */ int sb_set_blocksize(struct super_block *sb, int size); diff --git a/include/linux/blkdev.h b/include/linux/blkdev.h index f1a4cc12d3c..eaf2984c08f 100644 --- a/include/linux/blkdev.h +++ b/include/linux/blkdev.h @@ -50,4 +50,9 @@ struct blk_plug { */ #define blk_finish_plug(plug) do { (void)(plug); } while (0) +/* Block device atomic write support - not supported in U-Boot */ +#define bdev_can_atomic_write(bdev) ({ (void)(bdev); 0; }) +#define bdev_atomic_write_unit_max_bytes(bdev) ({ (void)(bdev); (unsigned int)0; }) +#define bdev_atomic_write_unit_min_bytes(bdev) ({ (void)(bdev); 0UL; }) + #endif /* _LINUX_BLKDEV_H */ From patchwork Tue Jan 20 23:43:30 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1719 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=1768952707; bh=SK8Fs4ZldbgT1dHTYvbaaoy7I8SaPHzKZmJjNZBmFs8=; 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=gY1WrgDqRNPhibw5dJ6y6IKm64b/rPX9MFoalxtfqhtHOh4wa3umunskHKaUiSxVq vZMGKhRUGqNUbJU6RAduDiAuUSVw6nwI6v4i1GPixSyZAisHVlpr3jZPCKoiGh2U/B ZtYtPWbl+y4CQ5E9W1lINImtZOS7O15FV4KvlVX3xjHevrQTrgit0YhdAZkK1wrbRa f0pu0fX31/zVBoGZyaj+nVx95uVePHTBaUjJofKuuDAMP7xtOuNydZLHq9B6656+Nm KQELvgxXXIEOhF4ZD7rUbDkD2LuIwJrXtlIoatqCoUNBQ5hX4iagEVrlBmVG7+e3Y7 ZjuOw8GCCjZDQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D2A4569555 for ; Tue, 20 Jan 2026 16:45:07 -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 u8XS_PMRIT7G for ; Tue, 20 Jan 2026 16:45:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952707; bh=SK8Fs4ZldbgT1dHTYvbaaoy7I8SaPHzKZmJjNZBmFs8=; 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=gY1WrgDqRNPhibw5dJ6y6IKm64b/rPX9MFoalxtfqhtHOh4wa3umunskHKaUiSxVq vZMGKhRUGqNUbJU6RAduDiAuUSVw6nwI6v4i1GPixSyZAisHVlpr3jZPCKoiGh2U/B ZtYtPWbl+y4CQ5E9W1lINImtZOS7O15FV4KvlVX3xjHevrQTrgit0YhdAZkK1wrbRa f0pu0fX31/zVBoGZyaj+nVx95uVePHTBaUjJofKuuDAMP7xtOuNydZLHq9B6656+Nm KQELvgxXXIEOhF4ZD7rUbDkD2LuIwJrXtlIoatqCoUNBQ5hX4iagEVrlBmVG7+e3Y7 ZjuOw8GCCjZDQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BFB1A695A6 for ; Tue, 20 Jan 2026 16:45:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952705; bh=IhT/P30AesaOzhpqmX0LtC+lPAkWx8e5CRbkH1JQxi0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bu+h9wxegYuo3grQxIZmV3/ogg7GfAGdczWXO9kbOW8dxdVMlbORmnUiuPonXOamU OeOug88RkvUHJJKdYE6pwe2RL1sqnhmlvPzotUnMb8AeEvXeI6Nk4EbGNl2liT0pvk P03O9cn42zFAV3ChSPY+eZxdDUN5u0721olq3aAgPZmIAkvRXeFi5ZhIcMz/vDXO9r K/dRBgNRkVSkCDnQWw8ckCy386QKbr6a3VUMD2IiU/YW1E1v4uV++xpHwyCZZ2qyfE tUlpVQJX5/z9VHvz+H3ATaGIX24tsxJ2bbPCGYmML5i8ENJFaldXkU4EddMu8JijZJ OIlggiweC5x9A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8AADC695A6; Tue, 20 Jan 2026 16:45: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 kMfRip7Zx0UF; Tue, 20 Jan 2026 16:45:05 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952699; bh=kJXpzTWz/htFNzw4x9FXMgc4h2OwBnIcicAIXHNcCm0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XpsptxidNobse03O/qwmnRHDoORTvZpDr8W80G6lB8a4KKparAXsQZiSAEKl56fEf Egiiy/dob3MWEk29PMG3a2RQNfBbGlbcq9cUx7RWdZho11tybdFZ4KdIybyblTQeDD 4zLr4kGJiLS7+u5uu4iB1Brkgm4a8HTTJC+0p+WlYbPxbRbZ8gClUQjnNGQyH+tk4c C+d/cqZjxsbVO+lhSmASX9j6waKMYmo8Oxf4X9Gzjmlc9Fu0UbH50Cy1bbpbEnLUu+ VkurwLVajw+tb5bzzQfohwKRunFFDckOfo1OkJ4VTz8e29s1G9oZUQURAFAtHQIIeY 7qx03JHJ1pMxQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 6F34869555; Tue, 20 Jan 2026 16:44:59 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:30 -0700 Message-ID: <20260120234344.495605-11-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: 5CO3LUKFF4JWWDHYMP47K3JMGCSIFWS5 X-Message-ID-Hash: 5CO3LUKFF4JWWDHYMP47K3JMGCSIFWS5 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 10/17] ext4l: Move get_block_t typedef to linux/fs.h 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 the get_block_t callback typedef to linux/fs.h where it belongs in the Linux kernel header hierarchy. This type is used for filesystem block mapping callbacks. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 8 +------- include/linux/fs.h | 12 ++++++++++++ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index b44126a733a..8a2d18ccaf5 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -327,13 +327,7 @@ BUFFER_FNS(OwnsData, ownsdata) #define BH_Cached (BH_JBDPrivateStart + 2) BUFFER_FNS(Cached, cached) -/* Forward declare for get_block_t */ -struct inode; -struct buffer_head; - -/* get_block_t - block mapping callback */ -typedef int (get_block_t)(struct inode *inode, sector_t iblock, - struct buffer_head *bh_result, int create); +/* get_block_t is in linux/fs.h */ /* crc32c - from linux/crc32c.h */ #include diff --git a/include/linux/fs.h b/include/linux/fs.h index 5f1d702bab4..a6ad309e5c8 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -321,6 +321,18 @@ enum { /* Maximum file size for large files */ #define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) +/** + * get_block_t - block mapping callback type + * @inode: inode to map blocks for + * @iblock: logical block number + * @bh_result: buffer head to fill with mapping + * @create: whether to create new blocks + * + * Callback function type for filesystem block mapping. + */ +typedef int (get_block_t)(struct inode *inode, sector_t iblock, + struct buffer_head *bh_result, int create); + /** * struct fstrim_range - fstrim ioctl argument * @start: first byte to trim From patchwork Tue Jan 20 23:43:31 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1721 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=1768952715; bh=Z6rhaIQT4vgq21VAw8UHexxO0eFUFYzMLP7UEeyiB9w=; 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=L8upFZxnsGjIyxtAn9+3QsNKFnY9bXQDtsvYsn9XmpBn6LHEmqd/WNZjwvHeKAP5n kcxNokLLUAKduRDlu9i8Ews7m8U4At4w9sn6j5IMtqZf5r7LcPtTypR5V0qBMd45nZ nNkKqK4NsdVULJi2cZ+/9/hsUFikbrRvN6MaljJlwQikFzQormcXWWcT3WT8ouVwn9 uhdV1f2SNA4OSKd/ggz1NRrRULyRDC0xy2WRbKzY5/yc1yzrlcW4DIBceshXANvN8G WlwjGJg4mfhfz6zHgsc3xIx3ifYmQwiF3E0HylYC4eqVPgnNK0j1zs7b5EQSTVa0Mr SE1Xo+gELGhcA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D71D5695B5 for ; Tue, 20 Jan 2026 16:45: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 10024) with ESMTP id wrJwfEIl4SJS for ; Tue, 20 Jan 2026 16:45:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952713; bh=Z6rhaIQT4vgq21VAw8UHexxO0eFUFYzMLP7UEeyiB9w=; 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=QnrSO/dBFLq28TKehqf7DcdeSUtll+JEdVkSIZLmjii4UXd0DFt7WBPsb4S5gSLjI kuvj7X2TvCCxxflbJBwUKlZXV4jjZAoQllXdhphd6oZ2yf+mHIseX46c0aa3NG9Ehm 8WsSprwGsiplynom7f3KGUqjAHklxqZocmsaqOCY/HkaJh36gWMHEi6U2GrIZ8Lemm 8b754qPSXoukst2fA4dggYm8jmWTyeLzQpVOh1TfDECx4jUqKKObjxVD9fIhUOp8GF jtS9bg2svW8ecj9q55KPACl88qSWAyBjL7IlDRbpwwOo5AxDb8TCNI+872qLgN33Br trF8wou0eYjXg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CFC0969597 for ; Tue, 20 Jan 2026 16:45:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952710; bh=cmzkjcxfDijF7/HgZcz38ML9+aBwJrhasuWFVZHF6fs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IseSzpHx6frHfUjkd/+ySGgIIdn1eVRdTcDJwqPNQGHcKLhI2Onw7PYFTu9X0yfKy YY4gPPOdRp12bLsXmxK5TTR/HSYZBe4iPRvfKr+cDPwAUnw4/fhQRJs5UCcmS3CkjF xe/vmYPrUGB7UC8eTEJNq3GH+NnIjWVa8Kutc9GCcqUMdRTfCzG+UI6zUwH11Eg+pq VLsPesk5Q/lkz7gRmF1QpNvHJWKNfK2+ffF27sKTvR/JtnjpLlLCa0gRRTWBpm0X4c h5/NuIR9I8v1tXe9m53KpwbhKOSwl3ppvwJ05Y+0X5Hm0Bny9yPNVTi94ff+1hyElt 3Lu4fIrJeawdw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5682269555; Tue, 20 Jan 2026 16:45:10 -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 TU1hHq1QwGZX; Tue, 20 Jan 2026 16:45:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952704; bh=6cUseMsoEG67F624QDCM8+as0MLYpoNIzwhW5j9wo5M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ugrCPCJmdq6FZN63fRaw7l8TETQsUX1BNYE4QIqxOvV6tLz+eJdNNOv3GjxrpyULl rIvVSDbJlG+3MgOe5oAIGdIvFuOfuW+qAxTQ6aOGqDYo9FAuyHrvD94sGGZv9A9ct2 GA70pSCJhRPFfWadW4vGIrB1Ac/eEXpu7WOH25ozc8vBzE01hCxpmTyOmQ1qkxiL4o nT1nRx+nig666qqjl2IZvNVfNbV8Hl8kEGdJI8CNpdgebtcpNIQOV3lWdC4IiKWAIC qhU5AKyfur83hEOznWtA8CmLfOeLFMlov8uOBg260rEIISJNDgo/AWaiQAKG6nLvK/ XknllLyT6T3+Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0AA4C69597; Tue, 20 Jan 2026 16:45:03 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:31 -0700 Message-ID: <20260120234344.495605-12-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: GEBZGWPR6GM6HX77CAHZWM7NKPLKMZ72 X-Message-ID-Hash: GEBZGWPR6GM6HX77CAHZWM7NKPLKMZ72 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 11/17] ext4l: Move buffer operations to linux/buffer_head.h 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 buffer-related operations to linux/buffer_head.h: - Buffer cache lookup: sb_find_get_block(), sb_find_get_block_nonatomic(), __find_get_block_nonatomic() - Buffer dirty operations: sync_dirty_buffer(), mark_buffer_dirty(), mark_buffer_dirty_inode(), write_dirty_buffer() - Buffer allocation: alloc_buffer_head(), free_buffer_head(), sb_getblk(), __getblk(), sb_getblk_gfp(), getblk_unmovable() - Buffer read: bh_read(), bh_read_nowait(), bh_readahead_batch() - Other: bh_uptodate_or_lock(), submit_bh() declaration Also move IS_DIRSYNC() and IS_NOSEC() to linux/fs.h with the other inode flag checking macros. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 44 ++++++++++++------------------------- include/linux/buffer_head.h | 41 ++++++++++++++++++++++++++++++++++ include/linux/fs.h | 2 ++ 3 files changed, 57 insertions(+), 30 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 8a2d18ccaf5..4ec4d713eb4 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -189,10 +189,7 @@ /* Trace stubs are now in ext4_trace.h */ -/* Buffer operations - wait_on_buffer, lock_buffer, unlock_buffer etc are in linux/buffer_head.h */ -#define mark_buffer_dirty_inode(bh, i) sync_dirty_buffer(bh) -#define mark_buffer_dirty(bh) sync_dirty_buffer(bh) -struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); +/* Buffer operations are in linux/buffer_head.h */ /* wait_on_bit_io is now in linux/wait_bit.h */ /* inode_needs_sync is in linux/fs.h */ @@ -225,9 +222,7 @@ struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); /* Random number functions - use linux/random.h */ #include -/* Buffer cache operations */ -#define sb_find_get_block(sb, block) ((struct buffer_head *)NULL) -#define sync_dirty_buffer(bh) submit_bh(REQ_OP_WRITE, bh) +/* Buffer cache operations - sb_find_get_block, sync_dirty_buffer are in linux/buffer_head.h */ /* Time functions - ktime_get_real_seconds, time_before32 are in linux/time.h */ @@ -240,7 +235,7 @@ extern struct inode *new_inode(struct super_block *sb); #define insert_inode_locked(inode) (0) #define unlock_new_inode(inode) do { } while (0) #define clear_nlink(inode) do { } while (0) -#define IS_DIRSYNC(inode) ({ (void)(inode); 0; }) +/* IS_DIRSYNC is in linux/fs.h */ /* fscrypt_prepare_new_inode, fscrypt_set_context are in ext4_fscrypt.h */ @@ -619,9 +614,7 @@ struct dx_hash_info { /* rwsem_is_locked is in linux/rwsem.h */ -/* Buffer operations */ -#define sb_getblk_gfp(sb, blk, gfp) sb_getblk((sb), (blk)) -#define bh_uptodate_or_lock(bh) (1) +/* Buffer operations - sb_getblk_gfp, bh_uptodate_or_lock are in linux/buffer_head.h */ /* ext4_read_bh is stubbed in interface.c */ /* Inode locking stubs are in linux/fs.h */ @@ -639,8 +632,7 @@ struct dx_hash_info { #define generic_atomic_write_valid(iocb, from) ({ (void)(iocb); (void)(from); 0; }) #define vfs_setpos(file, offset, maxsize) ({ (void)(file); (void)(maxsize); (offset); }) -/* Security checks - no security in U-Boot */ -#define IS_NOSEC(inode) (1) +/* IS_NOSEC is in linux/fs.h */ /* Filemap operations and fault handlers are in linux/pagemap.h */ @@ -778,7 +770,7 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* try_to_writeback_inodes_sb is in linux/writeback.h */ /* Buffer operations - additional */ -#define getblk_unmovable(bdev, block, size) sb_getblk(bdev->bd_super, block) +/* getblk_unmovable is in linux/buffer_head.h */ #define create_empty_buffers(f, s, flags) ({ (void)(f); (void)(s); (void)(flags); (struct buffer_head *)NULL; }) /* bh_offset returns offset of b_data within the folio */ #define bh_offset(bh) ((bh)->b_folio ? \ @@ -1094,8 +1086,8 @@ void end_buffer_write_sync(struct buffer_head *bh, int uptodate); /* blockgroup_lock - use linux/blockgroup_lock.h */ #include +/* submit_bh is in linux/buffer_head.h */ /* Buffer submission stubs - declarations for stub.c implementations */ -int submit_bh(int op_flags, struct buffer_head *bh); struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, unsigned int size, gfp_t gfp); int trylock_buffer(struct buffer_head *bh); @@ -1298,11 +1290,7 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* schedule_timeout_uninterruptible, need_resched are in linux/sched.h */ -/* Block device operations */ -#define sb_find_get_block_nonatomic(sb, block) \ - ({ (void)(sb); (void)(block); (struct buffer_head *)NULL; }) -#define __find_get_block_nonatomic(bdev, block, size) \ - ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) +/* sb_find_get_block_nonatomic, __find_get_block_nonatomic are in linux/buffer_head.h */ #define bdev_discard_granularity(bdev) \ ({ (void)(bdev); 0U; }) @@ -1377,9 +1365,9 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); /* get_current_ioprio is in linux/ioprio.h */ /* JBD2 checkpoint.c stubs */ -#define mutex_lock_io(m) mutex_lock(m) -#define write_dirty_buffer(bh, flags) sync_dirty_buffer(bh) -#define spin_needbreak(l) ({ (void)(l); 0; }) +/* mutex_lock_io is in linux/mutex.h */ +/* write_dirty_buffer is in linux/buffer_head.h */ +/* spin_needbreak is in linux/spinlock.h */ /* JBD2 commit.c stubs (folio_trylock is in linux/pagemap.h) */ #define clear_bit_unlock(nr, addr) clear_bit(nr, addr) @@ -1388,7 +1376,7 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); #define filemap_fdatawait_range_keep_errors(m, s, e) \ ({ (void)(m); (void)(s); (void)(e); 0; }) #define crc32_be(crc, p, len) crc32(crc, p, len) -void free_buffer_head(struct buffer_head *bh); +/* free_buffer_head is in linux/buffer_head.h */ /* ext4l support functions (support.c) */ void ext4l_crc32c_init(void); @@ -1415,9 +1403,7 @@ struct disk_partition *ext4l_get_partition(void); #define cond_resched_lock(lock) do { (void)(lock); } while (0) /* JBD2 journal.c stubs */ -struct buffer_head *alloc_buffer_head(gfp_t gfp_mask); -struct buffer_head *__getblk(struct block_device *bdev, sector_t block, - unsigned int size); +/* alloc_buffer_head, __getblk are in linux/buffer_head.h */ int bmap(struct inode *inode, sector_t *block); /* seq_file operations for /proc - stubs */ @@ -1438,9 +1424,7 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); /* lockdep_init_map and lock_class_key are in linux/lockdep.h */ /* Block device operations for journal.c */ -int bh_read(struct buffer_head *bh, int flags); -#define bh_read_nowait(bh, flags) bh_read(bh, flags) -#define bh_readahead_batch(n, bhs, f) do { (void)(n); (void)(bhs); (void)(f); } while (0) +/* bh_read, bh_read_nowait, bh_readahead_batch are in linux/buffer_head.h */ #define truncate_inode_pages_range(m, s, e) \ do { (void)(m); (void)(s); (void)(e); } while (0) #define blkdev_issue_discard(bdev, s, n, gfp) \ diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 591f2ec1cbb..3e5893ab99d 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -187,6 +187,37 @@ void __brelse(struct buffer_head *bh); #define unlock_buffer(bh) clear_buffer_locked(bh) #define test_clear_buffer_dirty(bh) ({ (void)(bh); 0; }) +/* Buffer I/O submission - implemented in ext4l/stub.c */ +int submit_bh(int op_flags, struct buffer_head *bh); + +/* Buffer read functions - implemented in ext4l/support.c */ +int bh_read(struct buffer_head *bh, int flags); +#define bh_read_nowait(bh, flags) bh_read(bh, flags) +#define bh_readahead_batch(n, bhs, f) do { (void)(n); (void)(bhs); (void)(f); } while (0) + +/* + * Buffer dirty operations. + * In U-Boot we write buffers synchronously, so marking dirty writes immediately. + */ +#define sync_dirty_buffer(bh) submit_bh(REQ_OP_WRITE, (bh)) +#define mark_buffer_dirty(bh) sync_dirty_buffer(bh) +#define mark_buffer_dirty_inode(bh, i) sync_dirty_buffer(bh) +#define write_dirty_buffer(bh, flags) sync_dirty_buffer(bh) + +/* Buffer uptodate check - always returns true (buffer assumed uptodate) */ +#define bh_uptodate_or_lock(bh) (1) + +/* Buffer allocation functions - implemented in ext4l */ +struct super_block; +struct buffer_head *alloc_buffer_head(gfp_t gfp_mask); +void free_buffer_head(struct buffer_head *bh); +struct buffer_head *sb_getblk(struct super_block *sb, sector_t block); +struct buffer_head *__getblk(struct block_device *bdev, sector_t block, + unsigned int size); +#define sb_getblk_gfp(sb, blk, gfp) sb_getblk((sb), (blk)) +#define getblk_unmovable(bdev, block, size) \ + sb_getblk((bdev)->bd_super, (block)) + /* * Folio migration stubs - U-Boot doesn't support memory migration */ @@ -227,4 +258,14 @@ static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate) unlock_buffer(bh); } +/* + * Buffer cache lookup stubs - U-Boot doesn't maintain a buffer cache + */ +#define sb_find_get_block(sb, block) \ + ({ (void)(sb); (void)(block); (struct buffer_head *)NULL; }) +#define sb_find_get_block_nonatomic(sb, block) \ + ({ (void)(sb); (void)(block); (struct buffer_head *)NULL; }) +#define __find_get_block_nonatomic(bdev, block, size) \ + ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) + #endif /* _LINUX_BUFFER_HEAD_H */ diff --git a/include/linux/fs.h b/include/linux/fs.h index a6ad309e5c8..431dc0c513a 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -305,6 +305,8 @@ enum { #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 */ +#define IS_DIRSYNC(inode) ({ (void)(inode); 0; }) +#define IS_NOSEC(inode) (1) /* No security checks in U-Boot */ /* inode_needs_sync - check if inode needs synchronous writes (always false) */ #define inode_needs_sync(inode) (0) From patchwork Tue Jan 20 23:43:32 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1720 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=1768952713; bh=XT+yo3rMnifxur/Ti/t7zHUVx3f2In0x2IeJKlUerTA=; 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=lsS292JjGy6MhUqOFHYK8It7DDFzgfp6/+HSZ5W8A8vyjWNgegFSRrYpBHyLP7Ht7 tvhKP8BiBlU+DRbJJy33UC/gqo0GH8ze5Ggpfzr/KAYGQ1azeqlSV7cX+0O3bCaym1 gbVbdbj50pPxIDyeR7wSymamKsPZv8kclSmvw4BklefTnvrdHQ08SNnoIgu5Cy5kNS ZVJSAuCM0Ithgy7rgang5dDuQIfoV63PMBF6clKPfJ9q8OKRrBd/oZI7DE57zODFI0 /QQox07xK4UKvVTdbwUnSkKaRxyUR5SVv0Tm2DX6AsPMsSnotiU5vRvE6ytOhsiZB9 wZfuLt85Y99JA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6149469555 for ; Tue, 20 Jan 2026 16:45:13 -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 p_au2lm82DEW for ; Tue, 20 Jan 2026 16:45:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952713; bh=XT+yo3rMnifxur/Ti/t7zHUVx3f2In0x2IeJKlUerTA=; 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=lsS292JjGy6MhUqOFHYK8It7DDFzgfp6/+HSZ5W8A8vyjWNgegFSRrYpBHyLP7Ht7 tvhKP8BiBlU+DRbJJy33UC/gqo0GH8ze5Ggpfzr/KAYGQ1azeqlSV7cX+0O3bCaym1 gbVbdbj50pPxIDyeR7wSymamKsPZv8kclSmvw4BklefTnvrdHQ08SNnoIgu5Cy5kNS ZVJSAuCM0Ithgy7rgang5dDuQIfoV63PMBF6clKPfJ9q8OKRrBd/oZI7DE57zODFI0 /QQox07xK4UKvVTdbwUnSkKaRxyUR5SVv0Tm2DX6AsPMsSnotiU5vRvE6ytOhsiZB9 wZfuLt85Y99JA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4FD6A695A6 for ; Tue, 20 Jan 2026 16:45:13 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952710; bh=Z9HGOlVA1kGTTO/FulYtasG08N5+IqT6/EuDCH1US/w=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qvp00kpznP9QWDF1t458YRuJ6y7eDAYsB7wV4OBE/tIbJoTxLrGWNrshHbQdlLO6R NPtL6RC08vivGLHLkkiC6IP6Vxc1jyLkWGMYNGPMmm9UhvQ2w/8D47B7wuDU+ihJ3n SfbmNHjGNghcmY5kBrUTTkZyKVxJHhYpXvVZDimvTYZVT+0zfKc3WRBlkoA13yWTwO P0upRC8p6n5GvvtwBvDbQph74w1gKGyUeapkaP0t8auQZ5IwOXFqnzG7Fu8jEyuWIb +IN6UbMAm+fbj4HB97Ya+TtfyaNwoy03mpAWc77LGSugNvZGLyNgoRufUtJDMFa1BZ KMcDhUo3epHbw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4DA56695A6; Tue, 20 Jan 2026 16:45:10 -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 ov0l3rsvWphx; Tue, 20 Jan 2026 16:45:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952708; bh=C63HAWL3hG+rcXCYl0pvKRC/v9y86+ExJif6fYp2m1M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vn1iXjrDOQVHXZBcgB8DePFKvK2m13Yv/r+CD3J3TRYh/ba73VpQya3jCeIeIJ+xE GFu6exdAs6h22x9C78cXXuoKzA45KBgWooorZjgDOBrBH2/BdwW83zLqNKTmonyF9M lckuN3JimqylCkXSz5mLkfFZsZ7ZQAZLD1vGz/YFxcKXcgG/REl3yJbObBssqo9xcR gp+ZY9dGQKqahSGE+XANEpRXK7HrZggyLp2/FBMZvHBdopQ8PYiJnQyFmrYKGssgk5 NkvUcggjayS3g7+1LA3E3g9nn+s8umK2hhq8aKIRdwQdywFX2V4qo9Uc9BAwZ4aORL 4ilhyfhvMnLlg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id AA03D69555; Tue, 20 Jan 2026 16:45:08 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:32 -0700 Message-ID: <20260120234344.495605-13-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: QRF7VU35SSP6OQ3HT6F344E7NTGE5MCR X-Message-ID-Hash: QRF7VU35SSP6OQ3HT6F344E7NTGE5MCR 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/17] ext4l: Move inode stubs to proper 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 inode-related stubs to their proper Linux headers: - inode_io_list_del() to linux/writeback.h - inode_is_open_for_write(), inode_is_dirtytime_only() to linux/fs.h - icount_read(), i_uid_write(), i_gid_write(), inode_fsuid_set() to linux/fs.h - inode_init_owner(), insert_inode_locked(), unlock_new_inode() to linux/fs.h - clear_nlink(), set_nlink(), inc_nlink(), drop_nlink() to linux/fs.h - IS_NOQUOTA(), IS_SWAPFILE() to linux/fs.h - inode_set_ctime_current(), inode_set_mtime_to_ts(), inode_set_flags() to linux/fs.h - inode_set_cached_link(), init_special_inode(), make_bad_inode() to linux/fs.h - iget_failed(), find_inode_by_ino_rcu(), mark_inode_dirty() to linux/fs.h - invalidate_inode_buffers(), clear_inode() to linux/fs.h - i_uid_needs_update(), i_gid_needs_update(), i_uid_update(), i_gid_update() - lock_two_nondirectories(), unlock_two_nondirectories() to linux/fs.h - alloc_inode_sb(), inode_generic_drop() to linux/fs.h Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 66 ++++++++++----------------------------- include/linux/fs.h | 53 +++++++++++++++++++++++++++++++ include/linux/writeback.h | 8 +++++ 3 files changed, 78 insertions(+), 49 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 4ec4d713eb4..49dd566262b 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -214,9 +214,7 @@ /* Quota operations - use linux/quotaops.h */ #include -/* icount - inode reference count */ -#define icount_read(inode) (1) - +/* icount_read is in linux/fs.h */ /* d_inode is now in linux/dcache.h */ /* Random number functions - use linux/random.h */ @@ -228,13 +226,8 @@ /* Inode operations - iget_locked and new_inode are in interface.c */ extern struct inode *new_inode(struct super_block *sb); -#define i_uid_write(inode, uid) do { } while (0) -#define i_gid_write(inode, gid) do { } while (0) -#define inode_fsuid_set(inode, idmap) do { } while (0) -#define inode_init_owner(idmap, i, dir, mode) do { (i)->i_mode = (mode); } while (0) -#define insert_inode_locked(inode) (0) -#define unlock_new_inode(inode) do { } while (0) -#define clear_nlink(inode) do { } while (0) +/* i_uid_write, i_gid_write, inode_fsuid_set, inode_init_owner are in linux/fs.h */ +/* insert_inode_locked, unlock_new_inode, clear_nlink are in linux/fs.h */ /* IS_DIRSYNC is in linux/fs.h */ /* fscrypt_prepare_new_inode, fscrypt_set_context are in ext4_fscrypt.h */ @@ -335,9 +328,7 @@ BUFFER_FNS(Cached, cached) /* errseq_t is defined in linux/fs.h */ /* time64_t is now in linux/time.h */ -/* IS_NOQUOTA - stub */ -#define IS_NOQUOTA(inode) (0) - +/* IS_NOQUOTA is in linux/fs.h */ /* dentry, name_snapshot are now in linux/dcache.h */ /* VM types - use linux/mm_types.h */ @@ -640,8 +631,7 @@ struct dx_hash_info { #define daxdev_mapping_supported(f, i, d) ({ (void)(f); (void)(i); (void)(d); 1; }) /* Inode time/size operations - inode_newsize_ok, i_blocksize, IS_SYNC are in linux/fs.h */ -#define inode_set_ctime_current(i) ({ (void)(i); (struct timespec64){}; }) -#define inode_set_mtime_to_ts(i, ts) ({ (void)(i); (ts); }) +/* inode_set_ctime_current, inode_set_mtime_to_ts are in linux/fs.h */ /* Case-folding stubs - not supported in U-Boot */ #define sb_no_casefold_compat_fallback(sb) ({ (void)(sb); 1; }) @@ -754,10 +744,8 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* dquot_file_open is in linux/quotaops.h */ -/* Inode I/O list management */ -#define inode_io_list_del(inode) do { } while (0) -#define inode_is_open_for_write(i) (0) -#define inode_is_dirtytime_only(i) (0) +/* inode_io_list_del is in linux/writeback.h */ +/* inode_is_open_for_write, inode_is_dirtytime_only are in linux/fs.h */ /* Folio operations and writeback stubs are in linux/pagemap.h */ #define folio_batch_release(fb) do { } while (0) @@ -805,9 +793,9 @@ static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, /* Inode version operations - use linux/iversion.h */ #include -#define inode_set_flags(i, f, m) do { } while (0) +/* inode_set_flags is in linux/fs.h */ -/* Inode credential helpers */ +/* Inode credential helpers - i_uid_read, i_gid_read need struct inode */ static inline unsigned int i_uid_read(const struct inode *inode) { return inode->i_uid.val; @@ -818,10 +806,7 @@ static inline unsigned int i_gid_read(const struct inode *inode) return inode->i_gid.val; } -#define i_uid_needs_update(m, a, i) ({ (void)(m); (void)(a); (void)(i); 0; }) -#define i_gid_needs_update(m, a, i) ({ (void)(m); (void)(a); (void)(i); 0; }) -#define i_uid_update(m, a, i) do { } while (0) -#define i_gid_update(m, a, i) do { } while (0) +/* i_uid_needs_update, i_gid_needs_update, i_uid_update, i_gid_update are in linux/fs.h */ /* Device encoding helpers are now in linux/kdev_t.h */ #include @@ -831,15 +816,9 @@ static inline unsigned int i_gid_read(const struct inode *inode) /* Inode allocation/state operations */ extern struct inode *iget_locked(struct super_block *sb, unsigned long ino); -#define set_nlink(i, n) do { (i)->i_nlink = (n); } while (0) -#define inc_nlink(i) do { (i)->i_nlink++; } while (0) -#define drop_nlink(i) do { (i)->i_nlink--; } while (0) -#define inode_set_cached_link(i, l, len) do { } while (0) -#define init_special_inode(i, m, d) do { } while (0) -#define make_bad_inode(i) do { } while (0) -#define iget_failed(i) do { } while (0) -#define find_inode_by_ino_rcu(sb, ino) ((struct inode *)NULL) -#define mark_inode_dirty(i) do { } while (0) +/* set_nlink, inc_nlink, drop_nlink are in linux/fs.h */ +/* inode_set_cached_link, init_special_inode, make_bad_inode are in linux/fs.h */ +/* iget_failed, find_inode_by_ino_rcu, mark_inode_dirty are in linux/fs.h */ /* Attribute operations */ #define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) @@ -1118,11 +1097,8 @@ void fs_put_dax(void *dax, void *holder); /* fscrypt declarations are in ext4_fscrypt.h */ -/* Inode allocation - declaration for stub.c */ -void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, - gfp_t gfp); +/* alloc_inode_sb, inode_generic_drop are in linux/fs.h */ /* inode_set_iversion is in linux/iversion.h */ -int inode_generic_drop(struct inode *inode); /* rwlock_init is a macro in linux/spinlock.h */ @@ -1130,10 +1106,7 @@ int inode_generic_drop(struct inode *inode); #define kmem_cache_create_usercopy(n, sz, al, fl, uo, us, c) \ kmem_cache_create(n, sz, al, fl, c) -/* Inode buffer operations */ -#define invalidate_inode_buffers(i) do { } while (0) -#define clear_inode(i) do { } while (0) - +/* invalidate_inode_buffers, clear_inode are in linux/fs.h */ /* fsverity_cleanup_inode is in linux/fsverity.h */ /* NFS export helpers are now in linux/exportfs.h */ @@ -1458,19 +1431,14 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); /* filemap_release_folio is in linux/pagemap.h */ -/* IS_SWAPFILE - check if inode is a swap file */ -#define IS_SWAPFILE(inode) ({ (void)(inode); 0; }) +/* IS_SWAPFILE is in linux/fs.h */ /* PAGE_MASK - mask for page alignment */ #ifndef PAGE_MASK #define PAGE_MASK (~(PAGE_SIZE - 1)) #endif -/* lock_two_nondirectories - lock two inodes in order */ -#define lock_two_nondirectories(i1, i2) \ - do { (void)(i1); (void)(i2); } while (0) -#define unlock_two_nondirectories(i1, i2) \ - do { (void)(i1); (void)(i2); } while (0) +/* lock_two_nondirectories, unlock_two_nondirectories are in linux/fs.h */ /* * Stubs for resize.c diff --git a/include/linux/fs.h b/include/linux/fs.h index 431dc0c513a..aac88e7c68c 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -314,6 +314,12 @@ enum { /* is_bad_inode - check if inode is marked bad (always false in U-Boot) */ #define is_bad_inode(inode) (0) +/* inode_is_open_for_write - check if inode has open writers (always false) */ +#define inode_is_open_for_write(inode) ({ (void)(inode); 0; }) + +/* inode_is_dirtytime_only - check if inode has only dirty time (always false) */ +#define inode_is_dirtytime_only(inode) ({ (void)(inode); 0; }) + /* Inode state bits for i_state field */ #define I_NEW (1 << 0) #define I_FREEING (1 << 1) @@ -323,6 +329,53 @@ enum { /* Maximum file size for large files */ #define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) +/* + * Inode operation stubs - U-Boot has simplified inode handling + */ +#define icount_read(inode) (1) +#define i_uid_write(inode, uid) do { } while (0) +#define i_gid_write(inode, gid) do { } while (0) +#define inode_fsuid_set(inode, idmap) do { } while (0) +#define inode_init_owner(idmap, i, dir, mode) \ + do { (i)->i_mode = (mode); } while (0) +#define insert_inode_locked(inode) (0) +#define unlock_new_inode(inode) do { } while (0) +#define clear_nlink(inode) do { } while (0) +#define set_nlink(i, n) do { (i)->i_nlink = (n); } while (0) +#define inc_nlink(i) do { (i)->i_nlink++; } while (0) +#define drop_nlink(i) do { (i)->i_nlink--; } while (0) +#define IS_NOQUOTA(inode) (0) +#define IS_SWAPFILE(inode) ({ (void)(inode); 0; }) +#define inode_set_ctime_current(i) ({ (void)(i); (struct timespec64){}; }) +#define inode_set_mtime_to_ts(i, ts) ({ (void)(i); (ts); }) +#define inode_set_flags(i, f, m) do { } while (0) +#define inode_set_cached_link(i, l, len) do { } while (0) +#define init_special_inode(i, m, d) do { } while (0) +#define make_bad_inode(i) do { } while (0) +#define iget_failed(i) do { } while (0) +#define find_inode_by_ino_rcu(sb, ino) ((struct inode *)NULL) +#define mark_inode_dirty(i) do { } while (0) +#define invalidate_inode_buffers(i) do { } while (0) +#define clear_inode(i) do { } while (0) + +/* Inode credential helpers */ +#define i_uid_needs_update(m, a, i) ({ (void)(m); (void)(a); (void)(i); 0; }) +#define i_gid_needs_update(m, a, i) ({ (void)(m); (void)(a); (void)(i); 0; }) +#define i_uid_update(m, a, i) do { } while (0) +#define i_gid_update(m, a, i) do { } while (0) + +/* lock_two_nondirectories - lock two inodes in order */ +#define lock_two_nondirectories(i1, i2) \ + do { (void)(i1); (void)(i2); } while (0) +#define unlock_two_nondirectories(i1, i2) \ + do { (void)(i1); (void)(i2); } while (0) + +/* Inode allocation - implemented in ext4l/stub.c */ +struct kmem_cache; +void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, + gfp_t gfp); +int inode_generic_drop(struct inode *inode); + /** * get_block_t - block mapping callback type * @inode: inode to map blocks for diff --git a/include/linux/writeback.h b/include/linux/writeback.h index e408e3ddebb..8875b099082 100644 --- a/include/linux/writeback.h +++ b/include/linux/writeback.h @@ -46,4 +46,12 @@ static inline xa_mark_t wbc_to_tag(struct writeback_control *wbc) #define try_to_writeback_inodes_sb(sb, reason) \ do { (void)(sb); (void)(reason); } while (0) +/** + * inode_io_list_del() - remove inode from I/O list + * @inode: inode to remove + * + * U-Boot stub - no I/O list management. + */ +#define inode_io_list_del(inode) do { (void)(inode); } while (0) + #endif /* WRITEBACK_H */ From patchwork Tue Jan 20 23:43:33 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1722 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=1768952719; bh=bsdCynDuzCWrT1qAjE1a7F2aSsSmlBEOZlgNlU18xHA=; 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=alN96UKwDr/Z6dz1xrNTmb/TLh4GFiwH7dmIVINoKC7T2ddgZfYe1gehb/PbRKPCd 0O3KTMZLktQQRCLaV389COQYXQo+9nJWewlDrJUbf0nkUZ52ejsYFmYQp51qxnBGbg WDIDkZmlPMsx+shSiMkeiHTWNzG2GhU89C7HtJ4A1oZtwnlyFUjAbmCeBV3eq8Wzdn XV4ISjAJRM0186f7GFKIjTgw1Z9/2no4QUNyWT+SzFWLrLJ0uIJRQjslAh2wn5ufqZ hZsObWvYUWpmsZmAFe2xjOpG6QitSw+JuEpWfpgUSv+JzKxKkne4F3ik87pzAZGYDu w22LjLXR3cWNA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 5872C69597 for ; Tue, 20 Jan 2026 16:45:19 -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 BehyLPgFxlFr for ; Tue, 20 Jan 2026 16:45:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952719; bh=bsdCynDuzCWrT1qAjE1a7F2aSsSmlBEOZlgNlU18xHA=; 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=alN96UKwDr/Z6dz1xrNTmb/TLh4GFiwH7dmIVINoKC7T2ddgZfYe1gehb/PbRKPCd 0O3KTMZLktQQRCLaV389COQYXQo+9nJWewlDrJUbf0nkUZ52ejsYFmYQp51qxnBGbg WDIDkZmlPMsx+shSiMkeiHTWNzG2GhU89C7HtJ4A1oZtwnlyFUjAbmCeBV3eq8Wzdn XV4ISjAJRM0186f7GFKIjTgw1Z9/2no4QUNyWT+SzFWLrLJ0uIJRQjslAh2wn5ufqZ hZsObWvYUWpmsZmAFe2xjOpG6QitSw+JuEpWfpgUSv+JzKxKkne4F3ik87pzAZGYDu w22LjLXR3cWNA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 470C6695AD for ; Tue, 20 Jan 2026 16:45:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952718; bh=Jp3P70XGlOmF5FfMRFBVnYxCjLzqmjScuXHDxBt6iGk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=r8vl98j3//kZNg/e6SUUzCPmrErRbd7FpqJE5DHvoK7lksUobXzkERhvs9Rn/ZS24 5BitXS7o1OO61n3V0meLJ1ieXg6Znm/p/FHQHXOonxYH6J3aUBt48t34+7ZtLtkHhR 1wm15YeSVjGZYerZiQ/LaboevgcoqWLAfVO0K5o6hLmZyfu08Iz4X1x+rg5gKALB0S WdcBdz5h+0CiBWJMYpQYkOIohcbL7kRPVPUtEEemN7tlbHgZ2Q0ySi0qxezQ1qNvJ2 2TKvwSexk5r1rr0jnXFiFJC/oIJArxh0LXevqiH+LQ4MV95kxKD/XLFRVm/uj2po7Y gOUAEn6no0Vcw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3C21369597; Tue, 20 Jan 2026 16:45: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 10026) with ESMTP id WLoP2vU06OMZ; Tue, 20 Jan 2026 16:45:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952710; bh=tK9F53YLDOoqQ1Xo3YbnlEuOiVE/WYr+5YtkzMx+0kI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=YYg4vV1VoaYspsAK8OR357Dh0KKbst8GtIhC1Ilm757xo9f3LmLAGYCE/6U3wzIb8 N1vgkxIdmVOpluzqf/DIRV1OhqAgrlkRmPN2MqGzxgtOwA0tZkBkL45jmJDQcoIyNf jslPVnqN8WB70D2EiPO4AOwXgh2TZqHiEhVTOTYlYmq2cf6PDme9J+RnC8EQuWaI7o YuQWG9/Nulyx5ilUdoGr+4zrSIUovAS4MMYVyLURKDZ4dsBT2aFkpS5f5AOlE/WlOj bnvlwRuGS3pcnLdurmi5prFcMTFznjAO0RmkSX546YgATJ6OIBJq6+oKZzrBwK/PE1 pauQSdOZwb4jA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B5500695AD; Tue, 20 Jan 2026 16:45:09 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:33 -0700 Message-ID: <20260120234344.495605-14-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: RYD2GIIZEM7H6J7FME4IKHDKRJ6L56NM X-Message-ID-Hash: RYD2GIIZEM7H6J7FME4IKHDKRJ6L56NM 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 13/17] ext4l: Move folio operations to proper 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 folio-related definitions to their proper Linux headers: - folio_batch_release() to linux/pagevec.h - Block/buffer folio operations: bh_offset(), block_invalidate_folio(), block_dirty_folio(), block_read_full_folio(), etc. to linux/buffer_head.h - Folio function declarations: __filemap_get_folio(), folio_put(), folio_get(), etc. to linux/pagemap.h - Folio writeback and read stubs to linux/pagemap.h - Writeback control stubs: wbc_init_bio(), wbc_account_cgroup_owner() to linux/pagemap.h Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 49 ++++++------------------------------- include/linux/buffer_head.h | 19 ++++++++++++++ include/linux/pagemap.h | 18 ++++++++++++++ include/linux/pagevec.h | 11 +++++++++ 4 files changed, 56 insertions(+), 41 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 49dd566262b..12250b8daf4 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -690,14 +690,7 @@ struct dx_hash_info { /* address_space_operations is in linux/fs.h */ /* buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio are in linux/buffer_head.h */ /* readahead_control, FGP_*, kmap/kunmap, folio stubs are in linux/pagemap.h */ - -/* Folio operations - implemented in support.c */ -struct folio *__filemap_get_folio(struct address_space *mapping, - pgoff_t index, unsigned int fgp_flags, - gfp_t gfp); -void folio_put(struct folio *folio); -void folio_get(struct folio *folio); -void mapping_clear_folio_cache(struct address_space *mapping); +/* __filemap_get_folio, folio_put, folio_get, mapping_clear_folio_cache are in linux/pagemap.h */ /* projid_t is now in linux/projid.h */ @@ -748,7 +741,7 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* inode_is_open_for_write, inode_is_dirtytime_only are in linux/fs.h */ /* Folio operations and writeback stubs are in linux/pagemap.h */ -#define folio_batch_release(fb) do { } while (0) +/* folio_batch_release is in linux/pagevec.h */ /* Quota stubs are in linux/quotaops.h */ @@ -757,20 +750,8 @@ void mapping_clear_folio_cache(struct address_space *mapping); /* Filemap operations are in linux/pagemap.h */ /* try_to_writeback_inodes_sb is in linux/writeback.h */ -/* Buffer operations - additional */ -/* getblk_unmovable is in linux/buffer_head.h */ -#define create_empty_buffers(f, s, flags) ({ (void)(f); (void)(s); (void)(flags); (struct buffer_head *)NULL; }) -/* bh_offset returns offset of b_data within the folio */ -#define bh_offset(bh) ((bh)->b_folio ? \ - (unsigned long)((char *)(bh)->b_data - (char *)(bh)->b_folio->data) : 0UL) -#define block_invalidate_folio(f, o, l) do { } while (0) -#define block_write_end(pos, len, copied, folio) ({ (void)(pos); (void)(len); (void)(folio); (copied); }) -#define block_dirty_folio(m, f) ({ (void)(m); (void)(f); false; }) -#define try_to_free_buffers(f) ({ (void)(f); true; }) -#define block_commit_write(f, f2, t) do { } while (0) -#define block_page_mkwrite(v, f, g) ((vm_fault_t)0) -#define map_bh(bh, sb, block) do { } while (0) -#define write_begin_get_folio(iocb, m, idx, l) ({ (void)(iocb); (void)(m); (void)(idx); (void)(l); (struct folio *)NULL; }) +/* Buffer/block folio operations are in linux/buffer_head.h */ +/* write_begin_get_folio is in linux/pagemap.h */ /* fscrypt_name, fscrypt_match_name, and fscrypt stubs are in ext4_fscrypt.h */ @@ -1283,17 +1264,8 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* fscrypt page-io stubs are in ext4_fscrypt.h */ -/* folio writeback operations */ -#define folio_end_writeback(f) do { (void)(f); } while (0) -#define folio_start_writeback(f) do { (void)(f); } while (0) -#define folio_start_writeback_keepwrite(f) do { (void)(f); } while (0) -bool __folio_start_writeback(struct folio *folio, bool keep_write); - -/* writeback control stubs */ -#define wbc_init_bio(wbc, bio) do { (void)(wbc); (void)(bio); } while (0) -#define wbc_account_cgroup_owner(wbc, folio, bytes) \ - do { (void)(wbc); (void)(folio); (void)(bytes); } while (0) - +/* folio writeback operations are in linux/pagemap.h */ +/* writeback control stubs are in linux/pagemap.h */ /* bio_add_folio is in linux/bio.h */ /* @@ -1303,10 +1275,7 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); /* mempool is now in linux/mempool.h */ #include -/* folio read operations */ -#define folio_end_read(f, success) do { (void)(f); (void)(success); } while (0) -#define folio_set_mappedtodisk(f) do { (void)(f); } while (0) - +/* folio read operations are in linux/pagemap.h */ /* fscrypt readpage stubs are in ext4_fscrypt.h */ /* fsverity stubs are in linux/fsverity.h */ @@ -1316,9 +1285,7 @@ bool __folio_start_writeback(struct folio *folio, bool keep_write); /* prefetch operations */ #define prefetchw(addr) do { (void)(addr); } while (0) -/* block read operations */ -#define block_read_full_folio(folio, get_block) \ - ({ (void)(folio); (void)(get_block); 0; }) +/* block_read_full_folio is in linux/buffer_head.h */ /* * Stubs for fast_commit.c diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 3e5893ab99d..ea317a6488d 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -268,4 +268,23 @@ static inline void end_buffer_read_sync(struct buffer_head *bh, int uptodate) #define __find_get_block_nonatomic(bdev, block, size) \ ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) +/* + * Block/buffer folio operations - U-Boot stubs + */ +#define create_empty_buffers(f, s, flags) \ + ({ (void)(f); (void)(s); (void)(flags); (struct buffer_head *)NULL; }) +/* bh_offset returns offset of b_data within the folio */ +#define bh_offset(bh) ((bh)->b_folio ? \ + (unsigned long)((char *)(bh)->b_data - (char *)(bh)->b_folio->data) : 0UL) +#define block_invalidate_folio(f, o, l) do { } while (0) +#define block_write_end(pos, len, copied, folio) \ + ({ (void)(pos); (void)(len); (void)(folio); (copied); }) +#define block_dirty_folio(m, f) ({ (void)(m); (void)(f); false; }) +#define try_to_free_buffers(f) ({ (void)(f); true; }) +#define block_commit_write(f, f2, t) do { } while (0) +#define block_page_mkwrite(v, f, g) ((vm_fault_t)0) +#define map_bh(bh, sb, block) do { } while (0) +#define block_read_full_folio(folio, get_block) \ + ({ (void)(folio); (void)(get_block); 0; }) + #endif /* _LINUX_BUFFER_HEAD_H */ diff --git a/include/linux/pagemap.h b/include/linux/pagemap.h index 19a64993955..eb689fa885f 100644 --- a/include/linux/pagemap.h +++ b/include/linux/pagemap.h @@ -94,11 +94,29 @@ struct folio { #define folio_end_writeback(f) do { (void)(f); } while (0) #define folio_start_writeback(f) do { (void)(f); } while (0) #define folio_start_writeback_keepwrite(f) do { (void)(f); } while (0) +bool __folio_start_writeback(struct folio *folio, bool keep_write); #define folio_end_read(f, success) do { (void)(f); (void)(success); } while (0) #define folio_set_mappedtodisk(f) do { (void)(f); } while (0) #define folio_redirty_for_writepage(wbc, folio) \ ({ (void)(wbc); (void)(folio); false; }) +/* Folio operations - implemented in ext4l/support.c */ +struct folio *__filemap_get_folio(struct address_space *mapping, + pgoff_t index, unsigned int fgp_flags, + gfp_t gfp); +void folio_put(struct folio *folio); +void folio_get(struct folio *folio); +void mapping_clear_folio_cache(struct address_space *mapping); + +/* Writeback control stubs */ +#define wbc_init_bio(wbc, bio) do { (void)(wbc); (void)(bio); } while (0) +#define wbc_account_cgroup_owner(wbc, folio, bytes) \ + do { (void)(wbc); (void)(folio); (void)(bytes); } while (0) + +/* Write begin helper */ +#define write_begin_get_folio(iocb, m, idx, l) \ + ({ (void)(iocb); (void)(m); (void)(idx); (void)(l); (struct folio *)NULL; }) + /* * offset_in_folio - calculate offset of pointer within folio's data * diff --git a/include/linux/pagevec.h b/include/linux/pagevec.h index b794ff8f47c..b83a8420b3d 100644 --- a/include/linux/pagevec.h +++ b/include/linux/pagevec.h @@ -43,4 +43,15 @@ static inline unsigned int folio_batch_add(struct folio_batch *fbatch, return PAGEVEC_SIZE - fbatch->nr; } +/** + * folio_batch_release() - release a batch of folios + * @fbatch: batch to release + * + * U-Boot stub - no-op. + */ +static inline void folio_batch_release(struct folio_batch *fbatch) +{ + (void)fbatch; +} + #endif /* _LINUX_PAGEVEC_H */ From patchwork Tue Jan 20 23:43:34 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1723 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=1768952720; bh=d1Xubs+js05yJMxgZjadzoh9qJDcIObJ5DCDnqK47BQ=; 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=KB/VFg1KB0JixphsUHLTR9vql/Mw2YPvZaGHCAezyshKjFaXqOmCJkj21ZZ3U0YsH IxgbItI1ad00TdIzBiQ3evftE05+jBWGHwLydK1WDId7p3nQlE8JBweehBlCcGgbux VP5EXaRBxFUPBKW+XpD/T2YSPAnvIac6EtSueBrv5/ZmXRX3bowycA/jnp5E6gBy/F xjHDd0tPIUqRwsoS6cxWxy9bZdMLBGm9CVf1M4ZPQvLo9buHm2FrXA2ctLaMfQFo9o /5mTvEzihyEqognF6PifSmQaxacaChZn+o2x8uU3+7cDxLYtisCGtkRFry1ukbBg+T lg8dlEw76qzUQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 372DB69597 for ; Tue, 20 Jan 2026 16:45:20 -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 V5jtxaccf6TY for ; Tue, 20 Jan 2026 16:45:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952720; bh=d1Xubs+js05yJMxgZjadzoh9qJDcIObJ5DCDnqK47BQ=; 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=KB/VFg1KB0JixphsUHLTR9vql/Mw2YPvZaGHCAezyshKjFaXqOmCJkj21ZZ3U0YsH IxgbItI1ad00TdIzBiQ3evftE05+jBWGHwLydK1WDId7p3nQlE8JBweehBlCcGgbux VP5EXaRBxFUPBKW+XpD/T2YSPAnvIac6EtSueBrv5/ZmXRX3bowycA/jnp5E6gBy/F xjHDd0tPIUqRwsoS6cxWxy9bZdMLBGm9CVf1M4ZPQvLo9buHm2FrXA2ctLaMfQFo9o /5mTvEzihyEqognF6PifSmQaxacaChZn+o2x8uU3+7cDxLYtisCGtkRFry1ukbBg+T lg8dlEw76qzUQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 206A4695B2 for ; Tue, 20 Jan 2026 16:45:20 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952718; bh=ReUcHMt/jZtz8QwPixh79a3vOi5eyQmVRVTflN7uWKo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bhElviS+7lvX5lhNorGnvObQTs6LeO6nsKjS1wnK4NA9Y8Shhz1sOBqPllaPFGxlK +SGolUnRq/IaYFepnYyGbQJEeJauKO/LHUNT+bxyyQb1otkfWh6caUR93V2WOgKKVM lOVeVdGXi5Jd/MnKGJqGT8mYNdTS7H6Y+Cp139ePhgQvWNIVf+GplA5xTXGP3XbAkC /Mla/OYsvxZTZRJ5euSAJgLwRHbcJvJASNMoWtfY/GtqsZGZtECPeVChnqrOKIYojg OmSWNMZJ6GGi3PWd4ChSS2A1tTUbQVjNtyVHPiTQp9XdNWz6OImSTsefEsHVvrq6fc KCColPXIsCZlA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B3AC9695A6; Tue, 20 Jan 2026 16:45: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 10026) with ESMTP id XvrNnVfCz8cy; Tue, 20 Jan 2026 16:45:18 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952714; bh=nGLf8KWTgWcJ9OxtPvDxpeKonm9wOowM/aCEiCXap4I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=S2LCNc4hFC0Sr5Af+J0Wggz02lAKJhNfcFf5bt9fojafLYJNvWC5J4r/TEDAiRywU G2FfDeUnt6miIbdgC9LgEfzDy9wMCow6vr0DVo8bEgdEfHhL7AiIYbV3JiOMqlioAs +NIObZtwvIvFZ41gQJPbrkZED8msHDPV47aaI6mahi3AnmVNUM2AX7dg+NNNL3Lppn VdkGj1JHAd0Jhg3UYokR1umAog1Nl/hXtL5BrXP3ipIQ0a1rPFDLZxCKis7A+hP9Ay lgjnGfwbJGD1iW5tIdkO/8CgvBhZqQ6AESUe2aw+od1izxTCedWbIovWnlITgPf+lk pi2gmIMb3H1Rg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 62E1469555; Tue, 20 Jan 2026 16:45:14 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:34 -0700 Message-ID: <20260120234344.495605-15-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: B7LVOXLA3VYGZUU3ROXMOW7JCQZ5YOYE X-Message-ID-Hash: B7LVOXLA3VYGZUU3ROXMOW7JCQZ5YOYE 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 14/17] ext4l: Move super_operations to linux/fs/super_types.h 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 struct super_operations to linux/fs/super_types.h where the Linux kernel defines it, alongside struct super_block. Add forward declarations for the types used by super_operations members. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 21 +-------------------- include/linux/fs/super_types.h | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 20 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 12250b8daf4..1ac7b63819a 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -954,26 +954,7 @@ static u64 __attribute__((unused)) __ext4_sectors[2]; struct kstatfs; struct fid; -/* super_operations - for VFS */ -struct super_operations { - struct inode *(*alloc_inode)(struct super_block *); - void (*free_inode)(struct inode *); - void (*destroy_inode)(struct inode *); - int (*write_inode)(struct inode *, struct writeback_control *); - void (*dirty_inode)(struct inode *, int); - int (*drop_inode)(struct inode *); - void (*evict_inode)(struct inode *); - void (*put_super)(struct super_block *); - int (*sync_fs)(struct super_block *, int); - int (*freeze_fs)(struct super_block *); - int (*unfreeze_fs)(struct super_block *); - int (*statfs)(struct dentry *, struct kstatfs *); - int (*show_options)(struct seq_file *, struct dentry *); - void (*shutdown)(struct super_block *); - ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); - ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, loff_t); - struct dentry *(*get_dquots)(struct inode *); -}; +/* super_operations is in linux/fs/super_types.h */ /* export_operations and fid - use linux/exportfs.h */ #include diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h index f3ed772ef40..67e02a04bfb 100644 --- a/include/linux/fs/super_types.h +++ b/include/linux/fs/super_types.h @@ -20,6 +20,10 @@ struct file_system_type; struct super_operations; struct export_operations; struct xattr_handler; +struct inode; +struct writeback_control; +struct kstatfs; +struct seq_file; /* sb_writers stub */ struct sb_writers { @@ -54,6 +58,28 @@ struct super_block { struct list_head s_inodes; }; +/* super_operations - VFS superblock operations */ +struct super_operations { + struct inode *(*alloc_inode)(struct super_block *); + void (*free_inode)(struct inode *); + void (*destroy_inode)(struct inode *); + int (*write_inode)(struct inode *, struct writeback_control *); + void (*dirty_inode)(struct inode *, int); + int (*drop_inode)(struct inode *); + void (*evict_inode)(struct inode *); + void (*put_super)(struct super_block *); + int (*sync_fs)(struct super_block *, int); + int (*freeze_fs)(struct super_block *); + int (*unfreeze_fs)(struct super_block *); + int (*statfs)(struct dentry *, struct kstatfs *); + int (*show_options)(struct seq_file *, struct dentry *); + void (*shutdown)(struct super_block *); + ssize_t (*quota_read)(struct super_block *, int, char *, size_t, loff_t); + ssize_t (*quota_write)(struct super_block *, int, const char *, size_t, + loff_t); + struct dentry *(*get_dquots)(struct inode *); +}; + /* Superblock flags - also defined in linux/fs.h */ #ifndef SB_RDONLY #define SB_RDONLY (1 << 0) /* Read-only mount */ From patchwork Tue Jan 20 23:43:35 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1724 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=1768952724; bh=w22o4FLZZE64vxlzrOgWuEYJ58ivE5qP6sOgKu7JNig=; 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=UdEMTN+nl7LcopcLKgbYUjMg4Om85+gFSIPCgVU5w9gle37Aaz+vB0J+jloXI27PD IAyhgX3c1izIvXfZ0thgzTW/5mxF+QaxM8Z7a0lDiGyoN9FewilIE5meVGzCrYfpMb EwSmwVPWSvPK/gYsgUxyWtat8nr04M5BGU+IOaf3HJyWyQzApFLNYwfSjslLs1PtwV 4boreuFlsIOZKFRb3S/JAJAq8/QY4InQbSnQzUZv90Dv4bg7jeJNvdFA6wk1rcGhF3 L20XyPZ4D+t7t9RDO3f4lO4uP5uHOdLxeYgSyPNFCzOD9klBX17wENB9XdgQ+H/k6L vPBCRF+PbUuuQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A2FB069555 for ; Tue, 20 Jan 2026 16:45:24 -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 CprufIxd2dNK for ; Tue, 20 Jan 2026 16:45:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952724; bh=w22o4FLZZE64vxlzrOgWuEYJ58ivE5qP6sOgKu7JNig=; 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=UdEMTN+nl7LcopcLKgbYUjMg4Om85+gFSIPCgVU5w9gle37Aaz+vB0J+jloXI27PD IAyhgX3c1izIvXfZ0thgzTW/5mxF+QaxM8Z7a0lDiGyoN9FewilIE5meVGzCrYfpMb EwSmwVPWSvPK/gYsgUxyWtat8nr04M5BGU+IOaf3HJyWyQzApFLNYwfSjslLs1PtwV 4boreuFlsIOZKFRb3S/JAJAq8/QY4InQbSnQzUZv90Dv4bg7jeJNvdFA6wk1rcGhF3 L20XyPZ4D+t7t9RDO3f4lO4uP5uHOdLxeYgSyPNFCzOD9klBX17wENB9XdgQ+H/k6L vPBCRF+PbUuuQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8F41B695AD for ; Tue, 20 Jan 2026 16:45:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952723; bh=Rj1CcwrH8XTEUYhPN3L8+q4p+ibe8y37dg/CflkMEd4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=nq09m9vKoqsRZenJ1w7nTlS30dL/Q69eELW+sW6coa+w436DFUNGF51TKbTIy6c4e 4yXDBrcyBEWJgGRmSvUKRhtQpQpE5IIxIFHiLP4Y8vb3P+UghDJhmtf1BhncxvqeXT 8Cd3cfqzXR+nNVtZs9tgayoofCZ+ttWAfUwTSEBXnwdGHO3knYm+bqEtfhrblRAfE2 PXcGFiA3k42B9nHrYE8o6gD7tZQjAVH7m9Ep7n7+YhS9hDtNETXOd39GLh3oNedy/G WC44YFXkK9eqgJv8oxYW70JL+j9W8TVKpmRwZT9PHcvtaoZSWEg/iWK0nvtcjCrEuP PKQIwnebcxfYw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 559CF69597; Tue, 20 Jan 2026 16:45:23 -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 t5O00W7bUyPt; Tue, 20 Jan 2026 16:45:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952719; bh=B9a4PgojkTZJQq+B/4CLucmpol2n31u/9M4c+3ASO7M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=C/u1AwHiEyNKjOwcFO//5bLZBIK3CL7P4M/qz2FcRE5isbq+akSxZ9/I5mkeqAH6B yqkNfi0hyqUYhPVMBULZ4shxrlTCs48wF9sw+WoazS2GUy7Ub6Z42t3numrHyQ7e5V 0Dyvpp/vK2R2jNwUbYuVoF0noF4JZGIEyr8h92UlGomqA6YcjHie37pWXWJETC2nEO fcCfdMMftRwq9wREJLbqmEyDpT2fSqjfNrl4C0ZSsLa+3fyjGYGdfB26l/fTB/7Ar2 Or6sbKEBmIeLRSKwqurQnD41sNGSQyHQi6KahSzyMwgSW4eC5QNxjwzoRMxUEepi74 YJcaPa0rGayPA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 0677F69555; Tue, 20 Jan 2026 16:45:18 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:35 -0700 Message-ID: <20260120234344.495605-16-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: FYKT3PSNZKDIHIDT77RSU5L3NJWQRXTD X-Message-ID-Hash: FYKT3PSNZKDIHIDT77RSU5L3NJWQRXTD 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/17] ext4l: Move lock and scheduler stubs to proper 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 mutex_lock_io() to linux/mutex.h where the Linux kernel defines it. Move spin_needbreak() to linux/spinlock.h where the Linux kernel defines it. Move cond_resched_lock() to linux/sched.h where the Linux kernel defines it. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 3 +-- include/linux/mutex.h | 1 + include/linux/sched.h | 1 + include/linux/spinlock.h | 3 +++ 4 files changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1ac7b63819a..5ab32cba969 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1320,8 +1320,7 @@ struct disk_partition *ext4l_get_partition(void); /* DEFINE_WAIT stub - creates a wait queue entry */ #define DEFINE_WAIT(name) int name = 0 -/* cond_resched_lock - conditionally reschedule while holding a lock */ -#define cond_resched_lock(lock) do { (void)(lock); } while (0) +/* cond_resched_lock is in linux/sched.h */ /* JBD2 journal.c stubs */ /* alloc_buffer_head, __getblk are in linux/buffer_head.h */ diff --git a/include/linux/mutex.h b/include/linux/mutex.h index b13d85ef4e9..2246feaf261 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -25,6 +25,7 @@ struct mutex { #define mutex_trylock(lock) ({ 1; }) #define mutex_is_locked(lock) ({ 0; }) #define mutex_destroy(lock) do { } while (0) +#define mutex_lock_io(lock) mutex_lock(lock) #define __MUTEX_INITIALIZER(lockname) { .locked = 0 } diff --git a/include/linux/sched.h b/include/linux/sched.h index 579468ee414..9dca8f89f79 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -35,6 +35,7 @@ extern struct task_struct *current; #define TASK_UNINTERRUPTIBLE 2 #define cond_resched() do { } while (0) +#define cond_resched_lock(lock) do { (void)(lock); } while (0) #define yield() do { } while (0) /* Note: schedule() is implemented in common/cyclic.c */ diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 75afad92b9e..09fe285dfed 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -78,6 +78,9 @@ typedef struct { /* Assert variants */ #define assert_spin_locked(lock) do { } while (0) +/* spin_needbreak - check if lock should be released (always false in U-Boot) */ +#define spin_needbreak(lock) ({ (void)(lock); 0; }) + /* Read-write lock type - just an int for U-Boot */ typedef int rwlock_t; From patchwork Tue Jan 20 23:43:36 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1725 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=1768952727; bh=5YRzoP5r9N/Fyt1dktPmnTIqK7iv+X79TbGy1O13s04=; 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=fKDOOgNAffJP+W8ttVuKU95DyoAFtQyYELCbscdETjjETO/7LeKDn4kxbA/EalsCK 3xaY26Kp2If0CitneaF2sCyTzSVz844xk4iM6uJr2hZAkYFZu4CqZzSwSDNKTriXlV NzozkQ/rjf/dLXSzrA5etn5plBbGRx14DkGWp2j6W3zVYN85ESSGf+AuU8LpvC29z1 kLn2kGWLgOvA4+vK1JQEbojW+E6nKg512EeBTOOs0d3b899CtbHGmO2fv0nD/Tikmp eNir+F/Yw40MmrjzHUsf6JxV4sfp94QVh4mG77yUEyHT4VVb05qPffAICXxQaVMa7U 3qOTXI42RpQ/Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 26F10695A6 for ; Tue, 20 Jan 2026 16:45:27 -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 psQUu0ZBtp4T for ; Tue, 20 Jan 2026 16:45:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952725; bh=5YRzoP5r9N/Fyt1dktPmnTIqK7iv+X79TbGy1O13s04=; 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=oWEiDBxPAk9aCf3QAg6w8iI4GCp5bzI//9BnScU8sE3RebS2yXiAtKmLQS2pm/z4k bONldlb4KBAd8qguhlVQJI9tZdguMP4fHp10BJxhdoTvBj9VNKJO63khnigpfUC/hA N6ibmks/00hjDvsxoAOc67LGUk3ZrRpsFq5WLGPtifZSCyLRZzEm1kG2T4XGQSPfEw GscUC/dP9cnVq01SiGaJ4ZQCLOGiHoj/Z/dD7W+qS1j+i86tsPtoSDcdKsBnBa6xde q7GSjSx/F4xSett8XTwb6Qod+F6tngIN/nPUQQjzRRH8jD/Y2kYSs0TC0NY9smHDbF Zx5KE23ShShPw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1298E69597 for ; Tue, 20 Jan 2026 16:45:25 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952724; bh=1xSYUFnpb4GXNzjhNqGj8vKznO/DXnC2utl0FKg0Nfs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VuZIV1alZj+GdZE7umsJJL4eFfWMk/A7Eg2n1Y7I6ih9ufNkgqBBWblR96an9/S6C wlRRcaTI0fbmg9wk0iyT1Xqo/o21qNBcFupQRQGERsFXemlmt9pmImhdMddjM6Pb8n Uvk7iIho1fc7uUU5QvorEWMxF4ZlubZMhY35i9zDJ//tVGHruTGfC0gl6pcD/51SoF +XYa1TVSgibH1tF46+HZ4liULbAvufq9cmrDOTazcGaoUWVPzY6VvrxnbylsThABPo g8Cp7yUuxgc5REyxMQabVBLKn+QPUJEfGKWSnIVentW68f/iLNINRh7d1UYRUORcul zig9ev7imBhzA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3CC4869597; Tue, 20 Jan 2026 16:45:24 -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 4vsqlrM-Mso7; Tue, 20 Jan 2026 16:45:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952723; bh=Eu2jdpaisBKmNxp22bskfYpxcLS2lGvKCbQYs2gUrt4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bIw0vdAcSzwV82is44YgsU7PyzhBlqlHiANbpm2MK2KiUcOjc55dT7A2XFS9z4h+n xr6XX9OqOGXkm7QdzwqUhZnEKgV+uzIVUUO67ojazrAahjiu6HOjXIA7DI3LlZBumL pSueP1dUkNoXc+99tX9yrUdX2JG/uOB7YekPxRpytEmqEDwo5DLoXVeYz+mxeBeQpq GFuPAxQ5tuf3yUCywXye+2lHFFh3G15KR7phMytznjNX3XgjFsuo6QeX21JaCv8YvN aEnWWhzUp9WBBGGgryLDZLxZcCNbNjCUiyDHdiQtJwfGsiYUCs059ZUeA3CLBXGYtg fcxq/3iczOSYA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9A7A469555; Tue, 20 Jan 2026 16:45:23 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:36 -0700 Message-ID: <20260120234344.495605-17-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: IAB3IJ3SIVC6OHSSRRVGOSIHXMQ5IVSY X-Message-ID-Hash: IAB3IJ3SIVC6OHSSRRVGOSIHXMQ5IVSY 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 16/17] ext4l: Move lock bit operations to asm-generic/bitops/lock.h 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 Create asm-generic/bitops/lock.h with clear_bit_unlock() and test_and_set_bit_lock() stubs, matching the Linux kernel's location. Move write_trylock() to linux/spinlock.h where the Linux kernel defines it. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 9 ++++----- include/asm-generic/bitops/lock.h | 30 ++++++++++++++++++++++++++++++ include/linux/spinlock.h | 1 + 3 files changed, 35 insertions(+), 5 deletions(-) create mode 100644 include/asm-generic/bitops/lock.h diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5ab32cba969..7d1704945a3 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -669,8 +669,7 @@ struct dx_hash_info { /* hrtimer - use linux/hrtimer.h */ #include -/* write lock variants */ -#define write_trylock(lock) ({ (void)(lock); 1; }) +/* write_trylock is in linux/spinlock.h */ /* percpu_counter_init/destroy are in linux/percpu_counter.h */ @@ -1291,7 +1290,8 @@ struct buffer_head *__bread(struct block_device *bdev, sector_t block, unsigned /* spin_needbreak is in linux/spinlock.h */ /* JBD2 commit.c stubs (folio_trylock is in linux/pagemap.h) */ -#define clear_bit_unlock(nr, addr) clear_bit(nr, addr) +/* clear_bit_unlock is in asm-generic/bitops/lock.h */ +#include /* 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 filemap_fdatawait_range_keep_errors(m, s, e) \ @@ -1391,8 +1391,7 @@ loff_t seq_lseek(struct file *f, loff_t o, int w); * Stubs for resize.c */ -/* test_and_set_bit_lock - test and set a bit atomically */ -#define test_and_set_bit_lock(nr, addr) test_and_set_bit(nr, addr) +/* test_and_set_bit_lock is in asm-generic/bitops/lock.h */ /* time_is_before_jiffies - check if time is before current jiffies */ #define time_is_before_jiffies(a) ({ (void)(a); 0; }) diff --git a/include/asm-generic/bitops/lock.h b/include/asm-generic/bitops/lock.h new file mode 100644 index 00000000000..34fe437b1f1 --- /dev/null +++ b/include/asm-generic/bitops/lock.h @@ -0,0 +1,30 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * Locking bit operations + * + * U-Boot stub - single-threaded, no actual locking needed. + */ +#ifndef _ASM_GENERIC_BITOPS_LOCK_H +#define _ASM_GENERIC_BITOPS_LOCK_H + +#include + +/** + * clear_bit_unlock - clear a bit with release semantics + * @nr: bit number to clear + * @addr: address of the bitmap + * + * U-Boot stub - just calls clear_bit() since we're single-threaded. + */ +#define clear_bit_unlock(nr, addr) clear_bit(nr, addr) + +/** + * test_and_set_bit_lock - test and set a bit with acquire semantics + * @nr: bit number to test and set + * @addr: address of the bitmap + * + * U-Boot stub - just calls test_and_set_bit() since we're single-threaded. + */ +#define test_and_set_bit_lock(nr, addr) test_and_set_bit(nr, addr) + +#endif /* _ASM_GENERIC_BITOPS_LOCK_H */ diff --git a/include/linux/spinlock.h b/include/linux/spinlock.h index 09fe285dfed..d938cd69d2b 100644 --- a/include/linux/spinlock.h +++ b/include/linux/spinlock.h @@ -101,5 +101,6 @@ typedef int rwlock_t; #define read_unlock_irqrestore(lock, flags) do { (void)(flags); } while (0) #define write_lock_irqsave(lock, flags) do { (void)(flags); } while (0) #define write_unlock_irqrestore(lock, flags) do { (void)(flags); } while (0) +#define write_trylock(lock) ({ (void)(lock); 1; }) #endif /* __LINUX_SPINLOCK_H */ From patchwork Tue Jan 20 23:43:37 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1726 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=1768952729; bh=dt0Sesj2eOJonjeJkG/W9GGdh7KCaiDxnGd+jdO+zNE=; 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=r7+JHhZ6BNDKVYBGj1diZabo5kGbA/kbnz+HDGZEqVnYWfDp6jmXEVsfk6tnCQAI7 4lm3dFws+R/2R1EiC3Ukexb/ZliZsdHKY3tBX69WU6Cvz8npv/KXilmPJ9CZVtYRh1 XACuRrjiC7YwijsSxv9py1pIy/vUtdJBN9cD2KeWeo5NHVUgGJYYlyRv5pWah+aVVt NRK6bfdVSO5vqktpJgwKEsRpKRK2QJM1+Z8SUwI+BAsdTN9MkqlO96PWrNv1Kasjgk DOlXL3jw0HQXcnVcHluagIkWvDVP9xj1u1i/7Q7E42FrD6qkvE+uwZgnIAVDHYUDNt Qd6s1XnikijKw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 61809695B7 for ; Tue, 20 Jan 2026 16:45:29 -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 UfGLGJPT2cwk for ; Tue, 20 Jan 2026 16:45:29 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952728; bh=dt0Sesj2eOJonjeJkG/W9GGdh7KCaiDxnGd+jdO+zNE=; 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=CnkeSPbPdQonXsNfh0b4o9z8ZS5GiNnouNBqbXvq9aF0pmEY9zuYsrjhvAvP1BwAx av4jwDlst4GQnAhUHrcf5w+jya7o/gyzAxzofTAijjmXHRDP5rVbdx1gbC6utC/Gv2 UV4jNCbFhottosfs1u4+bMC+SlU9N4JgIV0VxP3AoiZ+oYxpDCD+OQNEA4aoNIzbQh oRn66/CPOxpFtb9Nrj3VkVhcDsJUGMrlBgB+ipuA7U5cffVcJ4mvQM8BjEkXTtqN0p V6lPHOTFeOB2q7eTnzVUmnFAj/CXgcDs1UpjCjc4PUFnpSvXPyQkwD2Wt/3OQIFxoV aCaHa37KhIGDw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D092C69597 for ; Tue, 20 Jan 2026 16:45:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952727; bh=CYU3GxAgIq1Uq5sab53HX1H3c3jlf2MlmOzE/O67HNM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gXWMcwbDayfIope5tfvYjwEJVYFPdNl1pxc5jWkhCdO6C2kxN6jo/EQFynk/B7p28 /pjjmkuvXQy9NCcexljFj7xlRgShSZOm1w3J68i4Nrd5g02doCdR2+tVO51qmJzTU7 Wbuiq1zTntA6+MAiW5rvUO9hJuW7mHpaWFZRZ9LwkL+Chs1nOR38KQZrT0bIwvOFXX n5T7Gr53iAVdeccg+biNMDcMPVV0/KzyL7HBYw+OY71smPWyAWsjs7UeibEWpRN2Ft aCqwTzEVZAsbp/OzTYmOjWahuskWhat1b5wupN6XqiYgwuCN7h4N5XXw38uiiQugzk 8NwOqVJUWxU9w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 132DC695B5; Tue, 20 Jan 2026 16:45:27 -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 AwOs6_GjyiGL; Tue, 20 Jan 2026 16:45:27 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768952724; bh=zbfSG3/YCyDYmSFMUnx77FgqYFZeCgazDBnTAK0gxq0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H15LiPQ7lPxJ/b6pFW1vphR0FkG3iiHxI55aMLxbNsFMm4I6YuR2uIFBpDeAEn2LT bX6yWXSfyzrZ6SoO/pTjzVkTbrH72KLtuEWuKLAKtMKeIy2G3+/NTV5KQ28mr073js 3a1rkO91NfaOUijCEuQkYmAxUOaRz+/6JpFzWoNs1sZg+hZCR9hs5JAhjkote9X7PS OhBfQMJh3dY2ZHLkTkvpcFZ6a2cSZzB94vyYL7KKIXRJIAqz/RbdryFqGdirXY6nWg 0zjNK1C6YvKByM0wC+8ZqHcpgdYNaOEPqzvbBnecMo9VCbZa2mUZAQh5msQ4XARxiy Pz4FErtRxDvJA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 80F4C695A6; Tue, 20 Jan 2026 16:45:24 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Tue, 20 Jan 2026 16:43:37 -0700 Message-ID: <20260120234344.495605-18-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: JRRM6BCQ7CICZVX5T47MRNV3MHXWXY3W X-Message-ID-Hash: JRRM6BCQ7CICZVX5T47MRNV3MHXWXY3W 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 17/17] ext4l: Move superblock write stubs to linux/fs/super_types.h 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 sb_start_write(), sb_end_write(), and sb_start_write_trylock() to linux/fs/super_types.h alongside the other superblock definitions. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 5 +---- include/linux/fs/super_types.h | 7 +++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 7d1704945a3..2f73325e521 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1086,10 +1086,7 @@ void *kvzalloc(size_t size, gfp_t flags); /* Time operations - ktime_get_ns is in linux/ktime.h */ /* nsecs_to_jiffies is in linux/jiffies.h */ -/* 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) +/* sb_start_write, sb_end_write are in linux/fs/super_types.h */ /* schedule_timeout_interruptible is in linux/sched.h */ diff --git a/include/linux/fs/super_types.h b/include/linux/fs/super_types.h index 67e02a04bfb..c575d268c43 100644 --- a/include/linux/fs/super_types.h +++ b/include/linux/fs/super_types.h @@ -91,4 +91,11 @@ static inline bool sb_rdonly(const struct super_block *sb) return sb->s_flags & SB_RDONLY; } +/* + * Superblock write operations - U-Boot is single-threaded, no locking needed + */ +#define sb_start_write(sb) do { (void)(sb); } while (0) +#define sb_end_write(sb) do { (void)(sb); } while (0) +#define sb_start_write_trylock(sb) ({ (void)(sb); 1; }) + #endif /* _LINUX_FS_SUPER_TYPES_H */