From patchwork Sat Dec 20 23:23:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 995 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=1766273052; bh=3HW0ASUi94oIB769QOsV61yygAE9IrXcHDT7l1utjgg=; 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=jOaQJwxOECQs9ra+COuWZf1XFcZsiXXMxjGpZI8JFGGKv6YogeaaQeQO4P8IBXI7e n4U6KUC2kBt57dMTffNXTHBcb/xDtO9gFX9/JRjLbwL9P2xwRHeZqkAic7mgAM2tvG TjbQpZyx4V7f/eMO5+2eHSZGOYhADYbRtUDDyDQesaf0tOvP1Okuo3WyDOglEtKyM1 eByufqAUafyHNmwdjmOUyx+q7grWPzpcV3w1NaoeTI693lbUuMP03m7lpBvcL/1fFU a53MFiJpNCz3M4seRP0E/4/xpBLP8P+X8YT/iQifyvT7WfxNTrdySYsMbU97F/NsUB im3tmRqf9p9/g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 541F064C8E for ; Sat, 20 Dec 2025 16:24:12 -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 l28LDdOxDo19 for ; Sat, 20 Dec 2025 16:24:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273052; bh=3HW0ASUi94oIB769QOsV61yygAE9IrXcHDT7l1utjgg=; 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=jOaQJwxOECQs9ra+COuWZf1XFcZsiXXMxjGpZI8JFGGKv6YogeaaQeQO4P8IBXI7e n4U6KUC2kBt57dMTffNXTHBcb/xDtO9gFX9/JRjLbwL9P2xwRHeZqkAic7mgAM2tvG TjbQpZyx4V7f/eMO5+2eHSZGOYhADYbRtUDDyDQesaf0tOvP1Okuo3WyDOglEtKyM1 eByufqAUafyHNmwdjmOUyx+q7grWPzpcV3w1NaoeTI693lbUuMP03m7lpBvcL/1fFU a53MFiJpNCz3M4seRP0E/4/xpBLP8P+X8YT/iQifyvT7WfxNTrdySYsMbU97F/NsUB im3tmRqf9p9/g== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3D6BB64C29 for ; Sat, 20 Dec 2025 16:24:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273049; bh=2YR5YUUysaYuc8rypoFCzV7Ze5x8iptCGOhcXypL/mk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jtqRn1S93lLMK+WDoNe0A18ZjqcYb6w7728m1FiOXxiOZMQd4LjOX/p3DovK35xyP UzcjSMTw+t0FYmwvZf+bTo/ystaJBwF4deosSCrH4TeArn1R52cw26obkKI11Hx4Gs Ktd8YNhyX1S6oeKICwbIrM6lr5p6i72nEA+qeazeUrQUjCtZG/37EbkPT3SxXaYE5h YjxgomsCd5n9l11I1ev76q37hCUeuZIzfG9oqhGTqu2TiFULWypVlBFSKB8n5xZq8O pplC3BX9N3RV+lrfoBrj6GeNsHVoOvlfjYdR6JFJMbzCDXswlSWzNG5zxNE6qoz0QL P9Zwj1iWcIP8g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id E16D564C56; Sat, 20 Dec 2025 16:24:09 -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 0bngALKqWrIO; Sat, 20 Dec 2025 16:24:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273049; bh=5UUDcbVCIjeXxDjAyB5T8EVZZvaeKprMWbsyNr5c6sk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XJuJ9X5AbG0LCMUVHuKiQItWkkjTVl3CCdBqFIqYdjZbkHxUTyzYlxV37Auhf4qNj gZhSSEpIj6oZHa9ek6C07ptIsrPs7watELIZn2UXbfITYGny5wywZDkvnwfFrJuDeP 5nV+28sab38h7PKdWvcmQBYl9vm7aFLr6itmRJNUkVAWIbuIPK4inOz5HiN4+UPGHA K0DEa8dMyVpU7PkX/p2RVpLLQ0KzLKKTzrrzUiFT2mOlJlo2YAQY1Pbz+4g6YqX5qX STzB2fGhhePgcYpsZGfRi2x9WJ13LoYp9c5wyaQbkWTVwA8PqfrQImVbP4TU1SLNh6 xwRlOT2I8Y5BQ== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 4962B64C25; Sat, 20 Dec 2025 16:24:09 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:41 -0700 Message-ID: <20251220232355.845414-2-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: X4CXYT7JA32ZHTR3MO7QMCANLABJW7SZ X-Message-ID-Hash: X4CXYT7JA32ZHTR3MO7QMCANLABJW7SZ 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/10] ext4l: Fix unused variable warnings in extents_status.c 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 Mark variables as __maybe_unused where they are only used in macro calls that expand to no-ops in U-Boot's single-threaded environment: - tree in ext4_es_try_to_merge_left/right - es_stats in ext4_seq_es_shrinker_info_show - ei in ext4_clear_inode_es, ext4_remove_pending, ext4_is_pending Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/extents_status.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/fs/ext4l/extents_status.c b/fs/ext4l/extents_status.c index 9c303fbe48f..72377fadd70 100644 --- a/fs/ext4l/extents_status.c +++ b/fs/ext4l/extents_status.c @@ -599,7 +599,7 @@ static int ext4_es_can_be_merged(struct extent_status *es1, static struct extent_status * ext4_es_try_to_merge_left(struct inode *inode, struct extent_status *es) { - struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; + struct ext4_es_tree *tree __maybe_unused = &EXT4_I(inode)->i_es_tree; struct extent_status *es1; struct rb_node *node; @@ -623,7 +623,7 @@ ext4_es_try_to_merge_left(struct inode *inode, struct extent_status *es) static struct extent_status * ext4_es_try_to_merge_right(struct inode *inode, struct extent_status *es) { - struct ext4_es_tree *tree = &EXT4_I(inode)->i_es_tree; + struct ext4_es_tree *tree __maybe_unused = &EXT4_I(inode)->i_es_tree; struct extent_status *es1; struct rb_node *node; @@ -1704,7 +1704,7 @@ static unsigned long ext4_es_scan(struct shrinker *shrink, int ext4_seq_es_shrinker_info_show(struct seq_file *seq, void *v) { struct ext4_sb_info *sbi = EXT4_SB((struct super_block *) seq->private); - struct ext4_es_stats *es_stats = &sbi->s_es_stats; + struct ext4_es_stats *es_stats __maybe_unused = &sbi->s_es_stats; struct ext4_inode_info *ei, *max = NULL; unsigned int inode_cnt = 0; @@ -1886,7 +1886,7 @@ static int es_reclaim_extents(struct ext4_inode_info *ei, int *nr_to_scan) */ void ext4_clear_inode_es(struct inode *inode) { - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei __maybe_unused = EXT4_I(inode); struct extent_status *es; struct ext4_es_tree *tree; struct rb_node *node; @@ -2069,7 +2069,7 @@ static void __remove_pending(struct inode *inode, ext4_lblk_t lblk) */ void ext4_remove_pending(struct inode *inode, ext4_lblk_t lblk) { - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei __maybe_unused = EXT4_I(inode); write_lock(&ei->i_es_lock); __remove_pending(inode, lblk); @@ -2089,7 +2089,7 @@ void ext4_remove_pending(struct inode *inode, ext4_lblk_t lblk) bool ext4_is_pending(struct inode *inode, ext4_lblk_t lblk) { struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei __maybe_unused = EXT4_I(inode); bool ret; read_lock(&ei->i_es_lock); From patchwork Sat Dec 20 23:23:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 996 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=1766273055; bh=AvRh1P1uHtBNzjZU7hHufwPjInVdFzj1SrMbg53o4WI=; 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=fCQofaCjJ5AffcMiG9muEdqQ5CyzzQu5iXP0n0aoeCa8tTSvLkba3XbnYZad5wVbR HmXwkZm3Ch8Xsff012R0piie+9Eg75B1NViMxSURxt8FxVGOzt4AvlcU7/YPy1RUJq O31N+yZjHEbzuGhs9dLu+/tH/h5ANmoeG9sfQGgNbNR8pzUiqHzA8AXn7l0adAb9Ie avAAdKqQm9tmkamZo00nDCrxBV8esmDEpfFemncyb2frmZDuZbK9qCxPH4D7cOzt4l dV0fpUPslit97A+bn8C2DsCOWtkNIMaUZioJP7ezr6pbWNZ97a4ao2Yg4cUIKdo2Vw 8BlJZylfiET3Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id AE85964C60 for ; Sat, 20 Dec 2025 16:24: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 o0ZhD_LN3C8k for ; Sat, 20 Dec 2025 16:24:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273055; bh=AvRh1P1uHtBNzjZU7hHufwPjInVdFzj1SrMbg53o4WI=; 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=fCQofaCjJ5AffcMiG9muEdqQ5CyzzQu5iXP0n0aoeCa8tTSvLkba3XbnYZad5wVbR HmXwkZm3Ch8Xsff012R0piie+9Eg75B1NViMxSURxt8FxVGOzt4AvlcU7/YPy1RUJq O31N+yZjHEbzuGhs9dLu+/tH/h5ANmoeG9sfQGgNbNR8pzUiqHzA8AXn7l0adAb9Ie avAAdKqQm9tmkamZo00nDCrxBV8esmDEpfFemncyb2frmZDuZbK9qCxPH4D7cOzt4l dV0fpUPslit97A+bn8C2DsCOWtkNIMaUZioJP7ezr6pbWNZ97a4ao2Yg4cUIKdo2Vw 8BlJZylfiET3Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9EB7764C57 for ; Sat, 20 Dec 2025 16:24:15 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273054; bh=JfeZ9UG6zlq3fFFWi8DTsuVnoOl1EiaPzFgpdvOU5Cw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=KboDYUKGde4wcu+58YivIkEHERDPPi61+px1D80l6QGVhnWZWKmnhwLxFlo1+VUb6 7gvAbXshfdQOvjaVd6sIkT3FdCrU3V64hHSr1Q3FaYP3CbqTXS9PisOhhVI6I/2pGa hwt7R27/HUg4lOlNStEw8iMeoiRQ7ciZ1rMApFrUrSggXbWJxTqQmKB6RH21XX1SOk FSB1Oqjt6EYWCRypEpq2D8CKyrfNzk2cwDhmhNEzG2oJgSEFkRoROVAdcyX5PMZ+6A Z8H9lXiffpHIRu4uzSYDf80R4gj1c2tj4/5t5R1HqJR+6CRcDVNqBn83d0C6/dGkcL hOVbQWv7decOQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A311C64C29; Sat, 20 Dec 2025 16:24:14 -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 SesJA7BjMpf0; Sat, 20 Dec 2025 16:24:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273050; bh=x5dQximWjNkMmjZBKA8fCjbnZYyjOGmgeLDXUMW22I8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q/aoaPv5/wNVcxN5q4FcJLQYp0tZJdAKoEy3kwNsDnR1VW0747F4S2BJhwo2xqouz LfA/EfgUowpddXIA8f8KCh+s5WJq7n+uiED/0cC7447l5qgBxOxTfxnM2jfgx/AH9U MCHPbND39mFxxMBktB5LYLLjBcQjotXaKsvsf6+imY/ed5/ephma6ddO6vUxrVC/4t XAqOV1jUdGjEmo2X0baa/sNTK6VGKv1bgZHQdVrwEPPb5z8HlPDAve5ii/9VS/QJs4 wF16Vj2hZ/thVwe+NQ5ypoXw5bIWHq8WLDIEG77KDd1HytOxtH3SWQgSS7RVnBADPu kCZspnjOjWetg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2FB5964C25; Sat, 20 Dec 2025 16:24:10 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:42 -0700 Message-ID: <20251220232355.845414-3-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QW4UYAAS6SGZ4W5PWP3KN3J5E63MZSER X-Message-ID-Hash: QW4UYAAS6SGZ4W5PWP3KN3J5E63MZSER 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/10] ext4l: Add stubs for xattr functions used by ialloc.c 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 stub declarations and implementations for xattr functions that ialloc.c calls but which are defined in xattr.c (not yet compiled): - __ext4_xattr_set_credits - ext4_init_security Add declarations to ext4_uboot.h and implementations to stub.c. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 10 ++++++++-- fs/ext4l/stub.c | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+), 2 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 41de40b4ee0..943b474cdc8 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -366,9 +366,15 @@ extern struct user_namespace init_user_ns; #ifndef _FS_EXT4_ACL_H #define ext4_init_acl(h, i, d) ({ (void)(h); (void)(i); (void)(d); 0; }) #endif -/* Note: ext4_init_security is already handled in xattr.h */ +/* xattr stubs for files that don't include xattr.h */ +struct super_block; +struct buffer_head; +struct qstr; -/* xattr stubs - __ext4_xattr_set_credits is declared in xattr.h */ +int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, + struct buffer_head *block_bh, size_t value_len, + bool is_create); +/* ext4_init_security is declared in xattr.h */ /* inode state stubs */ #define is_bad_inode(inode) (0) diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 04e6cbb680a..44cc4b7f52e 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -377,3 +377,21 @@ struct buffer_head *ext4_sb_bread_nofail(struct super_block *sb, { return NULL; } + +/* + * Stubs for ialloc.c - xattr functions + */ +int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, + struct buffer_head *block_bh, size_t value_len, + bool is_create) +{ + return 0; +} + +struct qstr; + +int ext4_init_security(void *handle, struct inode *inode, struct inode *dir, + const struct qstr *qstr) +{ + return 0; +} From patchwork Sat Dec 20 23:23:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 997 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=1766273061; bh=uFo6nOMIqVeQcANhma56DDtJ1Ltfw8MhYAKvpDlEENk=; 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=Hgucs8pUHQWurkJAfMtnsQK++WWsAruC6PeN0/X15J2tnqsFbNmfSlyP/NKnGhHXK iMr98BVssSxMi7SCYp0U51Bf3TYUTgpU5poGvbe8Ry2F0CXWeuKQXVfiwf6TUqR8Xh /sU+qbzyqLo1kZaRIzgcNmBaoZIZaM3H9CNCOHJu8OUpSURe55xOZQOEpd/UooFQ8E b9zfkg48Zeni7ezNBwb2Myv+IfelZ775y7CYTWvD934w8pyNSixj0mlpY5eSm+MAkZ NFpRpbqfQVfiGh7qm1I8p1n8mEAG4qa7kAXGDi4xcGIau1v/1cR9XGEcSdbBAm9v++ hZ/PbNGeJeoKQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 20C7064C60 for ; Sat, 20 Dec 2025 16:24:21 -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 7tBA2bQQqUxQ for ; Sat, 20 Dec 2025 16:24:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273061; bh=uFo6nOMIqVeQcANhma56DDtJ1Ltfw8MhYAKvpDlEENk=; 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=Hgucs8pUHQWurkJAfMtnsQK++WWsAruC6PeN0/X15J2tnqsFbNmfSlyP/NKnGhHXK iMr98BVssSxMi7SCYp0U51Bf3TYUTgpU5poGvbe8Ry2F0CXWeuKQXVfiwf6TUqR8Xh /sU+qbzyqLo1kZaRIzgcNmBaoZIZaM3H9CNCOHJu8OUpSURe55xOZQOEpd/UooFQ8E b9zfkg48Zeni7ezNBwb2Myv+IfelZ775y7CYTWvD934w8pyNSixj0mlpY5eSm+MAkZ NFpRpbqfQVfiGh7qm1I8p1n8mEAG4qa7kAXGDi4xcGIau1v/1cR9XGEcSdbBAm9v++ hZ/PbNGeJeoKQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1042464C57 for ; Sat, 20 Dec 2025 16:24:21 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273059; bh=m6eNhyDsICkoQtMpZp57kxsJRKNnvNuG83OkyaAWQtA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=d89IeEveXSlfFDISEn2XJorhvd/af4et6wOqadD8381CHIQVi+NURWo6z81eojuTi GsI6UOEJcqNXgIK/IWFogHxkUY72625PVQ8KtbsepqDj5Pk91II+IUnDfZ8VvKmjpt 4kFB5MiPkS3G99egVgYrz4iFHZLKx+a/AFxO3UFACNfV7inVP42N75AN6IeJx+0hvu vfDXQPlT/l+cLuTebZFkagRi738yhawHbKZJHGotJUaM5LVnqRdow0/MDaUeSTTe0Z 80xYJQpcecmZ16Prft+RF/t7AczGiKKvf3HnWQ5LYGGlxxTVQVg86ndEAIuvXqBAIQ QO6FYPn5THcjQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2CC3664C29; Sat, 20 Dec 2025 16:24: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 10026) with ESMTP id LBwVSEVdGRsl; Sat, 20 Dec 2025 16:24:19 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273055; bh=XwansqDXMH7F5z/cYZqk1iRj7GDNyqChv+J8bd2phVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jC1YA+oueJZK2XuWcCUA8JVmL6f3hTYX8la+vZFV/ukJRa8OL/QJ+qmY2J8CFJYDl I1I2zpoS5WodOqS1B39JUX5s3ejibD49C13iSK7btIs9yTUOSOE6PwCeClA7G1M8+e 0NJosLLQ3eB1oh/nemL9uXDhpHp7lqZqNiH2QC0F8wf6wnT2Sh6eln5HJwakjmpwXA 1nHbRQPSb2ZB5+llQVmfOJcvPbBYHKNEhKH1Lf+ubWrCwColwssoyuQb0dniFhlFeM thoW31RRKtrfF8rxHPgr6owcZOi8k2/C55Kru/hC5/v+KAOR/yAtGR2StpZmaozbhD 1z5zdJx2vsPVg== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id BEF7F64C25; Sat, 20 Dec 2025 16:24:14 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:43 -0700 Message-ID: <20251220232355.845414-4-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: O22D5POJ23OE2OTU2RXFGIMSVDQR3W64 X-Message-ID-Hash: O22D5POJ23OE2OTU2RXFGIMSVDQR3W64 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/10] ext4l: Add orphan.c and required support 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 orphan.c to the ext4l build and fix various build issues: - Add atomic_inc/atomic_dec macros to ext4_uboot.h - Add s_flags member to struct super_block and SB_RDONLY constant - Add bdev_read_only() stub function - Add kvfree() and kvmalloc_array() to linux/slab.h - Add stub functions for orphan.c: ext4_reserve_inode_write, ext4_superblock_csum_set, ext4_mark_iloc_dirty, ext4_truncate, ext4_feature_set_ok, ext4_bread - Fix orphan.c to use U-Boot include pattern - Remove linux/atomic.h include from buffer_head.h (types provided by ext4_uboot.h) - Add kunit/static_stub.h and linux/nospec.h stub headers - Simplify seq_file.h macros Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 3 ++- fs/ext4l/ext4_uboot.h | 48 ++++++++++++++++++++++++++++++++----- fs/ext4l/extents_status.c | 1 - fs/ext4l/ialloc.c | 1 - fs/ext4l/orphan.c | 5 ++-- fs/ext4l/stub.c | 37 ++++++++++++++++++++++++++++ include/kunit/static_stub.h | 13 ++++++++++ include/linux/buffer_head.h | 12 ++++------ include/linux/nospec.h | 14 +++++++++++ include/linux/seq_file.h | 7 +++--- include/linux/slab.h | 10 ++++++++ 11 files changed, 127 insertions(+), 24 deletions(-) create mode 100644 include/kunit/static_stub.h create mode 100644 include/linux/nospec.h diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 4878523eae3..c5adb121f77 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -6,4 +6,5 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \ - extents_status.o hash.o ialloc.o indirect.o + extents_status.o hash.o ialloc.o indirect.o \ + orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 943b474cdc8..6c328a5abf1 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -48,8 +48,24 @@ typedef struct { long counter; } atomic64_t; #define atomic_read(v) ((v)->counter) #define atomic_set(v, i) ((v)->counter = (i)) +#define atomic_inc(v) ((v)->counter++) +#define atomic_dec(v) ((v)->counter--) #define atomic64_read(v) ((v)->counter) #define atomic64_set(v, i) ((v)->counter = (i)) +#define atomic_dec_if_positive(v) (--(v)->counter) + +/* SMP stubs - U-Boot is single-threaded */ +#define raw_smp_processor_id() 0 + +/* cmpxchg - compare and exchange, single-threaded version */ +#define cmpxchg(ptr, old, new) ({ \ + typeof(*(ptr)) __old = (old); \ + typeof(*(ptr)) __new = (new); \ + typeof(*(ptr)) __ret = *(ptr); \ + if (__ret == __old) \ + *(ptr) = __new; \ + __ret; \ +}) /* Reference count type */ typedef struct { atomic_t refs; } refcount_t; @@ -58,10 +74,10 @@ typedef struct { atomic_t refs; } refcount_t; typedef int rwlock_t; /* spinlock_t is defined in linux/compat.h */ -#define read_lock(l) do { (void)(l); } while (0) -#define read_unlock(l) do { (void)(l); } while (0) -#define write_lock(l) do { (void)(l); } while (0) -#define write_unlock(l) do { (void)(l); } while (0) +#define read_lock(l) do { } while (0) +#define read_unlock(l) do { } while (0) +#define write_lock(l) do { } while (0) +#define write_unlock(l) do { } while (0) /* RB tree types - stubs */ struct rb_node { @@ -374,7 +390,12 @@ struct qstr; int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, struct buffer_head *block_bh, size_t value_len, bool is_create); -/* ext4_init_security is declared in xattr.h */ +/* ext4_init_security - stub for files that don't include xattr.h */ +static inline int ext4_init_security(void *handle, struct inode *inode, + struct inode *dir, const struct qstr *qstr) +{ + return 0; +} /* inode state stubs */ #define is_bad_inode(inode) (0) @@ -431,7 +452,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, #define rb_next(node) ((node)->rb_right) #define rb_prev(node) ((node)->rb_left) #define rb_insert_color(node, root) do { } while (0) -#define rb_erase(node, root) do { (void)(node); (void)(root); } while (0) +#define rb_erase(node, root) do { } while (0) #define rb_link_node(node, parent, rb_link) do { *(rb_link) = (node); } while (0) #define RB_EMPTY_ROOT(root) ((root)->rb_node == NULL) #define rbtree_postorder_for_each_entry_safe(pos, n, root, field) \ @@ -563,6 +584,9 @@ struct fstrim_range { /* block_device is defined in linux/fs.h */ +/* Superblock flags */ +#define SB_RDONLY (1 << 0) + /* super_block - minimal stub */ struct super_block { void *s_fs_info; @@ -570,6 +594,7 @@ struct super_block { unsigned char s_blocksize_bits; unsigned long s_magic; loff_t s_maxbytes; + unsigned long s_flags; struct rw_semaphore s_umount; struct sb_writers s_writers; struct block_device *s_bdev; @@ -577,9 +602,19 @@ struct super_block { struct dentry *s_root; }; +/* Block device read-only check - stub */ +static inline int bdev_read_only(struct block_device *bdev) +{ + return 0; +} + /* kuid_t and kgid_t - from linux/cred.h */ #include +/* Inode state bits */ +#define I_NEW (1 << 0) +#define I_FREEING (1 << 1) + /* inode - minimal stub */ struct inode { struct super_block *i_sb; @@ -594,6 +629,7 @@ struct inode { unsigned int i_generation; unsigned int i_flags; unsigned int i_blkbits; + unsigned long i_state; struct timespec64 i_atime; struct timespec64 i_mtime; struct timespec64 i_ctime; diff --git a/fs/ext4l/extents_status.c b/fs/ext4l/extents_status.c index 72377fadd70..485f3a2f5cc 100644 --- a/fs/ext4l/extents_status.c +++ b/fs/ext4l/extents_status.c @@ -1741,7 +1741,6 @@ int ext4_seq_es_shrinker_info_show(struct seq_file *seq, void *v) max->vfs_inode.i_ino, max->i_es_all_nr, max->i_es_shk_nr, div_u64(es_stats->es_stats_max_scan_time, 1000)); - (void)es_stats; /* Used only by seq_printf which is stubbed */ return 0; } diff --git a/fs/ext4l/ialloc.c b/fs/ext4l/ialloc.c index d72204a5d02..3d9edbcc1c3 100644 --- a/fs/ext4l/ialloc.c +++ b/fs/ext4l/ialloc.c @@ -16,7 +16,6 @@ #include "ext4_uboot.h" #include "ext4.h" #include "ext4_jbd2.h" -#include "xattr.h" /* * ialloc.c contains the inodes allocation and deallocation routines diff --git a/fs/ext4l/orphan.c b/fs/ext4l/orphan.c index 82d5e750145..32ec59b2978 100644 --- a/fs/ext4l/orphan.c +++ b/fs/ext4l/orphan.c @@ -1,10 +1,9 @@ +// SPDX-License-Identifier: GPL-2.0 /* * Ext4 orphan inode handling */ -#include -#include -#include +#include "ext4_uboot.h" #include "ext4.h" #include "ext4_jbd2.h" diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 44cc4b7f52e..5a3eda0ad2e 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -395,3 +395,40 @@ int ext4_init_security(void *handle, struct inode *inode, struct inode *dir, { return 0; } + +/* + * Stubs for orphan.c + */ +struct ext4_iloc; + +int ext4_reserve_inode_write(void *handle, struct inode *inode, + struct ext4_iloc *iloc) +{ + return 0; +} + +void ext4_superblock_csum_set(struct super_block *sb) +{ +} + +int ext4_mark_iloc_dirty(void *handle, struct inode *inode, + struct ext4_iloc *iloc) +{ + return 0; +} + +int ext4_truncate(struct inode *inode) +{ + return 0; +} + +int ext4_feature_set_ok(struct super_block *sb, int readonly) +{ + return 1; +} + +struct buffer_head *ext4_bread(void *handle, struct inode *inode, + unsigned long long block, int create) +{ + return NULL; +} diff --git a/include/kunit/static_stub.h b/include/kunit/static_stub.h new file mode 100644 index 00000000000..995a919f641 --- /dev/null +++ b/include/kunit/static_stub.h @@ -0,0 +1,13 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _KUNIT_STATIC_STUB_H +#define _KUNIT_STATIC_STUB_H + +/* + * Stub header for U-Boot ext4l. + * + * KUnit static stubs are for kernel unit testing - not needed in U-Boot. + */ + +#define KUNIT_STATIC_STUB_REDIRECT(func, args...) do { } while (0) + +#endif /* _KUNIT_STATIC_STUB_H */ diff --git a/include/linux/buffer_head.h b/include/linux/buffer_head.h index 9c663741bef..b7596a74108 100644 --- a/include/linux/buffer_head.h +++ b/include/linux/buffer_head.h @@ -12,14 +12,10 @@ #include #include #include - -/* Simple atomic_inc/dec for U-Boot (single-threaded) */ -#ifndef atomic_inc -#define atomic_inc(v) ((v)->counter++) -#endif -#ifndef atomic_dec -#define atomic_dec(v) ((v)->counter--) -#endif +/* + * Note: atomic_t and sector_t are expected to be defined by the including + * file (ext4_uboot.h) before including this header. + */ enum bh_state_bits { BH_Uptodate, /* Contains valid data */ diff --git a/include/linux/nospec.h b/include/linux/nospec.h new file mode 100644 index 00000000000..97d8271a00b --- /dev/null +++ b/include/linux/nospec.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_NOSPEC_H +#define _LINUX_NOSPEC_H + +/* + * Stub header for U-Boot ext4l. + * + * array_index_nospec bounds-checks array access, but in U-Boot's + * single-user environment this is not necessary. + */ + +#define array_index_nospec(index, size) (index) + +#endif /* _LINUX_NOSPEC_H */ diff --git a/include/linux/seq_file.h b/include/linux/seq_file.h index 1d43f23348a..fb5dbf97708 100644 --- a/include/linux/seq_file.h +++ b/include/linux/seq_file.h @@ -11,9 +11,8 @@ struct seq_file { void *private; }; -#define seq_printf(m, fmt, ...) \ - do { (void)(m); (void)(fmt); } while (0) -#define seq_puts(m, s) do { (void)(m); (void)(s); } while (0) -#define seq_putc(m, c) do { (void)(m); (void)(c); } while (0) +#define seq_printf(m, fmt, ...) do { } while (0) +#define seq_puts(m, s) do { } while (0) +#define seq_putc(m, c) do { } while (0) #endif /* _LINUX_SEQ_FILE_H */ diff --git a/include/linux/slab.h b/include/linux/slab.h index 8da8f36e413..ac588dec6e2 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -67,6 +67,16 @@ static inline void kfree(const void *block) free((void *)block); } +static inline void kvfree(const void *addr) +{ + kfree(addr); +} + +static inline void *kvmalloc_array(size_t n, size_t size, gfp_t flags) +{ + return kmalloc_array(n, size, flags); +} + static inline void *krealloc(const void *p, size_t new_size, gfp_t flags) { return realloc((void *)p, new_size); From patchwork Sat Dec 20 23:23:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 998 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=1766273064; bh=d8xk8MX/zSxYmVDEMO+VCD3cl1yn0A5ZXjZrgbOjs5U=; 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=Kczia5BEI4mlPJ561JiRlnd8E1we3VkadEhJjZbPaFGQvDpxqLXRqVsXDJmk/pgNh aSIiBQY9Ijc39z6XEwOMgpAU3MAfbBthMF0hCzMdd4gRDHFOfqq/Et8EqKMZ6GoxOU YjmjNabel5TLK25uQXhuyjopbSGOceysSeFPu/CoA9k2kIRcoCiuQTxSPvrahp+zPj 0c8yT+xo6/3vXUkPVOPfH3ROaPz7VqcuMr88VM0gkQ7c4ssvqUZWqclWTqZqPXU6o9 XrpxESvonfxKPyqYdJJufH7aFDB6oPW12HkIbQF4+ZBOs1ZaODryDO11KRN3RonBZI CZ51jF/Q/N99w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8AD0064C8F for ; Sat, 20 Dec 2025 16:24: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 eO0UI8k4NYso for ; Sat, 20 Dec 2025 16:24:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273064; bh=d8xk8MX/zSxYmVDEMO+VCD3cl1yn0A5ZXjZrgbOjs5U=; 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=Kczia5BEI4mlPJ561JiRlnd8E1we3VkadEhJjZbPaFGQvDpxqLXRqVsXDJmk/pgNh aSIiBQY9Ijc39z6XEwOMgpAU3MAfbBthMF0hCzMdd4gRDHFOfqq/Et8EqKMZ6GoxOU YjmjNabel5TLK25uQXhuyjopbSGOceysSeFPu/CoA9k2kIRcoCiuQTxSPvrahp+zPj 0c8yT+xo6/3vXUkPVOPfH3ROaPz7VqcuMr88VM0gkQ7c4ssvqUZWqclWTqZqPXU6o9 XrpxESvonfxKPyqYdJJufH7aFDB6oPW12HkIbQF4+ZBOs1ZaODryDO11KRN3RonBZI CZ51jF/Q/N99w== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7A29264C60 for ; Sat, 20 Dec 2025 16:24:24 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273063; bh=7yswGqVaX2E07jdNMRSTBpQh9IUjy75EP2/GMyfnibM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=l+ajUtTpkouTa8wHnQhuPPNc8XSJwQiyvspkVEpQXvEKjflhpgmG4/81PjiYkGtGv QexkjU6CsBdGii5kb9gHdNDmaPE3IcWtwcZNn1DYrYSFkxoHe90Ao5IpMvvxLe8pJ0 19J1JrhKO5cu8isBR0Wk5l23qcudGsfMEiemhboBKIzEko/ktovHkToduw/2/jJdYS aQlUzIVDQPDy1PEKqaRUqiUGAHEjJmkR9FrGI9ajM8MeI/afBB7451Gkiebroyx/Bl F4cZF/I0vnw30okeMSF/j4ZGlxFjHcgwxWXmlpyBvwA1foQAXoMM8GyeyU/Qp6d4DM DMAadF8LiqkyA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CF01E64C45; Sat, 20 Dec 2025 16:24: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 3A3WosD_Hozb; Sat, 20 Dec 2025 16:24:23 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273059; bh=Oufj3F6Q1+fWzNVZ61LHU4gEF9SQFUyGDQX8WAE1CK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IJ8a9TV9NllIb4nqvFL3D9bQNro9270uVTTXqWv9wEjxjfWWrkgzg+vVfFDXk1zxQ mIDlMxOKCi/UtF8pS72sKrpq95sS8aqAzBQWSvGeMltR2oXHxDf76fDTNw+jcMULBT mLRHwgzk+QwioQ9LbaTuvi36Qvj/QNaxCkWwk84BEaArNFa1Z8KLqY9qCY/dylydvB GY9hhjvuhEuCTWOlvR5SDSppaQU9WHvC1/xSFRhRF5oqxhpvfTmyIIbYQs9h2t7guv F6AhpvSVGFA1V+GtIFoJAzImQTATNA+n1rNsHgjRubsFaL+YhlSsZrU46En8bm6jyj WrekD8GN6QFyA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 75B5264C25; Sat, 20 Dec 2025 16:24:19 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:44 -0700 Message-ID: <20251220232355.845414-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QKDTD7X55W7GPV5M55HU73LP3UR7A5CT X-Message-ID-Hash: QKDTD7X55W7GPV5M55HU73LP3UR7A5CT 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/10] ext4l: Add xattr_trusted.c 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 xattr_trusted.c to the ext4l build with necessary changes: - Update xattr_trusted.c includes to use ext4_uboot.h - Add xattr.h include to ialloc.c for ext4_init_security - Remove duplicate ext4_init_security declaration from ext4_uboot.h (now provided by xattr.h inline stub) - Add ext4_xattr_get and ext4_xattr_set stubs Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 4 +++- fs/ext4l/ext4_uboot.h | 7 +------ fs/ext4l/ialloc.c | 1 + fs/ext4l/stub.c | 17 +++++++++++++---- fs/ext4l/xattr_trusted.c | 3 +-- 5 files changed, 19 insertions(+), 13 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index c5adb121f77..cfb1413ba30 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -6,5 +6,7 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \ - extents_status.o hash.o ialloc.o indirect.o \ + extents_status.o hash.o ialloc.o \ + indirect.o \ + xattr_trusted.o \ orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 6c328a5abf1..32b497deadc 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -390,12 +390,7 @@ struct qstr; int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, struct buffer_head *block_bh, size_t value_len, bool is_create); -/* ext4_init_security - stub for files that don't include xattr.h */ -static inline int ext4_init_security(void *handle, struct inode *inode, - struct inode *dir, const struct qstr *qstr) -{ - return 0; -} +/* ext4_init_security is provided by xattr.h */ /* inode state stubs */ #define is_bad_inode(inode) (0) diff --git a/fs/ext4l/ialloc.c b/fs/ext4l/ialloc.c index 3d9edbcc1c3..d72204a5d02 100644 --- a/fs/ext4l/ialloc.c +++ b/fs/ext4l/ialloc.c @@ -16,6 +16,7 @@ #include "ext4_uboot.h" #include "ext4.h" #include "ext4_jbd2.h" +#include "xattr.h" /* * ialloc.c contains the inodes allocation and deallocation routines diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 5a3eda0ad2e..41550bc48bc 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -388,12 +388,21 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, return 0; } -struct qstr; +/* ext4_init_security stub is provided by xattr.h */ -int ext4_init_security(void *handle, struct inode *inode, struct inode *dir, - const struct qstr *qstr) +/* + * Stubs for xattr_trusted.c + */ +int ext4_xattr_get(struct inode *inode, int name_index, const char *name, + void *buffer, size_t buffer_size) { - return 0; + return -1; +} + +int ext4_xattr_set(struct inode *inode, int name_index, const char *name, + const void *value, size_t value_len, int flags) +{ + return -1; } /* diff --git a/fs/ext4l/xattr_trusted.c b/fs/ext4l/xattr_trusted.c index 9811eb0ab27..57ef5caa588 100644 --- a/fs/ext4l/xattr_trusted.c +++ b/fs/ext4l/xattr_trusted.c @@ -7,8 +7,7 @@ */ #include -#include -#include +#include "ext4_uboot.h" #include "ext4_jbd2.h" #include "ext4.h" #include "xattr.h" From patchwork Sat Dec 20 23:23:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 999 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=1766273070; bh=Fcyfbit7Q6FRTiZeTz3nx5MIsNTXMEsqxA1IA5MATgE=; 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=lmDo8jpsC6hgkbdgSaKRmtuDH3TuBvz2VjFc+TC4f57YuYIBAa2X2ppCEbhGDgsZI oQETD7KnahUpanwdnRaGWCsYQ/OQrSkssOpeUhJIbz4trXQJ90igu/lQqNJ47/330Q HkvaOYVauUmDijR9zWmBrDeBRNfSP2sbOYuZDmREgWMUoHpXH2wXxQcOnk9Rx2wU/B LBNwl1Y25kdU9VyI382R0yIgA+3s0a8tUz1LiubygcQ8sBzTTQnmIsrYTCIpPvOi5Y ht8XXDWbd5J4XLQPWrJKCZJTVhsO8X0UVGeXLAfNEiKaxxzKXjD+yvkhLox3lCAU8U 8TH4nHjjJo8Tg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4E68464C5B for ; Sat, 20 Dec 2025 16:24:30 -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 d7nE-cdv-RTa for ; Sat, 20 Dec 2025 16:24:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273070; bh=Fcyfbit7Q6FRTiZeTz3nx5MIsNTXMEsqxA1IA5MATgE=; 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=lmDo8jpsC6hgkbdgSaKRmtuDH3TuBvz2VjFc+TC4f57YuYIBAa2X2ppCEbhGDgsZI oQETD7KnahUpanwdnRaGWCsYQ/OQrSkssOpeUhJIbz4trXQJ90igu/lQqNJ47/330Q HkvaOYVauUmDijR9zWmBrDeBRNfSP2sbOYuZDmREgWMUoHpXH2wXxQcOnk9Rx2wU/B LBNwl1Y25kdU9VyI382R0yIgA+3s0a8tUz1LiubygcQ8sBzTTQnmIsrYTCIpPvOi5Y ht8XXDWbd5J4XLQPWrJKCZJTVhsO8X0UVGeXLAfNEiKaxxzKXjD+yvkhLox3lCAU8U 8TH4nHjjJo8Tg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 3B76B64C45 for ; Sat, 20 Dec 2025 16:24:30 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273068; bh=LnW8yExYQ6cPvw5dvFgA30ikeIcPcSgIykx4Ts/B694=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=AzBNmg2Td/64cMnfwKw4nyfiquyR6WQmhymjTt8B0EY6+LPjQUURlUMAM2DfcxfZX fOmFy73HkZDMYaqfOws6dhMXJTB42F2LxEj3+pLiwb9bxcLIPhCZUDDDtnHLzkwuWw m5wkSLHpWWeqSTGmJCuc/4zwiLyizm+4PMkVXrXroJfAbjN8zNRZujq7U6XBFWNVKI XzkFFuoCdefO7rr5B3312UASV9nPCXpd4T8yKDpi4S4RspqJrCVT+WjAn1HP2Dgdff C16fW1wUH6JP1Rmy2Db26I2jXfhHAycc7mz2AFbY4SaRP9HpigeD/mCS/Xr6KuTlrP iz+IMBVgYirNw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 6D9F364C29; Sat, 20 Dec 2025 16:24: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 10026) with ESMTP id dtBJTlrIyFxq; Sat, 20 Dec 2025 16:24:28 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273064; bh=i1uxkkiRe1cFBusfSmauXX1rfkkw/vbKlQXaDXfg13g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=emPUHfi8EGXpjoTK/wAT82sbx2luZrsCOO021UHfYUj/ZCXhfk/ZcvbEX5sXn0nQ8 D3rbKSApCslORiTTQkZs6Em8Vhf9flj7yTN56ilUyw/nQW5yF4Ar96RsgVjb4XSQn8 DjSwYVr73+a3cFZ60y4931hkKkRMT3iRE8djadyf9PtXLvkgHbRGDLeu4Xy3GpVp2V linJjLNvOoCWdQl00wVqwF+E9ExY4m1QL1nr4fnDoUlXx1kmbvHNglQfvgX60ZZs3+ yG88SymljY0M14T1Zh+LP8y+Vyjb5aU/HOYzIwD42Kn481DfuZ1KZzmWEoe7/3Qj1D DxW8IlQ/1CuGw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1F67164C25; Sat, 20 Dec 2025 16:24:24 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:45 -0700 Message-ID: <20251220232355.845414-6-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: DMNIH2DQBWNCVX5EGKHNN5QRVQB5EFD5 X-Message-ID-Hash: DMNIH2DQBWNCVX5EGKHNN5QRVQB5EFD5 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/10] ext4l: Add xattr_user.c and xattr_hurd.c 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 xattr_user.c and xattr_hurd.c to the ext4l build: - Update includes to use ext4_uboot.h - Add d_sb member to struct dentry - Add XATTR_HURD_PREFIX to linux/xattr.h Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 4 ++-- fs/ext4l/ext4_uboot.h | 1 + fs/ext4l/xattr_hurd.c | 1 + fs/ext4l/xattr_user.c | 2 +- include/linux/xattr.h | 3 +++ 5 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index cfb1413ba30..4a8a94035b9 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -8,5 +8,5 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \ extents_status.o hash.o ialloc.o \ indirect.o \ - xattr_trusted.o \ - orphan.o + xattr_hurd.o xattr_trusted.o \ + xattr_user.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 32b497deadc..1d0c58c4f38 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -526,6 +526,7 @@ struct qstr { struct dentry { struct qstr d_name; struct inode *d_inode; + struct super_block *d_sb; }; /* vm_fault_t - stub */ diff --git a/fs/ext4l/xattr_hurd.c b/fs/ext4l/xattr_hurd.c index 8a5842e4cd9..5ef4d058da1 100644 --- a/fs/ext4l/xattr_hurd.c +++ b/fs/ext4l/xattr_hurd.c @@ -9,6 +9,7 @@ #include #include +#include "ext4_uboot.h" #include "ext4.h" #include "xattr.h" diff --git a/fs/ext4l/xattr_user.c b/fs/ext4l/xattr_user.c index 4b70bf4e762..16370f6143d 100644 --- a/fs/ext4l/xattr_user.c +++ b/fs/ext4l/xattr_user.c @@ -7,7 +7,7 @@ */ #include -#include +#include "ext4_uboot.h" #include "ext4_jbd2.h" #include "ext4.h" #include "xattr.h" diff --git a/include/linux/xattr.h b/include/linux/xattr.h index f5dc7953a05..db1bf4d3ee6 100644 --- a/include/linux/xattr.h +++ b/include/linux/xattr.h @@ -27,6 +27,9 @@ #define XATTR_SYSTEM_PREFIX "system." #define XATTR_SYSTEM_PREFIX_LEN 7 +#define XATTR_HURD_PREFIX "gnu." +#define XATTR_HURD_PREFIX_LEN 4 + /* Maximum size of an xattr value */ #define XATTR_SIZE_MAX 65536 From patchwork Sat Dec 20 23:23:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1000 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=1766273074; bh=Faig+llFvSuYPCSr4sxSEYgS2UexOM7enenTemW51OY=; 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=G4Y0MEtH5Esg5FcWNghmiIe3hCApzFKaLOxaTdwPrNyCTvB5Pc9qcyXQkjpWGCkcr lv6WpOrQKzOM/9TaoNFqaH3KzaZMPoH4eQMUqSimr/Z7If8veNBW6qYxU71RKxoV/N Zona2KVGBMEG9G4QRGXSlyUY5H7B116u+6M7wPeAnFvHnyWE5ZqwHKiA+RVehifupM WV86PRD2hNGWo4QnVrMJPsacPeHdhAiPk6mERFulQjvE3UIoIxBvf+OR66ENpnHKbx G0qZlEGN14FvJKGvhCJ6mh5HCGJIs7BiBrLsSK0Ku4IJp2M2qjENoke1c5UWvH9kXq kJ97m01MG/2dQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B62F064C60 for ; Sat, 20 Dec 2025 16:24:34 -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 7w9L-P3XinNQ for ; Sat, 20 Dec 2025 16:24:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273074; bh=Faig+llFvSuYPCSr4sxSEYgS2UexOM7enenTemW51OY=; 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=G4Y0MEtH5Esg5FcWNghmiIe3hCApzFKaLOxaTdwPrNyCTvB5Pc9qcyXQkjpWGCkcr lv6WpOrQKzOM/9TaoNFqaH3KzaZMPoH4eQMUqSimr/Z7If8veNBW6qYxU71RKxoV/N Zona2KVGBMEG9G4QRGXSlyUY5H7B116u+6M7wPeAnFvHnyWE5ZqwHKiA+RVehifupM WV86PRD2hNGWo4QnVrMJPsacPeHdhAiPk6mERFulQjvE3UIoIxBvf+OR66ENpnHKbx G0qZlEGN14FvJKGvhCJ6mh5HCGJIs7BiBrLsSK0Ku4IJp2M2qjENoke1c5UWvH9kXq kJ97m01MG/2dQ== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A703364C45 for ; Sat, 20 Dec 2025 16:24:34 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273073; bh=c1AsyK68IQFOREThBRfVbUDkP9NwJHACqN/ZTet3eik=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WbRpbjKx9s2IJwZpRFEQ0EAypCcYAmAqqBt9TRiyIJzYwlArKIAYZzj9iuJak/7YT VkXI3iJGn0/3g6VoPwP17xk1I7cQw07Or56zI/TENxwy71hqY0T6/DuTdN8hgMD6LO gv858wEYNergfgg4FMbonvq8ojwTRiHLLpMfvye3IMwbTHFDA/LHYVMkLZFyMI+bYg QR75l+smlZJTYFcaEFcvU7AAAZUZv2bdO051c2z527lQBTIcpl/zSJQhQ+VMMNV/KB e3U92gVqPSUqtTXAJ//LGOCH2PEDRs7Uiehe4IPcNn1H3JphCDsCtsW3ULrCqGwB1g uICi4ZaVn9AxA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 12E9464C29; Sat, 20 Dec 2025 16:24: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 10026) with ESMTP id X_UCqor6Pyj1; Sat, 20 Dec 2025 16:24:33 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273069; bh=SnqeE4n5CYBwk93CZiDxAozVOYOpFtUl9z0oET6QxSg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uVSsSD+Cu3dI8oOS0JWyRvfoO5QOdLqOs67IZ1QNLCEeQgdWP3bxn3U53BSA/xWfd CuD/ANJk2AM4GGKFdYWsx2T55f1bu+ut5hxqST7lcqAOec4uJWVAz5JFiOih+Gut1z 6VTmcNS9VdOu25TWW6HucNdzzc4wPuAHajdFkqfyncgExQvGdVLZfX6CZy7f/8njbi YEX3RslCJBKL3URk4F5x1Sj0NJKOCNg1o++aC1aKemgcDN2pMUJ7i/6dPiSCkiP0Hq pddYCK8bTpSmXSX/794FwGwkU+W5TfOZHq6qhKoBmj3ofKGPbw7z88b5ITqIM4JZbM I/KA4B7mqr5/w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id B688764C25; Sat, 20 Dec 2025 16:24:28 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:46 -0700 Message-ID: <20251220232355.845414-7-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GCKZR3ZZW42AUYL3KLQUQ7X2BDGCU5N5 X-Message-ID-Hash: GCKZR3ZZW42AUYL3KLQUQ7X2BDGCU5N5 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/10] ext4l: Add linux/utsname.h stub header 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 a stub header for linux/utsname.h needed by mmp.c and other ext4 files. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- include/linux/utsname.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 include/linux/utsname.h diff --git a/include/linux/utsname.h b/include/linux/utsname.h new file mode 100644 index 00000000000..4e1c712ee56 --- /dev/null +++ b/include/linux/utsname.h @@ -0,0 +1,21 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_UTSNAME_H +#define _LINUX_UTSNAME_H + +/* Stub for linux/utsname.h */ +struct new_utsname { + char sysname[65]; + char nodename[65]; + char release[65]; + char version[65]; + char machine[65]; + char domainname[65]; +}; + +struct uts_namespace { + struct new_utsname name; +}; + +extern struct uts_namespace init_uts_ns; + +#endif /* _LINUX_UTSNAME_H */ From patchwork Sat Dec 20 23:23:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1001 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=1766273079; bh=t5HGGxi7qITsMrJgRz2HDy4uoT5BPKkNi95hn/bfzZs=; 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=EN2FaQ6LWljHTAmBE7AqDE34vF2t1bYGAf4jwUGVmHhY7Q7qbCwBf3Bf//XI9lG6t IviCtM+i7Uo/K99z0T9GjqmhtrkDrPtkVeiniymu/Z+Om1nlIO8rXx3rRG4FQih8+8 5+oqcx2J4KkDiFRFI/uupGu58+nZJgbMZkxbPh7gj++dqvDa9hV2dTCmaygiKpPbJq lHTUtIhhg+EDlo0QH1AmV13Hvamz1MKfM59vik9tqKn61PHPUeU2c26QdC8+mZQgrW WXTQbiMlnQ9I2szxlewAptmXNxxazk/4e5EN0szXM9ELVrnYLe2G4+13GvV4U/nNDj Wi/lLxGA2E0Fw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 2899D64C8E for ; Sat, 20 Dec 2025 16:24:39 -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 x3id3qauWtAh for ; Sat, 20 Dec 2025 16:24:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273079; bh=t5HGGxi7qITsMrJgRz2HDy4uoT5BPKkNi95hn/bfzZs=; 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=EN2FaQ6LWljHTAmBE7AqDE34vF2t1bYGAf4jwUGVmHhY7Q7qbCwBf3Bf//XI9lG6t IviCtM+i7Uo/K99z0T9GjqmhtrkDrPtkVeiniymu/Z+Om1nlIO8rXx3rRG4FQih8+8 5+oqcx2J4KkDiFRFI/uupGu58+nZJgbMZkxbPh7gj++dqvDa9hV2dTCmaygiKpPbJq lHTUtIhhg+EDlo0QH1AmV13Hvamz1MKfM59vik9tqKn61PHPUeU2c26QdC8+mZQgrW WXTQbiMlnQ9I2szxlewAptmXNxxazk/4e5EN0szXM9ELVrnYLe2G4+13GvV4U/nNDj Wi/lLxGA2E0Fw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 1875E64C46 for ; Sat, 20 Dec 2025 16:24:39 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273077; bh=R3PhcZez1zoyAWAo0YlgJHSihgwDxFzlMLqlcXU8GFQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=QByIviQwKZuYTt3GReFrXgRD5dajTGUp0lwUfdOYwWjO5J6yvQmM7RtxMYpQph0uG wT9xI+QKb1CRR77euWHwlHcW3pJnBsN5TnC9uLdDaRzVV3pMPsHj40JrK9GQfIWGal iPjND7zPu/o2pMAkJaWnek1OPCQAl6BiNKVR6DuyPOq6WTBQOLaF089MdySlOqwhPs 0HFAIX/ORx26N1lCNE1FAhQivZK+kOnf/IbKHiE1M4CQiagtYWVKcALKkhtsisulbB ILk3LNz3eAf549AP5rM+PCApn4exFHjJ7g9/xmEGQQnqopzxX/kyNLq1GeMsv5wBn8 YWh1m1ZgChMKA== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id A90D964C29; Sat, 20 Dec 2025 16:24:37 -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 cfxt4mYy6SAK; Sat, 20 Dec 2025 16:24:37 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273073; bh=6wTvnsb8faFDyoc2t1T7mPKKV/xedMW1UmCWsHFyDSI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Sll4alXe0MRer0o7uz3s8vhVyZAcKQoL6fEmB0ago+lz/Uk3NPcuMtgOWIwk75JZd lFR4/fpOrp9j/xAPkA78LcVjJ20KeAY4G/MaVczsZsCXSjtG9YJlNyDBORwPNXTGrn dnFLjDPAMpNQWyF2m8p9e5gGOMpnC1I3aMaT0fgqYBLnsKILHqMoMtdeCdbIJyRluV sJVWZ9hwUKDZtKBzgd8z1hzx+bbN6rjLKeVQ5JLaRqK8yWYnrF5VBAHiDjJsdIlwPz pXxkl0FViM8PxfkS09D5CYWsbRdpCn1Fbg+Xv56XOaC+qfajvrNarBf1PATWOBuNAJ W+NzNW/elSorA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 584B464C25; Sat, 20 Dec 2025 16:24:33 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:47 -0700 Message-ID: <20251220232355.845414-8-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: WP5HNVDBZ6WJ7KUNEWWP5QELKLZMEZCB X-Message-ID-Hash: WP5HNVDBZ6WJ7KUNEWWP5QELKLZMEZCB 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/10] ext4l: Add kiocb, iov_iter structures and IOCB_* constants 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 infrastructure needed for file.c and other VFS-integrated files: - Add struct kiocb (kernel I/O control block) - Add struct iov_iter forward declaration - Add IOCB_DIRECT, IOCB_NOWAIT, IOCB_ATOMIC constants - Add iov_iter_truncate, iov_iter_count, iov_iter_alignment stubs - Remove ext4_init_acl macro (provided by acl.h) Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/ext4_uboot.h | 23 +++++++++++++++++++---- fs/ext4l/ialloc.c | 1 + 2 files changed, 20 insertions(+), 4 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 1d0c58c4f38..ea28d0fcc63 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -181,6 +181,24 @@ struct file_ra_state { /* struct file is defined in linux/fs.h */ +/* kiocb - kernel I/O control block */ +struct iov_iter; + +struct kiocb { + int ki_flags; + struct file *ki_filp; + loff_t ki_pos; +}; + +#define IOCB_DIRECT 0x0001 +#define IOCB_NOWAIT 0x0002 +#define IOCB_ATOMIC 0x0004 + +/* iov_iter stubs */ +#define iov_iter_truncate(i, count) do { } while (0) +#define iov_iter_count(i) 0 +#define iov_iter_alignment(iter) 0 + /* __counted_by attribute - not available in U-Boot */ #define __counted_by(x) @@ -378,10 +396,7 @@ extern struct user_namespace init_user_ns; #define fscrypt_prepare_new_inode(dir, i, e) ({ (void)(dir); (void)(i); (void)(e); 0; }) #define fscrypt_set_context(inode, handle) ({ (void)(inode); (void)(handle); 0; }) -/* ACL and security stubs - only if acl.h won't be included */ -#ifndef _FS_EXT4_ACL_H -#define ext4_init_acl(h, i, d) ({ (void)(h); (void)(i); (void)(d); 0; }) -#endif +/* ext4_init_acl is provided by acl.h */ /* xattr stubs for files that don't include xattr.h */ struct super_block; struct buffer_head; diff --git a/fs/ext4l/ialloc.c b/fs/ext4l/ialloc.c index d72204a5d02..5bbe8d6d359 100644 --- a/fs/ext4l/ialloc.c +++ b/fs/ext4l/ialloc.c @@ -17,6 +17,7 @@ #include "ext4.h" #include "ext4_jbd2.h" #include "xattr.h" +#include "acl.h" /* * ialloc.c contains the inodes allocation and deallocation routines From patchwork Sat Dec 20 23:23:48 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1003 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=1766273086; bh=Q7/wFGUxcbUUUTikGK69MU9PlgPEtGaPvG51HZQHnkE=; 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=OyU4Z3OeRjYK/E1TFLchB1LUak7YSwtvAE5pRvEIprHddoHRAYRkCPxo9k7P9ER5Z lt2IsyGYXUYyKU9inX9Wjk6xkZkbTHiapl3hJFCmPkcvmhd/mqVpfIQJpeBViuLzZY WJFRvjHr5m7iTmsm3EbVpA3awa37Pjc1v8YPyvBmAhTBmF6HNsig0+UyZFzKSgsHmN uMLsbo2u27LKdZ2DpsUcan4qJaNokUBlfVmayE94+Ql6bTzzBhDWQ4gdPCUM+RbTbI pJ4ZAHrS0BK3lQyi9QcmVjbkL4y6Im3J55UyHTfPkUEYxdtp/lXwO64tbOwr3IWPMp 7zET6w7CL8adg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0647764C29 for ; Sat, 20 Dec 2025 16:24:46 -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 lQbjwHbQG_xR for ; Sat, 20 Dec 2025 16:24:45 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273084; bh=Q7/wFGUxcbUUUTikGK69MU9PlgPEtGaPvG51HZQHnkE=; 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=OjDE7BtaMyiRLRT+NZysBqLPwYXxTaLYS8kJSqCaF/eW9CGaH9frhZNNX8ptuWr6a THhNJHCHl/iAktmeZXfkN+OZnly8457tIjXVCKS7OMzWDYNOHMpmU3tTBtjrwiN/hp clU9u3R4Y+Kz7Ruy9KlaxmHbyQRmM0e0cKIfCur0M9JLCRFf3e7iBAUzfaDzFljNO0 zjcXlCzZF4ieEJO2UHBIpdjW205dN7VIj3NjvY+wOlELfQapRlsSWo45LVcsDWeUAR 9yK0EsQnpAXyE/QOMfgephKzcg1seKcbLiBex0UfZ7b5P9xLYVp1YfD2XW6Eecxy6A GUZ77nzWcGa5Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 0075D64C45 for ; Sat, 20 Dec 2025 16:24:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273081; bh=tpJeo+GYaREGhew9X66cN7K7VPmzEbjOv0X3QO90Xqw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=hM8Ev49kN40wsUuJIew8IImA9lef9hrkaqBTXlZaBfBTBs8nIHdrn2G7v5YC/dZ4p bDNuHtufv+gfgzMJvWAil3j9PgFVtiNVDcMYDaRxIZee9i8nEawPMnZtbuYLBfhR+a JEi/f1oi9KSENsZdY4Uh21NVRFPV+svbzaq4Sjip0PGAdG1VJBgVFMiswbao7urKvf UrCzHxnJzjUBNCcWtGHg3Q0G/7icuM/zpdNv9QCo+6HyLTNCuJcnDT8p2FZdqTqZzK Qjbib8d7KAbWB1uAKCtCBIRGp97Skvj7OsdBeW4EgULs4SUtjahFYzBt3Gkjk2Y9Z/ 7AKm3MvzKRrWg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8C0D764C29; Sat, 20 Dec 2025 16:24: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 10026) with ESMTP id Gg-Z8H8gN_Iw; Sat, 20 Dec 2025 16:24:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273078; bh=wGpyaL9mJlHcbscqGUehWbAIUEPPOdyABIe3Up2tovY=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ubYHyBkorD3Sc8hJqaI9VAqu+ELGCxuPPIeuDZereLDG9fVIuRmA5UxhCuUcc9ewL iJ8vpc2r7skhqLeMQiWP5NJJDy6GKFKTW7n7cNR8+nc9QZvJnOWUsgILpJ/SWyARIE rlRFJu013fMPcPp1u5wOTyunT09BBtmIp0+ZjTBNCOYbVC7tVGXjwCuYcA/jzKWIGQ UO2lzIbKpFiSCYqg/dtKLOGAPKmRtX2JVhRcfpQ9auGA9LvzgF7NGCkDMLiYSwY5t8 4RqZ6LfkKX1Br9pO2pQ6g+NiXvgBkA4iEJpAsKIeUHe/BT7rTWfCUq/FfiQKZ2bxHS pM56dD/xy/l6A== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id ECA2F64C25; Sat, 20 Dec 2025 16:24:37 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:48 -0700 Message-ID: <20251220232355.845414-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: FQY4VR3HRTZ2LGZ3LSYDV3QJIWYVMNPF X-Message-ID-Hash: FQY4VR3HRTZ2LGZ3LSYDV3QJIWYVMNPF 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/10] ext4l: Add inode.c to build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add inode.c to the Makefile with minimal changes: - Replace Linux kernel includes with ext4_uboot.h - Add cast in ext4_inode_peek_iversion() to fix const qualifier warning - Add __maybe_unused to variables in ext4_print_free_blocks() Update ext4_uboot.h with additional stubs needed by inode.c: - address_space_operations: add migrate_folio, swap_activate members, fix write_begin/write_end/writepages signatures - Add buffer_migrate_folio, buffer_migrate_folio_norefs, noop_dirty_folio Add stub functions in stub.c for inode.c dependencies: - Inline data: ext4_try_to_write_inline_data, ext4_generic_write_inline_data, ext4_write_inline_data_end - xattr: ext4_xattr_delete_inode, ext4_xattr_inode_array_free - JBD2: jbd2_inode_cache, jbd2_journal_try_to_free_buffers, jbd2_journal_init_jbd_inode Also add required stub headers: - linux/mpage.h - multi-page I/O stub - linux/rmap.h - reverse mapping stub - linux/atomic.h - atomic operations stub Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 523 ++++++++++++++++++++++++++++++++++++++++- fs/ext4l/file.c | 20 +- fs/ext4l/inode.c | 39 +-- fs/ext4l/stub.c | 311 +++++++++++++++++------- include/linux/atomic.h | 0 include/linux/fs.h | 22 +- include/linux/iomap.h | 8 + include/linux/jbd2.h | 3 + include/linux/mpage.h | 14 ++ include/linux/rmap.h | 7 + include/linux/sched.h | 1 + 12 files changed, 804 insertions(+), 146 deletions(-) create mode 100644 include/linux/atomic.h create mode 100644 include/linux/mpage.h create mode 100644 include/linux/rmap.h diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 4a8a94035b9..f9c0f77b8ed 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -7,6 +7,6 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \ extents_status.o hash.o ialloc.o \ - indirect.o \ + indirect.o inode.o \ xattr_hurd.o xattr_trusted.o \ xattr_user.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index ea28d0fcc63..3f11fb47544 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -20,6 +20,8 @@ #include #include #include +#include +#include /* Rotate left - not available in U-Boot */ static inline u32 rol32(u32 word, unsigned int shift) @@ -165,16 +167,6 @@ typedef unsigned long pgoff_t; #define PAGE_SHIFT 12 #endif -/* File readahead state - stub */ -struct file_ra_state { - pgoff_t start; - unsigned int size; - unsigned int async_size; - unsigned int ra_pages; - unsigned int mmap_miss; - loff_t prev_pos; -}; - /* File mode flags */ #define FMODE_32BITHASH 0x00000001 #define FMODE_64BITHASH 0x00000002 @@ -212,7 +204,7 @@ struct dir_context { }; /* iomap types - only define if linux/iomap.h not included */ -#ifndef _LINUX_IOMAP_H +#ifndef LINUX_IOMAP_H #define IOMAP_MAPPED 0 #define IOMAP_INLINE 1 #define IOMAP_UNWRITTEN 2 @@ -235,7 +227,7 @@ struct iomap_ops { int (*iomap_end)(struct inode *inode, loff_t pos, loff_t length, ssize_t written, unsigned flags, struct iomap *iomap); }; -#endif /* _LINUX_IOMAP_H */ +#endif /* LINUX_IOMAP_H */ /* fiemap types */ #define FIEMAP_FLAG_SYNC 0x00000001 @@ -625,8 +617,125 @@ static inline int bdev_read_only(struct block_device *bdev) /* Inode state bits */ #define I_NEW (1 << 0) #define I_FREEING (1 << 1) +#define I_DIRTY_DATASYNC (1 << 2) + +/* Inode flags for i_flags */ +#define S_SYNC 1 +#define S_NOATIME 2 +#define S_APPEND 4 +#define S_IMMUTABLE 8 +#define S_DAX 16 +#define S_DIRSYNC 32 +#define S_ENCRYPTED 64 +#define S_CASEFOLD 128 +#define S_VERITY 256 + +/* Inode dirty state flags */ +#define I_DIRTY_TIME (1 << 3) + +/* Superblock flags */ +#define SB_LAZYTIME (1 << 25) + +/* iattr valid flags */ +#define ATTR_MODE (1 << 0) +#define ATTR_UID (1 << 1) +#define ATTR_GID (1 << 2) +#define ATTR_SIZE (1 << 3) +#define ATTR_ATIME (1 << 4) +#define ATTR_MTIME (1 << 5) +#define ATTR_CTIME (1 << 6) +#define ATTR_ATIME_SET (1 << 7) +#define ATTR_MTIME_SET (1 << 8) +#define ATTR_FORCE (1 << 9) +#define ATTR_KILL_SUID (1 << 11) +#define ATTR_KILL_SGID (1 << 12) +#define ATTR_TIMES_SET ((1 << 7) | (1 << 8)) + +/* STATX flags and attributes */ +#define STATX_BTIME 0x00000800U +#define STATX_DIOALIGN 0x00002000U +#define STATX_WRITE_ATOMIC 0x00004000U +#define STATX_ATTR_COMPRESSED 0x00000004 +#define STATX_ATTR_IMMUTABLE 0x00000010 +#define STATX_ATTR_APPEND 0x00000020 +#define STATX_ATTR_NODUMP 0x00000040 +#define STATX_ATTR_ENCRYPTED 0x00000800 +#define STATX_ATTR_VERITY 0x00100000 + +/* VM fault return values */ +#define VM_FAULT_SIGBUS 0x0002 +#define VM_FAULT_NOPAGE 0x0010 +#define VM_FAULT_LOCKED 0x0200 + +/* struct path - filesystem path */ +struct path { + struct vfsmount *mnt; + struct dentry *dentry; +}; + +/* struct kstat - stat buffer */ +struct kstat { + u64 ino; + dev_t dev; + umode_t mode; + unsigned int nlink; + uid_t uid; + gid_t gid; + dev_t rdev; + loff_t size; + struct timespec64 atime; + struct timespec64 mtime; + struct timespec64 ctime; + struct timespec64 btime; + u64 blocks; + u32 blksize; + u64 attributes; + u64 attributes_mask; + u32 result_mask; + u32 dio_mem_align; + u32 dio_offset_align; + u32 atomic_write_unit_min; + u32 atomic_write_unit_max; + u32 atomic_write_segments_max; +}; + +/* struct vm_area_struct - virtual memory area */ +struct vm_area_struct { + unsigned long vm_start; + unsigned long vm_end; + struct file *vm_file; + unsigned long vm_flags; +}; -/* inode - minimal stub */ +/* struct page - minimal stub */ +struct page { + unsigned long flags; +}; + +/* struct vm_fault - virtual memory fault info */ +struct vm_fault { + struct vm_area_struct *vma; + unsigned long address; + unsigned int flags; + pgoff_t pgoff; + struct folio *folio; + struct page *page; +}; + +/* Forward declaration for swap */ +struct swap_info_struct; + +/* MAX_PAGECACHE_ORDER - maximum order for page cache allocations */ +#define MAX_PAGECACHE_ORDER 12 + +/* Process flags */ +#define PF_MEMALLOC 0x00000800 + +/* Forward declarations for inode operations */ +struct inode_operations; +struct file_operations; + +/* inode - extended for inode.c */ struct inode { struct super_block *i_sb; unsigned long i_ino; @@ -634,6 +743,7 @@ struct inode { unsigned int i_nlink; loff_t i_size; struct address_space *i_mapping; + struct address_space i_data; kuid_t i_uid; kgid_t i_gid; unsigned long i_blocks; @@ -644,9 +754,18 @@ struct inode { struct timespec64 i_atime; struct timespec64 i_mtime; struct timespec64 i_ctime; + struct list_head i_io_list; + dev_t i_rdev; + const struct inode_operations *i_op; + const struct file_operations *i_fop; }; /* Inode time accessors */ +static inline struct timespec64 inode_get_atime(const struct inode *inode) +{ + return inode->i_atime; +} + static inline struct timespec64 inode_get_mtime(const struct inode *inode) { return inode->i_mtime; @@ -657,6 +776,11 @@ static inline struct timespec64 inode_get_ctime(const struct inode *inode) return inode->i_ctime; } +static inline time_t inode_get_atime_sec(const struct inode *inode) +{ + return inode->i_atime.tv_sec; +} + static inline void simple_inode_init_ts(struct inode *inode) { struct timespec64 ts = { .tv_sec = 0, .tv_nsec = 0 }; @@ -905,4 +1029,377 @@ static inline ktime_t ktime_sub(ktime_t a, ktime_t b) /* seq_file tokens */ #define SEQ_START_TOKEN ((void *)1) +/* folio - memory page container stub */ +struct folio { + struct address_space *mapping; + unsigned long index; +}; + +/* folio_batch - batch of folios */ +struct folio_batch { + unsigned int nr; + struct folio *folios[16]; +}; + +/* folio operations - stubs */ +#define folio_mark_dirty(f) do { (void)(f); } while (0) +#define offset_in_folio(f, p) ({ (void)(f); (unsigned int)((p) & (PAGE_SIZE - 1)); }) +#define folio_buffers(f) ({ (void)(f); (struct buffer_head *)NULL; }) +#define folio_test_uptodate(f) ({ (void)(f); 1; }) +#define folio_pos(f) ({ (void)(f); 0LL; }) +#define folio_size(f) ({ (void)(f); PAGE_SIZE; }) +#define folio_unlock(f) do { (void)(f); } while (0) +#define folio_put(f) do { (void)(f); } while (0) +#define folio_lock(f) do { (void)(f); } while (0) +#define folio_batch_init(fb) do { (fb)->nr = 0; } while (0) +#define filemap_get_folios(m, i, e, fb) ({ (void)(m); (void)(i); (void)(e); (void)(fb); 0U; }) + +/* xa_mark_t - xarray mark type */ +typedef unsigned int xa_mark_t; + +/* Page cache tags */ +#define PAGECACHE_TAG_DIRTY 0 +#define PAGECACHE_TAG_TOWRITE 1 +#define PAGECACHE_TAG_WRITEBACK 2 + +/* blk_plug - block I/O plugging stub */ +struct blk_plug { + int dummy; +}; +#define blk_start_plug(p) do { (void)(p); } while (0) +#define blk_finish_plug(p) do { (void)(p); } while (0) + +/* Writeback reasons */ +#define WB_REASON_FS_FREE_SPACE 0 + +/* readahead_control stub */ +struct readahead_control { + struct address_space *mapping; + struct file *file; + unsigned long _index; + unsigned int _batch_count; +}; + +#define readahead_pos(rac) ({ (void)(rac); 0LL; }) +#define readahead_length(rac) ({ (void)(rac); 0UL; }) + +/* Forward declarations for address_space_operations */ +struct writeback_control; +struct swap_info_struct; + +/* address_space_operations stub */ +struct address_space_operations { + int (*read_folio)(struct file *, struct folio *); + void (*readahead)(struct readahead_control *); + sector_t (*bmap)(struct address_space *, sector_t); + void (*invalidate_folio)(struct folio *, unsigned long, unsigned long); + bool (*release_folio)(struct folio *, gfp_t); + int (*write_begin)(const struct kiocb *, struct address_space *, loff_t, unsigned, struct folio **, void **); + int (*write_end)(const struct kiocb *, struct address_space *, loff_t, unsigned, unsigned, struct folio *, void *); + int (*writepages)(struct address_space *, struct writeback_control *); + bool (*dirty_folio)(struct address_space *, struct folio *); + bool (*is_partially_uptodate)(struct folio *, size_t, size_t); + int (*error_remove_folio)(struct address_space *, struct folio *); + int (*migrate_folio)(struct address_space *, struct folio *, struct folio *, int); + int (*swap_activate)(struct swap_info_struct *, struct file *, sector_t *); +}; + +/* Stub for buffer_migrate_folio */ +static inline int buffer_migrate_folio(struct address_space *mapping, + struct folio *dst, struct folio *src, int mode) +{ + return -EOPNOTSUPP; +} + +/* Stub for buffer_migrate_folio_norefs */ +static inline int buffer_migrate_folio_norefs(struct address_space *mapping, + struct folio *dst, struct folio *src, int mode) +{ + return -EOPNOTSUPP; +} + +/* Stub for noop_dirty_folio */ +static inline bool noop_dirty_folio(struct address_space *mapping, + struct folio *folio) +{ + return false; +} + +/* Stub implementations for address_space_operations callbacks */ +static inline bool block_is_partially_uptodate(struct folio *folio, + size_t from, size_t count) +{ + return false; +} + +static inline int generic_error_remove_folio(struct address_space *mapping, + struct folio *folio) +{ + return 0; +} + +/* FGP flags for folio_grab_cache */ +#define FGP_ACCESSED 0x00000001 +#define FGP_LOCK 0x00000002 +#define FGP_CREAT 0x00000004 +#define FGP_WRITE 0x00000008 +#define FGP_NOFS 0x00000010 +#define FGP_NOWAIT 0x00000020 +#define FGP_FOR_MMAP 0x00000040 +#define FGP_STABLE 0x00000080 + +/* __filemap_get_folio stub */ +static inline struct folio *__filemap_get_folio(struct address_space *mapping, + pgoff_t index, unsigned int fgp_flags, + gfp_t gfp) +{ + return NULL; +} + +/* projid_t - project ID type */ +typedef unsigned int projid_t; + +/* + * Additional stubs for inode.c + */ + +/* try_cmpxchg - compare and exchange with return value */ +#define try_cmpxchg(ptr, old, new) ({ \ + typeof(*(old)) __old = *(old); \ + typeof(*(ptr)) __ret = cmpxchg(ptr, __old, (new)); \ + if (__ret != __old) \ + *(old) = __ret; \ + __ret == __old; \ +}) + +/* ilog2 - log base 2 */ +#include +#define ilog2(n) (fls(n) - 1) + +/* Trace stubs for inode.c */ +#define trace_ext4_begin_ordered_truncate(...) do { } while (0) +#define trace_ext4_evict_inode(...) do { } while (0) +#define trace_ext4_da_update_reserve_space(...) do { } while (0) +#define trace_ext4_da_reserve_space(...) do { } while (0) +#define trace_ext4_da_release_space(...) do { } while (0) +#define trace_ext4_da_write_pages_extent(...) do { } while (0) +#define trace_ext4_writepages(...) do { } while (0) +#define trace_ext4_da_write_folios_start(...) do { } while (0) +#define trace_ext4_da_write_folios_end(...) do { } while (0) +#define trace_ext4_writepages_result(...) do { } while (0) +#define trace_ext4_da_write_begin(...) do { } while (0) +#define trace_ext4_da_write_end(...) do { } while (0) +#define trace_ext4_alloc_da_blocks(...) do { } while (0) +#define trace_ext4_read_folio(...) do { } while (0) +#define trace_ext4_invalidate_folio(...) do { } while (0) +#define trace_ext4_journalled_invalidate_folio(...) do { } while (0) +#define trace_ext4_release_folio(...) do { } while (0) +#define trace_ext4_punch_hole(...) do { } while (0) +#define trace_ext4_truncate_enter(...) do { } while (0) +#define trace_ext4_truncate_exit(...) do { } while (0) +#define trace_ext4_load_inode(...) do { } while (0) +#define trace_ext4_other_inode_update_time(...) do { } while (0) +#define trace_ext4_mark_inode_dirty(...) do { } while (0) +#define trace_ext4_write_begin(...) do { } while (0) +#define trace_ext4_write_end(...) do { } while (0) +#define trace_ext4_journalled_write_end(...) do { } while (0) + +/* DAX stubs - DAX not supported in U-Boot */ +#define IS_DAX(inode) (0) +#define dax_break_layout_final(inode) do { } while (0) +#define dax_writeback_mapping_range(m, bd, wb) ({ (void)(m); (void)(bd); (void)(wb); 0; }) +#define dax_zero_range(i, p, l, d, op) ({ (void)(i); (void)(p); (void)(l); (void)(d); (void)(op); -EOPNOTSUPP; }) +#define dax_break_layout_inode(i, m) ({ (void)(i); (void)(m); 0; }) + +/* Superblock freezing stubs */ +#define sb_start_intwrite(sb) do { (void)(sb); } while (0) +#define sb_end_intwrite(sb) do { (void)(sb); } while (0) +#define sb_start_pagefault(sb) do { (void)(sb); } while (0) +#define sb_end_pagefault(sb) do { (void)(sb); } while (0) + +/* 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) + +/* Folio operations - additional stubs */ +#define folio_zero_segments(f, s1, e1, s2, e2) do { } while (0) +#define folio_zero_new_buffers(f, f2, t) do { } while (0) +#define folio_wait_stable(f) do { } while (0) +#define folio_zero_range(f, s, l) do { } while (0) +#define folio_mark_uptodate(f) do { } while (0) +#define folio_next_index(f) ((f)->index + 1) +#define folio_mapped(f) (0) +#define folio_clear_dirty_for_io(f) ({ (void)(f); 1; }) +#define folio_clear_uptodate(f) do { } while (0) +#define folio_batch_release(fb) do { } while (0) +#define folio_nr_pages(f) (1UL) +#define folio_contains(f, idx) ({ (void)(f); (void)(idx); 1; }) +#define folio_clear_checked(f) do { } while (0) +#define folio_test_dirty(f) (0) +#define folio_test_writeback(f) (0) +#define folio_wait_writeback(f) do { } while (0) +#define folio_clear_dirty(f) do { } while (0) +#define folio_test_checked(f) (0) +#define folio_maybe_dma_pinned(f) (0) +#define folio_set_checked(f) do { } while (0) +#define folio_test_locked(f) (0) +#define folio_mkclean(f) (0) +#define page_folio(page) ((struct folio *)(page)) + +/* Quota stubs - additional */ +#define dquot_claim_block(i, n) ({ (void)(i); (void)(n); 0; }) +#define dquot_reserve_block(i, n) ({ (void)(i); (void)(n); 0; }) +#define dquot_release_reservation_block(i, n) do { } while (0) +#define dquot_initialize_needed(i) (0) +#define dquot_transfer(m, i, a) ({ (void)(m); (void)(i); (void)(a); 0; }) +#define is_quota_modification(m, i, a) ({ (void)(m); (void)(i); (void)(a); 0; }) + +/* Percpu counter sub */ +#define percpu_counter_sub(fbc, amount) ((fbc)->count -= (amount)) + +/* Filemap operations - additional */ +#define filemap_get_folio(m, i) ((struct folio *)NULL) +#define filemap_get_folios_tag(m, s, e, t, fb) ({ (void)(m); (void)(s); (void)(e); (void)(t); (void)(fb); 0U; }) +#define filemap_flush(m) ({ (void)(m); 0; }) +#define filemap_write_and_wait(m) ({ (void)(m); 0; }) +#define filemap_dirty_folio(m, f) ({ (void)(m); (void)(f); false; }) +#define filemap_lock_folio(m, i) ((struct folio *)NULL) +#define filemap_invalidate_lock_shared(m) do { } while (0) +#define filemap_invalidate_unlock_shared(m) do { } while (0) +#define mapping_tagged(m, t) (0) +#define tag_pages_for_writeback(m, s, e) do { } while (0) +#define try_to_writeback_inodes_sb(sb, r) do { } while (0) +#define mapping_gfp_constraint(m, g) (g) +#define mapping_set_folio_order_range(m, l, h) do { } while (0) + +/* Buffer operations - additional */ +#define getblk_unmovable(bd, b, s) ((struct buffer_head *)NULL) +#define create_empty_buffers(f, s, flags) ({ (void)(f); (void)(s); (void)(flags); (struct buffer_head *)NULL; }) +#define bh_offset(bh) (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; }) + +/* fscrypt stubs - additional */ +#define fscrypt_inode_uses_fs_layer_crypto(i) (0) +#define fscrypt_decrypt_pagecache_blocks(f, l, o) ({ (void)(f); (void)(l); (void)(o); 0; }) +#define fscrypt_zeroout_range(i, lb, pb, l) ({ (void)(i); (void)(lb); (void)(pb); (void)(l); 0; }) +#define fscrypt_limit_io_blocks(i, lb, l) (l) +#define fscrypt_prepare_setattr(d, a) ({ (void)(d); (void)(a); 0; }) +#define fscrypt_dio_supported(i) (1) + +/* fsverity stubs */ +#define fsverity_prepare_setattr(d, a) ({ (void)(d); (void)(a); 0; }) +#define fsverity_active(i) (0) + +/* Inode time setters - needed for ext4.h */ +static inline struct timespec64 inode_set_atime_to_ts(struct inode *inode, + struct timespec64 ts) +{ + inode->i_atime = ts; + return ts; +} + +static inline struct timespec64 inode_set_ctime_to_ts(struct inode *inode, + struct timespec64 ts) +{ + inode->i_ctime = ts; + return ts; +} + +/* Inode version operations */ +#define inode_peek_iversion_raw(i) (0ULL) +#define inode_peek_iversion(i) (0ULL) +#define inode_set_flags(i, f, m) do { } while (0) +#define inode_set_iversion_raw(i, v) do { } while (0) +#define inode_set_iversion_queried(i, v) do { } while (0) +#define inode_inc_iversion(i) do { } while (0) + +/* Inode credential helpers */ +static inline unsigned int i_uid_read(const struct inode *inode) +{ + return inode->i_uid.val; +} + +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) + +/* Device encoding helpers */ +#ifndef MINORBITS +#define MINORBITS 20 +#endif +#ifndef MINORMASK +#define MINORMASK ((1U << MINORBITS) - 1) +#endif +#ifndef MAJOR +#define MAJOR(dev) ((unsigned int)((dev) >> MINORBITS)) +#endif +#ifndef MINOR +#define MINOR(dev) ((unsigned int)((dev) & MINORMASK)) +#endif +#ifndef MKDEV +#define MKDEV(ma, mi) (((ma) << MINORBITS) | (mi)) +#endif + +#define old_valid_dev(dev) (MAJOR(dev) < 256 && MINOR(dev) < 256) +#define old_encode_dev(dev) ((MAJOR(dev) << 8) | MINOR(dev)) +#define old_decode_dev(dev) MKDEV((dev) >> 8, (dev) & 0xff) +#define new_encode_dev(dev) ((unsigned int)(dev)) +#define new_decode_dev(dev) ((dev_t)(dev)) + +/* UID/GID bit helpers */ +#define low_16_bits(x) ((x) & 0xFFFF) +#define high_16_bits(x) (((x) >> 16) & 0xFFFF) +#define fs_high2lowuid(uid) ((uid) & 0xFFFF) +#define fs_high2lowgid(gid) ((gid) & 0xFFFF) + +/* Inode allocation/state operations */ +#define iget_locked(sb, ino) ((struct inode *)NULL) +#define set_nlink(i, n) do { (i)->i_nlink = (n); } 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) + +/* Attribute operations */ +#define setattr_prepare(m, d, a) ({ (void)(m); (void)(d); (void)(a); 0; }) +#define setattr_copy(m, i, a) do { } while (0) +#define posix_acl_chmod(m, i, mo) ({ (void)(m); (void)(i); (void)(mo); 0; }) +#define generic_fillattr(m, req, i, s) do { } while (0) +#define generic_fill_statx_atomic_writes(s, u_m, u_M, g) do { } while (0) + +/* Inode flag macros */ +#define IS_APPEND(inode) ((inode)->i_flags & S_APPEND) +#define IS_IMMUTABLE(inode) ((inode)->i_flags & S_IMMUTABLE) + +/* File operations */ +#define file_update_time(f) do { } while (0) +#define vmf_fs_error(e) ((vm_fault_t)VM_FAULT_SIGBUS) + +/* iomap stubs */ +#define iomap_bmap(m, b, o) ({ (void)(m); (void)(b); (void)(o); 0UL; }) +#define iomap_swapfile_activate(s, f, sp, o) ({ (void)(s); (void)(f); (void)(sp); (void)(o); -EOPNOTSUPP; }) + +/* Block device alignment */ +#define bdev_dma_alignment(bd) (0) + +/* Truncation */ +#define truncate_inode_pages_final(m) do { } while (0) +#define truncate_pagecache_range(i, s, e) do { } while (0) + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/file.c b/fs/ext4l/file.c index 7a8b3093218..6cff27e7029 100644 --- a/fs/ext4l/file.c +++ b/fs/ext4l/file.c @@ -20,16 +20,8 @@ */ #include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ext4_uboot.h" #include -#include #include "ext4.h" #include "ext4_jbd2.h" #include "xattr.h" @@ -69,7 +61,7 @@ static bool ext4_should_use_dio(struct kiocb *iocb, struct iov_iter *iter) static ssize_t ext4_dio_read_iter(struct kiocb *iocb, struct iov_iter *to) { ssize_t ret; - struct inode *inode = file_inode(iocb->ki_filp); + struct inode *inode __maybe_unused = file_inode(iocb->ki_filp); if (iocb->ki_flags & IOCB_NOWAIT) { if (!inode_trylock_shared(inode)) @@ -286,7 +278,7 @@ static ssize_t ext4_buffered_write_iter(struct kiocb *iocb, struct iov_iter *from) { ssize_t ret; - struct inode *inode = file_inode(iocb->ki_filp); + struct inode *inode __maybe_unused = file_inode(iocb->ki_filp); if (iocb->ki_flags & IOCB_NOWAIT) return -EOPNOTSUPP; @@ -402,7 +394,7 @@ static int ext4_dio_write_end_io(struct kiocb *iocb, ssize_t size, return error < 0 ? error : 0; } -static const struct iomap_dio_ops ext4_dio_write_ops = { +static const struct iomap_dio_ops __maybe_unused ext4_dio_write_ops = { .end_io = ext4_dio_write_end_io, }; @@ -809,7 +801,7 @@ static int ext4_file_mmap_prepare(struct vm_area_desc *desc) int ret; struct file *file = desc->file; struct inode *inode = file->f_mapping->host; - struct dax_device *dax_dev = EXT4_SB(inode->i_sb)->s_daxdev; + struct dax_device *dax_dev __maybe_unused = EXT4_SB(inode->i_sb)->s_daxdev; if (file->f_mode & FMODE_WRITE) ret = ext4_emergency_state(inode->i_sb); @@ -935,7 +927,7 @@ static int ext4_file_open(struct inode *inode, struct file *filp) loff_t ext4_llseek(struct file *file, loff_t offset, int whence) { struct inode *inode = file->f_mapping->host; - loff_t maxbytes = ext4_get_maxbytes(inode); + loff_t maxbytes __maybe_unused = ext4_get_maxbytes(inode); switch (whence) { default: diff --git a/fs/ext4l/inode.c b/fs/ext4l/inode.c index e99306a8f47..dc151c068bb 100644 --- a/fs/ext4l/inode.c +++ b/fs/ext4l/inode.c @@ -19,29 +19,7 @@ * Assorted race fixes, rewrite of ext4_get_block() by Al Viro, 2000 */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ext4_uboot.h" #include "ext4_jbd2.h" #include "xattr.h" @@ -1763,9 +1741,9 @@ static void mpage_release_unused_pages(struct mpage_da_data *mpd, static void ext4_print_free_blocks(struct inode *inode) { - struct ext4_sb_info *sbi = EXT4_SB(inode->i_sb); + struct ext4_sb_info *sbi __maybe_unused = EXT4_SB(inode->i_sb); struct super_block *sb = inode->i_sb; - struct ext4_inode_info *ei = EXT4_I(inode); + struct ext4_inode_info *ei __maybe_unused = EXT4_I(inode); ext4_msg(sb, KERN_CRIT, "Total free blocks count %lld", EXT4_C2B(EXT4_SB(inode->i_sb), @@ -2758,7 +2736,7 @@ static int ext4_do_writepages(struct mpage_da_data *mpd) { struct writeback_control *wbc = mpd->wbc; pgoff_t writeback_index = 0; - long nr_to_write = wbc->nr_to_write; + __maybe_unused long nr_to_write = wbc->nr_to_write; int range_whole = 0; int cycled = 1; handle_t *handle = NULL; @@ -3055,7 +3033,7 @@ static int ext4_dax_writepages(struct address_space *mapping, struct writeback_control *wbc) { int ret; - long nr_to_write = wbc->nr_to_write; + __maybe_unused long nr_to_write = wbc->nr_to_write; struct inode *inode = mapping->host; int alloc_ctx; @@ -4541,7 +4519,7 @@ int ext4_inode_attach_jinode(struct inode *inode) */ int ext4_truncate(struct inode *inode) { - struct ext4_inode_info *ei = EXT4_I(inode); + __maybe_unused struct ext4_inode_info *ei = EXT4_I(inode); unsigned int credits; int err = 0, err2; handle_t *handle; @@ -4646,7 +4624,7 @@ out_trace: static inline u64 ext4_inode_peek_iversion(const struct inode *inode) { - if (unlikely(EXT4_I(inode)->i_flags & EXT4_EA_INODE_FL)) + if (unlikely(EXT4_I((struct inode *)inode)->i_flags & EXT4_EA_INODE_FL)) return inode_peek_iversion_raw(inode); else return inode_peek_iversion(inode); @@ -6094,7 +6072,8 @@ int ext4_getattr(struct mnt_idmap *idmap, const struct path *path, stat->result_mask |= STATX_DIOALIGN; if (dio_align == 1) { - struct block_device *bdev = inode->i_sb->s_bdev; + __maybe_unused struct block_device *bdev = + inode->i_sb->s_bdev; /* iomap defaults */ stat->dio_mem_align = bdev_dma_alignment(bdev) + 1; diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 41550bc48bc..2c9c460f0e7 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -9,6 +9,7 @@ * DO NOT use this file as a reference - these are temporary placeholders only. */ +#include "ext4_uboot.h" #include struct super_block; @@ -37,18 +38,6 @@ unsigned long ext4_inode_table(struct super_block *sb, void *gdp) return 0; } -struct inode *__ext4_iget(struct super_block *sb, unsigned long ino, - int flags, const char *func, unsigned int line) -{ - return NULL; -} - -int ext4_map_blocks(void *handle, struct inode *inode, - struct ext4_map_blocks *map, int flags) -{ - return 0; -} - void __ext4_error_inode(struct inode *inode, const char *func, unsigned int line, unsigned long block, int error, const char *fmt, ...) @@ -250,194 +239,344 @@ struct extent_status; /* ext4_es_cache_extent is now in extents_status.c */ -int ext4_issue_zeroout(struct inode *inode, unsigned long long lblk, - unsigned long long pblk, unsigned long long len) +/* ext4_es_insert_extent is now in extents_status.c */ + +/* ext4_remove_pending is now in extents_status.c */ + +void ext4_free_blocks(void *handle, struct inode *inode, + struct buffer_head *bh, unsigned long long block, + unsigned long count, int flags) +{ +} + +void ext4_discard_preallocations(struct inode *inode, unsigned int needed) +{ +} + +/* ext4_is_pending is now in extents_status.c */ + +int ext4_convert_inline_data(struct inode *inode) { return 0; } -/* ext4_es_insert_extent is now in extents_status.c */ +void ext4_fc_mark_ineligible(struct super_block *sb, int reason, + void *handle) +{ +} -/* ext4_remove_pending is now in extents_status.c */ +/* ext4_es_lookup_extent is now in extents_status.c */ + +/* ext4_es_remove_extent is now in extents_status.c */ -void ext4_da_release_space(struct inode *inode, int to_free) +/* ext4_es_find_extent_range is now in extents_status.c */ + +void ext4_mb_mark_bb(struct super_block *sb, unsigned long long block, + int len, int state) { } -void ext4_da_update_reserve_space(struct inode *inode, int used, int quota_claim) +void ext4_fc_record_regions(struct super_block *sb, int ino, + unsigned long lblk, unsigned long long pblk, + int len, int mapped) { } -int ext4_get_inode_loc(struct inode *inode, void *iloc) +int ext4_read_bh(struct buffer_head *bh, unsigned int op_flags, + bh_end_io_t *end_io, bool simu_fail) { - return -1; + return 0; } -void ext4_free_blocks(void *handle, struct inode *inode, - struct buffer_head *bh, unsigned long long block, - unsigned long count, int flags) +struct buffer_head *ext4_sb_bread_nofail(struct super_block *sb, + unsigned long long block) { + return NULL; } -int __ext4_mark_inode_dirty(void *handle, struct inode *inode, int flags) +/* + * Stubs for ialloc.c - xattr functions + */ +int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, + struct buffer_head *block_bh, size_t value_len, + bool is_create) { return 0; } -void ext4_discard_preallocations(struct inode *inode, unsigned int needed) +/* ext4_init_security stub is provided by xattr.h */ + +/* + * Stubs for xattr_trusted.c + */ +int ext4_xattr_get(struct inode *inode, int name_index, const char *name, + void *buffer, size_t buffer_size) +{ + return -1; +} + +int ext4_xattr_set(struct inode *inode, int name_index, const char *name, + const void *value, size_t value_len, int flags) +{ + return -1; +} + +/* + * Stubs for orphan.c + */ +struct ext4_iloc; + +void ext4_superblock_csum_set(struct super_block *sb) +{ +} + +int ext4_feature_set_ok(struct super_block *sb, int readonly) +{ + return 1; +} + +/* + * Stubs for inode.c + */ +#include + +/* JBD2 stubs for inode.c */ +int jbd2_journal_blocks_per_folio(struct inode *inode) +{ + return 1; +} + +int jbd2_transaction_committed(void *journal, unsigned int tid) +{ + return 1; +} + + +void __ext4_warning_inode(struct inode *inode, const char *func, + unsigned int line, const char *fmt, ...) { } -int ext4_check_map_extents_env(struct inode *inode) + +/* Readahead */ +int ext4_mpage_readpages(void *mapping, void *rac, void *folio) { return 0; } -int ext4_chunk_trans_extent(struct inode *inode, int nrblocks) +int ext4_readpage_inline(struct inode *inode, void *folio) { return 0; } -int ext4_chunk_trans_blocks(struct inode *inode, int nrblocks) +/* Xattr */ +int ext4_expand_extra_isize_ea(struct inode *inode, int new_extra_isize, + void *raw_inode, void *handle) { return 0; } -/* ext4_is_pending is now in extents_status.c */ +void ext4_evict_ea_inode(struct inode *inode) +{ +} -int ext4_meta_trans_blocks(struct inode *inode, int lblk, int pblk) + +/* More JBD2 stubs */ +int jbd2_journal_inode_ranged_write(void *handle, struct inode *inode, + loff_t start, loff_t len) { return 0; } -int ext4_zero_partial_blocks(void *handle, struct inode *inode, - loff_t lstart, loff_t length) + +int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, int nowait) { return 0; } -int ext4_convert_inline_data(struct inode *inode) + +/* Fast commit */ +int ext4_fc_commit(void *journal, unsigned int tid) { return 0; } -int ext4_break_layouts(struct inode *inode) +int ext4_force_commit(struct super_block *sb) { return 0; } -int ext4_punch_hole(struct file *file, loff_t offset, loff_t length) + +/* Inline data */ +int ext4_destroy_inline_data(void *handle, struct inode *inode) { return 0; } -void ext4_fc_mark_ineligible(struct super_block *sb, int reason, - void *handle) +/* I/O submit */ +void ext4_io_submit_init(void *io, void *wbc) { } -void ext4_update_disksize_before_punch(struct inode *inode, loff_t offset, - loff_t len) + +void *ext4_init_io_end(struct inode *inode, int gfp) { + return NULL; } -void ext4_truncate_page_cache_block_range(struct inode *inode, loff_t start, - loff_t len) +void ext4_io_submit(void *io) { } -/* ext4_iomap_report_ops - just a symbol needed for linking */ -char ext4_iomap_report_ops; +void ext4_put_io_end_defer(void *io_end) +{ +} -/* ext4_es_lookup_extent is now in extents_status.c */ +void ext4_put_io_end(void *io_end) +{ +} -/* ext4_es_remove_extent is now in extents_status.c */ +void *ext4_alloc_io_end_vec(void *io_end, unsigned long num) +{ + return NULL; +} -/* ext4_es_find_extent_range is now in extents_status.c */ -void ext4_mb_mark_bb(struct super_block *sb, unsigned long long block, - int len, int state) +/* JBD2 ordered truncate */ +int jbd2_journal_begin_ordered_truncate(void *ji, loff_t new_size) { + return 0; } -void ext4_fc_record_regions(struct super_block *sb, int ino, - unsigned long lblk, unsigned long long pblk, - int len, int mapped) +void jbd2_journal_invalidate_folio(void *journal, void *folio, + unsigned long off, unsigned int len) { } -int ext4_read_bh(struct buffer_head *bh, unsigned int op_flags, - bh_end_io_t *end_io, bool simu_fail) +int jbd2_log_wait_commit(void *journal, unsigned int tid) { return 0; } -struct buffer_head *ext4_sb_bread_nofail(struct super_block *sb, - unsigned long long block) +/* Fast commit */ +void ext4_fc_track_range(void *handle, struct inode *inode, + unsigned long long start, unsigned long long end) { - return NULL; } -/* - * Stubs for ialloc.c - xattr functions - */ -int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, - struct buffer_head *block_bh, size_t value_len, - bool is_create) + +/* JBD2 journal update locking */ +void jbd2_journal_lock_updates(void *journal) +{ +} + +void jbd2_journal_unlock_updates(void *journal) +{ +} + +int jbd2_journal_flush(void *journal, unsigned int flags) { return 0; } -/* ext4_init_security stub is provided by xattr.h */ -/* - * Stubs for xattr_trusted.c - */ -int ext4_xattr_get(struct inode *inode, int name_index, const char *name, - void *buffer, size_t buffer_size) +/* Fast commit */ +void ext4_fc_track_inode(void *handle, struct inode *inode) { - return -1; } -int ext4_xattr_set(struct inode *inode, int name_index, const char *name, - const void *value, size_t value_len, int flags) +void ext4_fc_init_inode(void **head, struct inode *inode) { - return -1; } -/* - * Stubs for orphan.c - */ -struct ext4_iloc; +/* JBD2 */ +int jbd2_journal_inode_ranged_wait(void *handle, struct inode *inode, + loff_t start, loff_t len) +{ + return 0; +} -int ext4_reserve_inode_write(void *handle, struct inode *inode, - struct ext4_iloc *iloc) +/* Inline data */ +int ext4_inline_data_iomap(struct inode *inode, void *iomap) { return 0; } -void ext4_superblock_csum_set(struct super_block *sb) + +/* xattr */ +int __xattr_check_inode(struct inode *inode, void *entry, void *end, + unsigned int size, int check_block) { + return 0; } -int ext4_mark_iloc_dirty(void *handle, struct inode *inode, - struct ext4_iloc *iloc) +int ext4_find_inline_data_nolock(struct inode *inode) { return 0; } -int ext4_truncate(struct inode *inode) + +/* File and inode operations symbols */ +char ext4_file_inode_operations; +char ext4_file_operations; +char ext4_dir_inode_operations; +char ext4_dir_operations; +char ext4_special_inode_operations; +char ext4_symlink_inode_operations; +char ext4_fast_symlink_inode_operations; + + +void ext4_update_dynamic_rev(struct super_block *sb) { +} + + +/* Inline data */ +int ext4_inline_data_truncate(struct inode *inode, int *has_inline) +{ + *has_inline = 0; return 0; } -int ext4_feature_set_ok(struct super_block *sb, int readonly) +int ext4_try_to_write_inline_data(struct address_space *mapping, + struct inode *inode, loff_t pos, + unsigned int len, struct folio **foliop) +{ + return 0; +} + +int ext4_generic_write_inline_data(struct address_space *mapping, + struct inode *inode, loff_t pos, + unsigned int len, struct folio **foliop) +{ + return 0; +} + +int ext4_write_inline_data_end(struct inode *inode, loff_t pos, unsigned int len, + unsigned int copied, struct folio *folio) +{ + return copied; +} + +/* xattr stubs for inode.c */ +int ext4_xattr_delete_inode(handle_t *handle, struct inode *inode, + void **array, int extra_credits) +{ + return 0; +} + +void ext4_xattr_inode_array_free(void *array) +{ +} + +/* JBD2 stubs for inode.c */ +struct kmem_cache *jbd2_inode_cache; + +int jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio) { return 1; } -struct buffer_head *ext4_bread(void *handle, struct inode *inode, - unsigned long long block, int create) +void jbd2_journal_init_jbd_inode(void *jinode, struct inode *inode) { - return NULL; } diff --git a/include/linux/atomic.h b/include/linux/atomic.h new file mode 100644 index 00000000000..e69de29bb2d diff --git a/include/linux/fs.h b/include/linux/fs.h index 8242d1ca35e..0af81af5644 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -15,6 +15,7 @@ struct inode; struct super_block; struct buffer_head; +struct address_space_operations; /* errseq_t - error sequence type */ typedef u32 errseq_t; @@ -29,16 +30,21 @@ typedef unsigned int fmode_t; /* Buffer operations are in buffer_head.h */ -/* address_space - minimal stub */ +/* address_space - extended for inode.c */ struct address_space { struct inode *host; - errseq_t wb_err; /* For jbd2 error tracking */ + errseq_t wb_err; + unsigned long nrpages; + unsigned long writeback_index; + struct list_head i_private_list; + const struct address_space_operations *a_ops; }; /* block_device - minimal stub */ struct block_device { struct address_space *bd_mapping; void *bd_disk; + struct super_block *bd_super; }; /* errseq functions - stubs */ @@ -52,12 +58,24 @@ static inline int errseq_check_and_advance(errseq_t *eseq, errseq_t *since) return 0; } +/* File readahead state - stub */ +struct file_ra_state { + unsigned long start; + unsigned int size; + unsigned int async_size; + unsigned int ra_pages; + unsigned int mmap_miss; + long long prev_pos; +}; + /* file - minimal stub */ struct file { fmode_t f_mode; struct inode *f_inode; unsigned int f_flags; struct address_space *f_mapping; + void *private_data; + struct file_ra_state f_ra; }; /* Get inode from file */ diff --git a/include/linux/iomap.h b/include/linux/iomap.h index e390dc611ca..3bd4070cfdb 100644 --- a/include/linux/iomap.h +++ b/include/linux/iomap.h @@ -5,6 +5,7 @@ #include struct bio; +struct dax_device; struct inode; struct iomap_iter; struct kiocb; @@ -37,6 +38,13 @@ struct vm_fault; #define IOMAP_OVERWRITE_ONLY (1 << 6) #define IOMAP_UNSHARE (1 << 7) #define IOMAP_DAX (1 << 8) +#define IOMAP_ATOMIC (1 << 9) + +/* IOMAP_NULL_ADDR indicates a hole/unwritten block address */ +#define IOMAP_NULL_ADDR ((u64)-1) + +/* Additional iomap flags */ +#define IOMAP_F_ATOMIC_BIO (1U << 6) struct iomap { u64 addr; diff --git a/include/linux/jbd2.h b/include/linux/jbd2.h index f72d7d4b538..35b68ffc0fd 100644 --- a/include/linux/jbd2.h +++ b/include/linux/jbd2.h @@ -33,6 +33,9 @@ #include #endif +/* Transaction ID type */ +typedef unsigned int tid_t; + #define journal_oom_retry 1 /* diff --git a/include/linux/mpage.h b/include/linux/mpage.h new file mode 100644 index 00000000000..571eb342e4f --- /dev/null +++ b/include/linux/mpage.h @@ -0,0 +1,14 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +/* + * include/linux/mpage.h + * + * Contains declarations related to preparing and submitting BIOS which contain + * multiple pagecache pages. + */ + +#ifndef _LINUX_MPAGE_H +#define _LINUX_MPAGE_H + +/* Stub for linux/mpage.h - U-Boot doesn't support multi-page I/O */ + +#endif /* _LINUX_MPAGE_H */ diff --git a/include/linux/rmap.h b/include/linux/rmap.h new file mode 100644 index 00000000000..731d5f7e3c5 --- /dev/null +++ b/include/linux/rmap.h @@ -0,0 +1,7 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef _LINUX_RMAP_H +#define _LINUX_RMAP_H + +/* Stub for linux/rmap.h - U-Boot doesn't support reverse mapping */ + +#endif /* _LINUX_RMAP_H */ diff --git a/include/linux/sched.h b/include/linux/sched.h index fcc7be76e77..c16833f0db1 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -15,6 +15,7 @@ struct task_struct { int pid; char comm[16]; void *journal_info; /* For jbd2 */ + unsigned int flags; /* PF_* flags */ }; extern struct task_struct *current; From patchwork Sat Dec 20 23:23:49 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1002 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=1766273083; bh=xe876T9jpX4WvVdRhMX7PuOKM4VKWDTsY8ANiySOdM0=; 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=p3yZm2gXFP4qDl4UcJo++aOQQvhbFBBXPDvNJy5hsS64gmvTeW9anXrIxXq07qXvq /TiBxfUVyzQshnXB5JeGRBvHkmWrYZuvTF2m+wQv2dHFSc38vpLNRfkF66IFXAuyno MXPxv1TSwHsZN1llqjNf4yO8hvZhJQalPwIDWEIBKG2mYO2O5aw5wDki5NCJlKrpgl bzYo8UK/gXgmtrtwqCosnZdbeZ/d3vQXTfbDoofiImKPX8eF39PbQZSx1hKCTa0UcD vpSWhTee3vGiswj2fv6JueJkOSJf7D3S74D6yFP1vPVCxG7yT2tNNVo/WQxiC2T9kh MTbCvUyV2Ovsg== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 97A5564C60 for ; Sat, 20 Dec 2025 16:24:43 -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 3AagqUcJIOAA for ; Sat, 20 Dec 2025 16:24:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273083; bh=xe876T9jpX4WvVdRhMX7PuOKM4VKWDTsY8ANiySOdM0=; 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=p3yZm2gXFP4qDl4UcJo++aOQQvhbFBBXPDvNJy5hsS64gmvTeW9anXrIxXq07qXvq /TiBxfUVyzQshnXB5JeGRBvHkmWrYZuvTF2m+wQv2dHFSc38vpLNRfkF66IFXAuyno MXPxv1TSwHsZN1llqjNf4yO8hvZhJQalPwIDWEIBKG2mYO2O5aw5wDki5NCJlKrpgl bzYo8UK/gXgmtrtwqCosnZdbeZ/d3vQXTfbDoofiImKPX8eF39PbQZSx1hKCTa0UcD vpSWhTee3vGiswj2fv6JueJkOSJf7D3S74D6yFP1vPVCxG7yT2tNNVo/WQxiC2T9kh MTbCvUyV2Ovsg== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 863D764C46 for ; Sat, 20 Dec 2025 16:24:43 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273081; bh=JPCAhVeJj84KSHi3dnX/PTDwYNm7tA9f7TeR8rQ+hqM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qzlxvvUs+LnqGkJOMBp+u8ZySIwZAyKSo6/zA7rCSSKgyTJQzDLycMaglwOkVJXF4 1fwYGmcLA4Te6w13cnDesBEJhHYJZY/XAzX4RnfWqSYJnmC6iCAUr5xCoH5zAPSO0k ElvkuOfCcJmt/DLvLZ0x6+paO1gEsvNnpRKT+ngv+E4utveoVzxSk+FEKSInNg/P3X tknwzkLjAXP8fuq76Ag7RLhc0mEU1B/fRznhuarUasQMIvGhP+BrXHgbHYH4On1sAN DBz31KYd87t8nfgpKr44YrMgIR06UjAqnOKy8EfbX1WXJs9kxCXk7NtywyU7/6NPJB ew5xcAgrRMV1w== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 888AC64C56; Sat, 20 Dec 2025 16:24: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 10026) with ESMTP id h7cihC2AsbZs; Sat, 20 Dec 2025 16:24:41 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273080; bh=BG1tNiIvky6qRp4tpKyYBzT2XIJ988ECIs34FNkqiRU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=OOSOhQX8ZebEgeC67x1erEJ02atSsGxaM3Pjj8Sm+wlj7FrE2R/nkASMAETtROW48 sEjaouh/Zog6GRND3D3eaRyL/svrUdenTXZUXvTmyOyh2/FXemKfvuzHDOtBNuNvKa HTE81OYMDo/4sSzOCjx5JmvH4Q8nwTkn+xhHTSBDHQiNvCLdszYhb8t5jh62raKQK7 W8e661nqUZb0bDU+6wV5EJq50eSWdW012iso+03vI3QtKHEQ2hPEKh8CxBN2rcxqDE ZzsrWKcN6OMGxJwAPb+WJewaMV3uLFeUui6WXpuLT6FlZgtYMG7RmkoF3lsGBRqWI0 3HWCSwFCFzwpA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 2C6DC64C29; Sat, 20 Dec 2025 16:24:40 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:49 -0700 Message-ID: <20251220232355.845414-10-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: QOGMDOZ3WRL4X3TF3KARZPC5SANFTXOD X-Message-ID-Hash: QOGMDOZ3WRL4X3TF3KARZPC5SANFTXOD 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/10] ext4l: Add dir.c to build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add dir.c to the Makefile and provide necessary stubs: - Replace Linux includes with ext4_uboot.h - Add fscrypt directory operation stubs - Add readahead, inode version, and dir_emit stubs - Add struct file_operations with needed members - Add generic_read_dir, ext4_llseek, ext4_htree_fill_tree stubs - Add ext4_ioctl, ext4_sync_file, ext4_dirblock_csum_verify stubs Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/dir.c | 6 +----- fs/ext4l/ext4_uboot.h | 49 +++++++++++++++++++++++++++++++++++++++++++ fs/ext4l/stub.c | 48 +++++++++++++++++++++++++++++++++++++++++- 4 files changed, 98 insertions(+), 7 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index f9c0f77b8ed..28d483a7810 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -5,7 +5,7 @@ obj-y := interface.o stub.o -obj-y += balloc.o bitmap.o block_validity.o ext4_jbd2.o extents.o \ +obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ extents_status.o hash.o ialloc.o \ indirect.o inode.o \ xattr_hurd.o xattr_trusted.o \ diff --git a/fs/ext4l/dir.c b/fs/ext4l/dir.c index d4164c507a9..9c4b853defa 100644 --- a/fs/ext4l/dir.c +++ b/fs/ext4l/dir.c @@ -22,11 +22,7 @@ * */ -#include -#include -#include -#include -#include +#include "ext4_uboot.h" #include "ext4.h" #include "xattr.h" diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 3f11fb47544..5380b7ed701 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -1402,4 +1402,53 @@ static inline unsigned int i_gid_read(const struct inode *inode) #define truncate_inode_pages_final(m) do { } while (0) #define truncate_pagecache_range(i, s, e) do { } while (0) +/* + * Additional stubs for dir.c + */ + +/* fscrypt_str - encrypted filename string */ +#define FSTR_INIT(n, l) { .name = (n), .len = (l) } + +/* fscrypt directory operations */ +#define fscrypt_prepare_readdir(i) ({ (void)(i); 0; }) +#define fscrypt_fname_alloc_buffer(len, buf) ({ (void)(len); (void)(buf); 0; }) +#define fscrypt_fname_free_buffer(buf) do { (void)(buf); } while (0) +#define fscrypt_fname_disk_to_usr(i, h1, h2, d, u) ({ (void)(i); (void)(h1); (void)(h2); (void)(d); (void)(u); 0; }) + +/* Readahead operations */ +#define ra_has_index(ra, idx) ({ (void)(ra); (void)(idx); 0; }) +#define page_cache_sync_readahead(m, ra, f, i, n) do { } while (0) + +/* Inode version operations */ +#define inode_eq_iversion(i, v) ({ (void)(i); (void)(v); 1; }) +#define inode_query_iversion(i) ({ (void)(i); 0ULL; }) + +/* Directory context operations */ +#define dir_emit(ctx, name, len, ino, type) ({ (void)(ctx); (void)(name); (void)(len); (void)(ino); (void)(type); 1; }) +#define dir_relax_shared(i) ({ (void)(i); 1; }) + +/* File llseek */ +#define generic_file_llseek_size(f, o, w, m, e) ({ (void)(f); (void)(o); (void)(w); (void)(m); (void)(e); 0LL; }) + +/* generic_read_dir - stub function (needs to be a real function for struct init) */ +ssize_t generic_read_dir(struct file *f, char __user *buf, size_t count, + loff_t *ppos); + +/* struct_size helper */ +#define struct_size(p, member, count) (sizeof(*(p)) + sizeof((p)->member[0]) * (count)) + +/* file_operations - extended for dir.c */ +struct file_operations { + int (*open)(struct inode *, struct file *); + loff_t (*llseek)(struct file *, loff_t, int); + ssize_t (*read)(struct file *, char *, size_t, loff_t *); + int (*iterate_shared)(struct file *, struct dir_context *); + long (*unlocked_ioctl)(struct file *, unsigned int, unsigned long); + int (*fsync)(struct file *, loff_t, loff_t, int); + int (*release)(struct inode *, struct file *); +}; + +/* file open helper */ +#define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 2c9c460f0e7..13d2ce7b54b 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -520,7 +520,7 @@ int ext4_find_inline_data_nolock(struct inode *inode) char ext4_file_inode_operations; char ext4_file_operations; char ext4_dir_inode_operations; -char ext4_dir_operations; +/* ext4_dir_operations is now in dir.c */ char ext4_special_inode_operations; char ext4_symlink_inode_operations; char ext4_fast_symlink_inode_operations; @@ -580,3 +580,49 @@ int jbd2_journal_try_to_free_buffers(journal_t *journal, struct folio *folio) void jbd2_journal_init_jbd_inode(void *jinode, struct inode *inode) { } + +/* + * Stubs for dir.c + */ +ssize_t generic_read_dir(struct file *f, char *buf, size_t count, loff_t *ppos) +{ + return -EISDIR; +} + +void __ext4_error_file(struct file *file, const char *func, unsigned int line, + unsigned long long block, const char *fmt, ...) +{ +} + +loff_t ext4_llseek(struct file *file, loff_t offset, int whence) +{ + return 0; +} + +int ext4_htree_fill_tree(struct file *dir_file, unsigned long long pos, + unsigned long long start_hash, + unsigned long long start_minor_hash, + unsigned long long *next_hash) +{ + return 0; +} + +int ext4_read_inline_dir(struct file *file, void *ctx, void *f_pos) +{ + return 0; +} + +int ext4_dirblock_csum_verify(struct inode *inode, struct buffer_head *bh) +{ + return 1; +} + +long ext4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return 0; +} + +int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) +{ + return 0; +} From patchwork Sat Dec 20 23:23:50 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1004 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=1766273086; bh=sSULeosLQPLlRRMm1GV8L8Xtnpixz/IU+3lBtirypjg=; 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=PPIYnmy9COw2wRO6bmAzucxZ9EGfC2H6HPTHMSe89BITwLHmid2A/gk+7KV42jcA7 7TL8oSG7yrvYrlomxinP+SCj+v7OEZsihNDljHL4Qpnb4IIottvF9VLeq7iOT+p+Zu 6V8mbT79kpXLItcNFFYBAfYoqszialPiv5XdOV7sIGFk5zFHLs/LONUQS6sHR+C6iC 9d12mtjHEKfjwoc55liYUeEH4Uld0InEnYjWOepT1QOizQKcMl0iZqbANbEt7wBeEE tK9VC2iZjTI5Gxt5iMMG+d0giT6q/+EdzeRc38/rsRhiMXyKkkOQ5yDhlfjXXZVi8h xMnWayYzto1kQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 7FEC564C60 for ; Sat, 20 Dec 2025 16:24:46 -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 7GwPOatBM7ev for ; Sat, 20 Dec 2025 16:24:46 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273084; bh=sSULeosLQPLlRRMm1GV8L8Xtnpixz/IU+3lBtirypjg=; 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=rCERtf7LJEYQuTVqLBl6Wvx/u2nNWlMdDQxyedm5FS/bWimnaJ2iNzmKPQ61Q+w/W 67DJ5A3p/0PSMRMDP3qFK3TdnLaXVgY/2mwD6EJ0vNcAwGT2dzMHXOtxttX/pz+IaK pqttH/3bJUuzTPFhQfhVt58phHSfOwL0IitqmePYhffwHbGyH3IWRuUs0AKNZfDUg7 EMnOx+88H6KUTlDfb1girtzxJqWvFuJDs4YlxIJjw+MhfHE25gLEjayBHGOzZTTyVY 5K9CaBr7L20dz6W1jl5FdA7yDrCA3Fct5j90Og2SbvVoifX86SsiUQHpW49APnW4bu 5znHvLw3bhmKA== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 8B58D64CA6 for ; Sat, 20 Dec 2025 16:24:44 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273082; bh=f4iCXt2NYn5NvqoSzhvAspZqa99qu1fG+hWf5FQOgqU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XeFH7598VFGp98+FoG+BmiYkcQAZOJCvnySFtZ6Vh9wvmYQ1sJaHEN9BmulaDwJQY 9MZeQCfBCVXBNjs27KrJEYT9g1okdi6Tzj+HTVXwUokua/cB/66gMlvJo7ODug+2nT cKYbjtjTjzcURWXmMgpgwnublC7m1m2a0QahJw+pUULD88RM94H6x+E0BmMUqBOZz2 3PIKhxOGO5IgVjE2GX0qV8kIooT+azu1R51odTpx4m+YbsBXnRNBHVm79WD496l6iI dOiZGgAsDEsTOxUmjPbz02CfTPQwMEHcCQpHcX1WhxWfTukWTUPFgcY6vLeZzaOBNB 9r/wBMgO3++JQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id D29AD64C29; Sat, 20 Dec 2025 16:24:42 -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 E_3mjtlJHCkC; Sat, 20 Dec 2025 16:24:42 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1766273081; bh=IT9pXawGBPB5wW7cwLK2te+MQRnlNKHJBK2H2wA0/w8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FPYg1wOX+QzTB8Drj0VqwkSVn9Wfy45AC72lthtAWQfwrLFCE5RqbGlW9YLGpv+5H GUMaEqSoXugKW5qPj72ESx91dyt7Qt1c+xTmslTPxr0/OIc/s1Se+WywY96nuQfi1I pQxSSVkpYOQGrqwKgIiTyrfGRut/Op6JgBmJpq9UgTNlt6rydozXF+z1WkI1EK5VuN Ni0fFrBDIEaFscLJVVLZ3FBI6YDQ9S3wcvCmevQ6eUk8y5aXJdcUoxGcN197BARAHN yilp6aTsh2Op54QTj8qCtlDnN4rYIjmYDhCv25vQkw691xhzxqN7okZCCgk68TWwNV bOeQcSgAmcCZw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 1BFC764C46; Sat, 20 Dec 2025 16:24:41 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Sat, 20 Dec 2025 16:23:50 -0700 Message-ID: <20251220232355.845414-11-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251220232355.845414-1-sjg@u-boot.org> References: <20251220232355.845414-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 5XEMLBTRWJCXFZYIH7JK7ALZMLIXSGRI X-Message-ID-Hash: 5XEMLBTRWJCXFZYIH7JK7ALZMLIXSGRI 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/10] ext4l: Add super.c to build List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass Add super.c to the ext4l Makefile and provide the infrastructure needed to compile it: - Add stubs for block device operations (bdev_file_open_by_dev, bdev_fput, bdev_getblk, submit_bh, trylock_buffer) - Add stubs for NFS export helpers (generic_fh_to_dentry/parent) - Add stubs for filesystem operations (sync_filesystem, dquot_suspend) - Add stubs for string operations (strreplace, strtomem_pad) - Add stubs for memory allocation (alloc_inode_sb, kvzalloc) - Add stubs for ratelimit, workqueue, and trace functions - Add fs_context and fs_parameter structures for mount options - Add blk_holder_ops structure for block device holder operations - Add pragma to suppress unused function/variable warnings - Add __maybe_unused to __init/__exit macros in init.h The only change to super.c itself is replacing the Linux kernel includes with the U-Boot compatibility header ext4_uboot.h. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- fs/ext4l/Makefile | 2 +- fs/ext4l/ext4_uboot.h | 629 ++++++++++++++++++++++++++++++++- fs/ext4l/stub.c | 573 ++++++++++++++++++++++-------- fs/ext4l/super.c | 32 +- include/linux/freezer.h | 8 +- include/linux/init.h | 4 +- include/linux/kthread.h | 4 +- include/linux/mutex.h | 2 +- include/linux/percpu_counter.h | 2 + include/linux/sched.h | 6 + include/linux/slab.h | 2 +- include/linux/timer.h | 18 +- include/linux/workqueue.h | 4 +- 13 files changed, 1085 insertions(+), 201 deletions(-) diff --git a/fs/ext4l/Makefile b/fs/ext4l/Makefile index 28d483a7810..c4fe972d426 100644 --- a/fs/ext4l/Makefile +++ b/fs/ext4l/Makefile @@ -8,5 +8,5 @@ obj-y := interface.o stub.o obj-y += balloc.o bitmap.o block_validity.o dir.o ext4_jbd2.o extents.o \ extents_status.o hash.o ialloc.o \ indirect.o inode.o \ - xattr_hurd.o xattr_trusted.o \ + super.o xattr_hurd.o xattr_trusted.o \ xattr_user.o orphan.o diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 5380b7ed701..4f0cb4cf13d 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -9,8 +9,16 @@ #ifndef __EXT4_UBOOT_H__ #define __EXT4_UBOOT_H__ +/* + * Suppress warnings for unused static functions and variables in Linux ext4 + * source files. These are used in code paths that are stubbed out in U-Boot. + */ +#pragma GCC diagnostic ignored "-Wunused-function" +#pragma GCC diagnostic ignored "-Wunused-variable" + #include #include +#include /* For panic() */ #include #include #include @@ -22,6 +30,15 @@ #include #include #include +#include + +/* + * Override no_printk to avoid format warnings in disabled debug prints. + * The Linux kernel uses sector_t as u64, but U-Boot uses unsigned long. + * This causes format mismatches with %llu that we want to ignore. + */ +#undef no_printk +#define no_printk(fmt, ...) ({ 0; }) /* Rotate left - not available in U-Boot */ static inline u32 rol32(u32 word, unsigned int shift) @@ -94,15 +111,8 @@ struct rb_root { #define RB_ROOT (struct rb_root) { NULL, } -/* percpu_counter - stub */ -struct percpu_counter { - long count; -}; - -static inline long percpu_counter_sum(struct percpu_counter *fbc) -{ - return fbc->count; -} +/* percpu_counter - use Linux header */ +#include /* name_snapshot - stub */ struct name_snapshot { @@ -280,7 +290,7 @@ struct user_namespace { }; extern struct user_namespace init_user_ns; -/* BUG_ON / BUG - stubs */ +/* BUG_ON / BUG - stubs (panic is in vsprintf.h) */ #define BUG_ON(cond) do { } while (0) #define BUG() do { } while (0) @@ -404,7 +414,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* Block device operations - stubs */ #define sb_issue_zeroout(sb, blk, num, gfp) ({ (void)(sb); (void)(blk); (void)(num); (void)(gfp); 0; }) -#define blkdev_issue_flush(bdev) do { (void)(bdev); } while (0) +#define blkdev_issue_flush(bdev) ({ (void)(bdev); 0; }) /* do_div - divide u64 by u32 */ #define do_div(n, base) ({ \ @@ -463,7 +473,7 @@ int __ext4_xattr_set_credits(struct super_block *sb, struct inode *inode, /* RCU barrier - stub */ #define rcu_barrier() do { } while (0) -/* inode operations - stubs */ +/* inode/dentry operations - stubs */ #define iput(inode) do { } while (0) /* current task - from linux/sched.h */ @@ -589,6 +599,17 @@ struct fstrim_range { /* Superblock flags */ #define SB_RDONLY (1 << 0) +#define SB_I_VERSION (1 << 26) /* Update inode version */ + +/* UUID type */ +typedef struct { + __u8 b[16]; +} uuid_t; + +/* Forward declarations for super_block */ +struct super_operations; +struct export_operations; +struct xattr_handler; /* super_block - minimal stub */ struct super_block { @@ -598,11 +619,21 @@ struct super_block { unsigned long s_magic; loff_t s_maxbytes; unsigned long s_flags; + unsigned long s_iflags; /* Internal flags */ struct rw_semaphore s_umount; struct sb_writers s_writers; struct block_device *s_bdev; const char *s_id; struct dentry *s_root; + uuid_t s_uuid; + struct file_system_type *s_type; + s32 s_time_gran; /* Time granularity (ns) */ + time64_t s_time_min; /* Min supported time */ + time64_t s_time_max; /* Max supported time */ + const struct super_operations *s_op; + const struct export_operations *s_export_op; + const struct xattr_handler * const *s_xattr; + struct dentry *d_sb; /* Parent dentry - stub */ }; /* Block device read-only check - stub */ @@ -1222,6 +1253,12 @@ typedef unsigned int projid_t; #define inode_is_open_for_write(i) (0) #define inode_is_dirtytime_only(i) (0) +/* Writeback stubs for super.c */ +#define writeback_iter(mapping, wbc, folio, error) \ + ({ (void)(mapping); (void)(wbc); (void)(error); (struct folio *)NULL; }) +#define folio_redirty_for_writepage(wbc, folio) \ + ({ (void)(wbc); (void)(folio); false; }) + /* Folio operations - additional stubs */ #define folio_zero_segments(f, s1, e1, s2, e2) do { } while (0) #define folio_zero_new_buffers(f, f2, t) do { } while (0) @@ -1451,4 +1488,572 @@ struct file_operations { /* file open helper */ #define simple_open(i, f) ({ (void)(i); (void)(f); 0; }) +/* + * Additional stubs for super.c + */ + +/* fs_context and fs_parser stubs */ +struct constant_table { + const char *name; + int value; +}; + +struct fs_parameter_spec { + const char *name; + int opt; + unsigned short type; + const struct constant_table *data; +}; + +/* fs_parameter spec types */ +#define fs_param_is_flag 0 +#define fs_param_is_u32 1 +#define fs_param_is_s32 2 +#define fs_param_is_u64 3 +#define fs_param_is_enum 4 +#define fs_param_is_string 5 +#define fs_param_is_blob 6 +#define fs_param_is_fd 7 +#define fs_param_is_uid 8 +#define fs_param_is_gid 9 +#define fs_param_is_blockdev 10 + +/* fsparam_* macros for mount option parsing - use literal values */ +#define fsparam_flag(name, opt) \ + {(name), (opt), 0, NULL} +#define fsparam_u32(name, opt) \ + {(name), (opt), 1, NULL} +#define fsparam_s32(name, opt) \ + {(name), (opt), 2, NULL} +#define fsparam_u64(name, opt) \ + {(name), (opt), 3, NULL} +#define fsparam_string(name, opt) \ + {(name), (opt), 5, NULL} +#define fsparam_string_empty(name, opt) \ + {(name), (opt), 5, NULL} +#define fsparam_enum(name, opt, array) \ + {(name), (opt), 4, (array)} +#define fsparam_bdev(name, opt) \ + {(name), (opt), 10, NULL} +#define fsparam_uid(name, opt) \ + {(name), (opt), 8, NULL} +#define fsparam_gid(name, opt) \ + {(name), (opt), 9, NULL} +#define __fsparam(type, name, opt, flags, data) \ + {(name), (opt), (type), (data)} + +/* Quota format constants */ +#define QFMT_VFS_OLD 1 +#define QFMT_VFS_V0 2 +#define QFMT_VFS_V1 4 + +struct fs_context; +struct fs_parameter; + +struct fs_context_operations { + int (*parse_param)(struct fs_context *, struct fs_parameter *); + int (*get_tree)(struct fs_context *); + int (*reconfigure)(struct fs_context *); + void (*free)(struct fs_context *); +}; + +struct file_system_type { + struct module *owner; + const char *name; + int (*init_fs_context)(struct fs_context *); + const struct fs_parameter_spec *parameters; + void (*kill_sb)(struct super_block *); + int fs_flags; + struct list_head fs_supers; +}; + +#define FS_REQUIRES_DEV 1 +#define FS_BINARY_MOUNTDATA 2 +#define FS_HAS_SUBTYPE 4 +#define FS_USERNS_MOUNT 8 +#define FS_DISALLOW_NOTIFY_PERM 16 +#define FS_ALLOW_IDMAP 32 + +/* Buffer read sync */ +#define end_buffer_read_sync NULL +#define REQ_OP_READ 0 + +/* Superblock flags */ +#define SB_ACTIVE (1 << 30) + +/* Part stat - not used in U-Boot. Note: sectors[X] is passed as second arg */ +#define STAT_WRITE 0 +#define STAT_READ 0 +static u64 __attribute__((unused)) __ext4_sectors[2]; +#define sectors __ext4_sectors +#define part_stat_read(p, f) ({ (void)(p); (void)(f); 0ULL; }) + +/* System state - U-Boot is always running */ +#define system_state 0 +#define SYSTEM_HALT 1 +#define SYSTEM_POWER_OFF 2 +#define SYSTEM_RESTART 3 + +/* Hex dump */ +#define DUMP_PREFIX_ADDRESS 0 +#define print_hex_dump(l, p, pt, rg, gc, b, len, a) do { } while (0) + +/* Slab flags */ +#define SLAB_RECLAIM_ACCOUNT 0 +#define SLAB_ACCOUNT 0 + +/* Forward declarations for super_operations and export_operations */ +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 *); +}; + +/* export_operations for NFS */ +struct export_operations { + int (*encode_fh)(struct inode *, __u32 *, int *, struct inode *); + struct dentry *(*fh_to_dentry)(struct super_block *, struct fid *, int, int); + struct dentry *(*fh_to_parent)(struct super_block *, struct fid *, int, int); + struct dentry *(*get_parent)(struct dentry *); + int (*commit_metadata)(struct inode *); +}; + +/* Generic file handle encoder for NFS exports - stub */ +static inline int generic_encode_ino32_fh(struct inode *inode, __u32 *fh, + int *max_len, struct inode *parent) +{ + return 0; +} + +/* fid for export_operations */ +struct fid { + union { + struct { + u32 ino; + u32 gen; + u32 parent_ino; + u32 parent_gen; + } i32; + __u32 raw[0]; + }; +}; + +/* __kernel_fsid_t - must be before kstatfs */ +typedef struct { + int val[2]; +} __kernel_fsid_t; + +/* 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; +} + +/* kstatfs for statfs */ +struct kstatfs { + long f_type; + long f_bsize; + u64 f_blocks; + u64 f_bfree; + u64 f_bavail; + u64 f_files; + u64 f_ffree; + __kernel_fsid_t f_fsid; + long f_namelen; + long f_frsize; + long f_flags; + long f_spare[4]; +}; + +/* seq_file stubs */ +struct seq_file; +#define seq_printf(m, fmt, ...) do { } while (0) +#define seq_puts(m, s) do { } while (0) +#define seq_putc(m, c) do { } while (0) +#define seq_escape(m, s, esc) do { } while (0) + +/* Module stubs */ +struct module; +#ifndef THIS_MODULE +#define THIS_MODULE NULL +#endif +#define MODULE_ALIAS_FS(name) + +/* register/unregister filesystem */ +#define register_filesystem(fs) ({ (void)(fs); 0; }) +#define unregister_filesystem(fs) ({ (void)(fs); 0; }) + +/* EXT4_GOING flags */ +#define EXT4_GOING_FLAGS_DEFAULT 0 +#define EXT4_GOING_FLAGS_LOGFLUSH 1 +#define EXT4_GOING_FLAGS_NOLOGFLUSH 2 + +/* fs_context stubs */ +/* fs_context_purpose - what the context is for */ +enum fs_context_purpose { + FS_CONTEXT_FOR_MOUNT, + FS_CONTEXT_FOR_SUBMOUNT, + FS_CONTEXT_FOR_RECONFIGURE, +}; + +struct fs_context { + const struct fs_context_operations *ops; + struct file_system_type *fs_type; + void *fs_private; + struct dentry *root; + struct user_namespace *user_ns; + void *s_fs_info; /* Filesystem specific info */ + unsigned int sb_flags; + unsigned int sb_flags_mask; + unsigned int lsm_flags; + enum fs_context_purpose purpose; + bool sloppy; + bool silent; +}; + +/* fs_parameter stubs */ +struct fs_parameter { + const char *key; + int type; + size_t size; + int dirfd; + union { + char *string; + int boolean; + int integer; + }; +}; + +/* fs_value types - result type from parsing */ +enum fs_value_type { + fs_value_is_undefined, + fs_value_is_flag, + fs_value_is_string, + fs_value_is_blob, + fs_value_is_filename, + fs_value_is_file, +}; + +/* fs_parse_result - result of parsing a parameter */ +struct fs_parse_result { + bool negated; + union { + bool boolean; + int int_32; + unsigned int uint_32; + u64 uint_64; + kuid_t uid; + kgid_t gid; + }; +}; + +/* fs_parse stubs */ +#define fs_parse(fc, desc, param, result) ({ (void)(fc); (void)(desc); (void)(param); (void)(result); -ENOPARAM; }) +#define ENOPARAM 519 +#define fs_lookup_param(fc, p, bdev, fl, path) ({ (void)(fc); (void)(p); (void)(bdev); (void)(fl); (void)(path); -EINVAL; }) + +/* get_tree helpers */ +#define get_tree_bdev(fc, fill_super) ({ (void)(fc); (void)(fill_super); -ENODEV; }) +#define get_tree_nodev(fc, fill_super) ({ (void)(fc); (void)(fill_super); -ENODEV; }) + +/* kill_sb helpers */ +#define kill_block_super(sb) do { } while (0) + +/* prandom */ +#define get_random_u32() 0 +#define prandom_u32_max(max) 0 + +/* ctype */ +#include + +/* crc16 */ +#define crc16(crc, buf, len) (0) + +/* Timer and timing stubs */ +#define HZ 1000 +#define jiffies 0UL +#ifndef time_before +#define time_before(a, b) ((long)((a) - (b)) < 0) +#endif +#ifndef time_after +#define time_after(a, b) time_before(b, a) +#endif +#define msecs_to_jiffies(m) ((m) * HZ / 1000) + +/* Path lookup flags */ +#define LOOKUP_FOLLOW 0x0001 + +/* I/O priority classes */ +#define IOPRIO_CLASS_BE 2 + +/* Superblock flags */ +#define SB_INLINECRYPT (1 << 27) +#define SB_SILENT (1 << 15) +#define SB_POSIXACL (1 << 16) +#define SB_I_CGROUPWB 0 +#define SB_I_ALLOW_HSM 0 + +/* Block open flags */ +#define BLK_OPEN_READ (1 << 0) +#define BLK_OPEN_WRITE (1 << 1) +#define BLK_OPEN_RESTRICT_WRITES (1 << 2) + +/* Request flags */ +#define REQ_OP_WRITE 1 +#define REQ_SYNC (1 << 0) +#define REQ_FUA (1 << 1) + +/* blk_holder_ops for block device */ +struct blk_holder_ops { + void (*mark_dead)(struct block_device *, bool); +}; +static const struct blk_holder_ops fs_holder_ops; + +/* end_buffer_write_sync */ +#define end_buffer_write_sync NULL + +/* File system management time flag */ +#define FS_MGTIME 0 + +/* Block size */ +#define BLOCK_SIZE 1024 + +/* Time constants */ +#define NSEC_PER_SEC 1000000000L + +/* EXT4 magic number */ +#define EXT4_SUPER_MAGIC 0xEF53 + +/* Max file size for large files */ +#define MAX_LFS_FILESIZE ((loff_t)LLONG_MAX) + +/* blockgroup_lock for per-group locking */ +struct blockgroup_lock { + int num_locks; /* U-Boot doesn't need real locking */ +}; + +/* Buffer submission stubs - declarations for stub.c implementations */ +void 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); + +/* Trace stubs for super.c - declaration for stub.c implementation */ +void trace_ext4_error(struct super_block *sb, const char *func, unsigned int line); + +/* Ratelimiting - declaration for stub.c */ +int ___ratelimit(struct ratelimit_state *rs, const char *func); + +/* Filesystem notification - declaration for stub.c */ +void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error); + +/* File path operations - declaration for stub.c */ +char *file_path(struct file *file, char *buf, int buflen); +struct block_device *file_bdev(struct file *file); + +/* Percpu rwsem - declarations for stub.c */ +int percpu_init_rwsem(struct percpu_rw_semaphore *sem); +void percpu_free_rwsem(struct percpu_rw_semaphore *sem); + +/* Block device sync - declarations for stub.c */ +void sync_blockdev(struct block_device *bdev); +void invalidate_bdev(struct block_device *bdev); + +/* Kobject - declarations for stub.c */ +void kobject_put(struct kobject *kobj); +void wait_for_completion(struct completion *comp); + +/* DAX - declaration for stub.c */ +void fs_put_dax(void *dax, void *holder); + +/* fscrypt - declarations for stub.c */ +void fscrypt_free_dummy_policy(struct fscrypt_dummy_policy *policy); +int fscrypt_drop_inode(struct inode *inode); +void fscrypt_free_inode(struct inode *inode); + +/* Inode allocation - declaration for stub.c */ +void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, + gfp_t gfp); +void inode_set_iversion(struct inode *inode, u64 version); +int inode_generic_drop(struct inode *inode); + +/* Lock init - declaration for stub.c */ +void rwlock_init(rwlock_t *lock); + +/* Trace stubs */ +#define trace_ext4_drop_inode(i, d) do { } while (0) +#define trace_ext4_nfs_commit_metadata(i) do { } while (0) +#define trace_ext4_prefetch_bitmaps(...) do { } while (0) +#define trace_ext4_lazy_itable_init(...) do { } while (0) + +/* slab usercopy - use regular kmem_cache_create */ +#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) + +/* fscrypt/fsverity additional stubs */ +#define fscrypt_put_encryption_info(i) do { } while (0) +#define fsverity_cleanup_inode(i) do { } while (0) +#define fscrypt_parse_test_dummy_encryption(p, d) ({ (void)(p); (void)(d); 0; }) + +/* NFS export helpers - declarations for stub.c */ +struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, u64, u32)); +struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, u64, u32)); + +/* Path operations */ +#define path_put(p) do { } while (0) + +/* I/O priority - declaration for stub.c */ +int IOPRIO_PRIO_VALUE(int class, int data); + +/* String operations */ +char *kmemdup_nul(const char *s, size_t len, gfp_t gfp); +#define strscpy_pad(dst, src) strncpy(dst, src, sizeof(dst)) + +/* fscrypt/fsverity declarations for stub.c */ +int fscrypt_is_dummy_policy_set(const struct fscrypt_dummy_policy *policy); +int fscrypt_dummy_policies_equal(const struct fscrypt_dummy_policy *p1, + const struct fscrypt_dummy_policy *p2); +void fscrypt_show_test_dummy_encryption(struct seq_file *seq, char sep, + struct super_block *sb); + +/* Memory allocation - declarations for stub.c */ +void *kvzalloc(size_t size, gfp_t flags); +unsigned long roundup_pow_of_two(unsigned long n); + +/* Atomic operations - declarations for stub.c */ +void atomic_add(int val, atomic_t *v); +void atomic64_add(s64 val, atomic64_t *v); + +/* Power of 2 check - declaration for stub.c */ +int is_power_of_2(unsigned long n); + +/* Time operations */ +#define ktime_get_ns() (0ULL) +#define nsecs_to_jiffies(ns) ((ns) / (NSEC_PER_SEC / HZ)) + +/* Superblock write operations */ +#define sb_start_write_trylock(sb) ({ (void)(sb); 1; }) +#define sb_end_write(sb) do { } while (0) + +/* Scheduler stubs */ +#define schedule_timeout_interruptible(t) do { } while (0) + +/* Page allocation - declarations for stub.c */ +unsigned long get_zeroed_page(gfp_t gfp); +void free_page(unsigned long addr); + +/* DAX - declaration for stub.c */ +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; }) + +/* Superblock blocksize - declaration for stub.c */ +int sb_set_blocksize(struct super_block *sb, int size); + +/* Superblock min blocksize - stub */ +static inline int sb_min_blocksize(struct super_block *sb, int size) +{ + return sb_set_blocksize(sb, size); +} + +/* Block device size - declarations for stub.c */ +int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks); +u64 sb_bdev_nr_blocks(struct super_block *sb); +unsigned int bdev_max_discard_sectors(struct block_device *bdev); + +/* Blockgroup lock init - stub */ +#define bgl_lock_init(lock) do { } while (0) + +/* Task I/O priority - declaration for stub.c */ +void set_task_ioprio(void *task, int ioprio); + +/* Superblock identity stubs */ +#define super_set_uuid(sb, uuid, len) do { } while (0) +#define super_set_sysfs_name_bdev(sb) do { } while (0) + +/* Dentry operations - declarations for stub.c */ +void generic_set_sb_d_ops(struct super_block *sb); +struct dentry *d_make_root(struct inode *inode); +void dput(void *dentry); + +/* String operations - declarations for stub.c */ +char *strreplace(const char *str, char old, char new); + +/* strtomem_pad - copy string with padding (Linux kernel macro) */ +#define strtomem_pad(dest, src, pad) do { \ + const char *__src = (src); \ + size_t __len = strlen(__src); \ + if (__len >= sizeof(dest)) { \ + memcpy((dest), __src, sizeof(dest)); \ + } else { \ + memcpy((dest), __src, __len); \ + memset((char *)(dest) + __len, (pad), sizeof(dest) - __len); \ + } \ +} while (0) + +/* Ratelimit - declaration for stub.c */ +void ratelimit_state_init(void *rs, int interval, int burst); + +/* Block device operations - declarations for stub.c */ +void bdev_fput(void *file); +void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, + const struct blk_holder_ops *ops); + +/* Filesystem sync - declaration for stub.c */ +int sync_filesystem(void *sb); + +/* Quota - declaration for stub.c */ +int dquot_suspend(void *sb, int flags); + +/* Block device file operations - stubs */ +#define set_blocksize(f, size) ({ (void)(f); (void)(size); 0; }) +#define __bread(bdev, block, size) ({ (void)(bdev); (void)(block); (void)(size); (struct buffer_head *)NULL; }) + +/* Trace stubs for super.c */ +#define trace_ext4_sync_fs(sb, wait) do { (void)(sb); (void)(wait); } while (0) + +/* Workqueue operations - stubs */ +#define flush_workqueue(wq) do { (void)(wq); } while (0) + +/* Quota stubs for super.c */ +#define dquot_writeback_dquots(sb, type) do { (void)(sb); (void)(type); } while (0) +#define dquot_resume(sb, type) do { (void)(sb); (void)(type); } while (0) +#define sb_any_quota_suspended(sb) ({ (void)(sb); 0; }) + #endif /* __EXT4_UBOOT_H__ */ diff --git a/fs/ext4l/stub.c b/fs/ext4l/stub.c index 13d2ce7b54b..f452357953e 100644 --- a/fs/ext4l/stub.c +++ b/fs/ext4l/stub.c @@ -22,43 +22,13 @@ struct file; typedef void bh_end_io_t(struct buffer_head *bh, int uptodate); /* ext4_num_base_meta_blocks and ext4_get_group_desc are now in balloc.c */ - -unsigned long ext4_block_bitmap(struct super_block *sb, void *gdp) -{ - return 0; -} - -unsigned long ext4_inode_bitmap(struct super_block *sb, void *gdp) -{ - return 0; -} - -unsigned long ext4_inode_table(struct super_block *sb, void *gdp) -{ - return 0; -} - -void __ext4_error_inode(struct inode *inode, const char *func, - unsigned int line, unsigned long block, - int error, const char *fmt, ...) -{ -} - -void __ext4_error(struct super_block *sb, const char *func, - unsigned int line, bool force_ro, int error, - unsigned long long block, const char *fmt, ...) -{ -} - -const char *ext4_decode_error(struct super_block *sb, int errno, char *nbuf) -{ - return "error"; -} - -void __ext4_std_error(struct super_block *sb, const char *func, - unsigned int line, int errno) -{ -} +/* ext4_block_bitmap is now in super.c */ +/* ext4_inode_bitmap is now in super.c */ +/* ext4_inode_table is now in super.c */ +/* __ext4_error_inode is now in super.c */ +/* __ext4_error is now in super.c */ +/* __ext4_std_error is now in super.c */ +/* ext4_decode_error is now in super.c */ /* * JBD2 journal stubs @@ -140,15 +110,8 @@ int jbd2__journal_restart(void *handle, int nblocks, int revoke_records, /* * Stubs for balloc.c */ -void ext4_mark_group_bitmap_corrupted(struct super_block *sb, - unsigned int group, unsigned int flags) -{ -} - -void __ext4_warning(struct super_block *sb, const char *func, - unsigned int line, const char *fmt, ...) -{ -} +/* ext4_mark_group_bitmap_corrupted is now in super.c */ +/* __ext4_warning is now in super.c */ unsigned long long ext4_mb_new_blocks(void *handle, void *ar, int *errp) { @@ -156,55 +119,16 @@ unsigned long long ext4_mb_new_blocks(void *handle, void *ar, int *errp) return 0; } -unsigned int ext4_free_group_clusters(struct super_block *sb, void *gdp) -{ - return 0; -} - -/* - * Stubs for ialloc.c - */ -void ext4_clear_inode(struct inode *inode) -{ -} - -void __ext4_msg(struct super_block *sb, const char *prefix, - const char *fmt, ...) -{ -} - -void ext4_free_group_clusters_set(struct super_block *sb, void *gdp, - unsigned int count) -{ -} - -void ext4_group_desc_csum_set(struct super_block *sb, unsigned int group, - void *gdp) -{ -} - -unsigned int ext4_itable_unused_count(struct super_block *sb, void *gdp) -{ - return 0; -} - -void ext4_itable_unused_set(struct super_block *sb, void *gdp, unsigned int v) -{ -} - -unsigned int ext4_free_inodes_count(struct super_block *sb, void *gdp) -{ - return 0; -} - -void ext4_free_inodes_set(struct super_block *sb, void *gdp, unsigned int v) -{ -} - -unsigned int ext4_used_dirs_count(struct super_block *sb, void *gdp) -{ - return 0; -} +/* ext4_free_group_clusters is now in super.c */ +/* ext4_clear_inode is now in super.c */ +/* __ext4_msg is now in super.c */ +/* ext4_free_group_clusters_set is now in super.c */ +/* ext4_group_desc_csum_set is now in super.c */ +/* ext4_itable_unused_count is now in super.c */ +/* ext4_itable_unused_set is now in super.c */ +/* ext4_free_inodes_count is now in super.c */ +/* ext4_free_inodes_set is now in super.c */ +/* ext4_used_dirs_count is now in super.c */ /* * Bit operations - sandbox declares these extern but doesn't implement them. @@ -282,17 +206,8 @@ void ext4_fc_record_regions(struct super_block *sb, int ino, { } -int ext4_read_bh(struct buffer_head *bh, unsigned int op_flags, - bh_end_io_t *end_io, bool simu_fail) -{ - return 0; -} - -struct buffer_head *ext4_sb_bread_nofail(struct super_block *sb, - unsigned long long block) -{ - return NULL; -} +/* ext4_read_bh is now in super.c */ +/* ext4_sb_bread_nofail is now in super.c */ /* * Stubs for ialloc.c - xattr functions @@ -326,14 +241,8 @@ int ext4_xattr_set(struct inode *inode, int name_index, const char *name, */ struct ext4_iloc; -void ext4_superblock_csum_set(struct super_block *sb) -{ -} - -int ext4_feature_set_ok(struct super_block *sb, int readonly) -{ - return 1; -} +/* ext4_superblock_csum_set is now in super.c */ +/* ext4_feature_set_ok is now in super.c */ /* * Stubs for inode.c @@ -352,11 +261,7 @@ int jbd2_transaction_committed(void *journal, unsigned int tid) } -void __ext4_warning_inode(struct inode *inode, const char *func, - unsigned int line, const char *fmt, ...) -{ -} - +/* __ext4_warning_inode is now in super.c */ /* Readahead */ int ext4_mpage_readpages(void *mapping, void *rac, void *folio) @@ -389,11 +294,7 @@ int jbd2_journal_inode_ranged_write(void *handle, struct inode *inode, } -int ext4_read_bh_lock(struct buffer_head *bh, int op_flags, int nowait) -{ - return 0; -} - +/* ext4_read_bh_lock is now in super.c */ /* Fast commit */ int ext4_fc_commit(void *journal, unsigned int tid) @@ -401,11 +302,7 @@ int ext4_fc_commit(void *journal, unsigned int tid) return 0; } -int ext4_force_commit(struct super_block *sb) -{ - return 0; -} - +/* ext4_force_commit is now in super.c */ /* Inline data */ int ext4_destroy_inline_data(void *handle, struct inode *inode) @@ -526,10 +423,7 @@ char ext4_symlink_inode_operations; char ext4_fast_symlink_inode_operations; -void ext4_update_dynamic_rev(struct super_block *sb) -{ -} - +/* ext4_update_dynamic_rev is now in super.c */ /* Inline data */ int ext4_inline_data_truncate(struct inode *inode, int *has_inline) @@ -589,10 +483,7 @@ ssize_t generic_read_dir(struct file *f, char *buf, size_t count, loff_t *ppos) return -EISDIR; } -void __ext4_error_file(struct file *file, const char *func, unsigned int line, - unsigned long long block, const char *fmt, ...) -{ -} +/* __ext4_error_file is now in super.c */ loff_t ext4_llseek(struct file *file, loff_t offset, int whence) { @@ -617,12 +508,416 @@ int ext4_dirblock_csum_verify(struct inode *inode, struct buffer_head *bh) return 1; } -long ext4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +/* ext4_ioctl is now in super.c */ + +int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) { return 0; } -int ext4_sync_file(struct file *file, loff_t start, loff_t end, int datasync) +/* + * Stubs for super.c + */ + +/* fscrypt stubs */ +void fscrypt_free_dummy_policy(struct fscrypt_dummy_policy *policy) +{ +} + +int fscrypt_is_dummy_policy_set(const struct fscrypt_dummy_policy *policy) +{ + return 0; +} + +int fscrypt_dummy_policies_equal(const struct fscrypt_dummy_policy *p1, + const struct fscrypt_dummy_policy *p2) +{ + return 1; +} + +void fscrypt_show_test_dummy_encryption(struct seq_file *seq, char sep, + struct super_block *sb) +{ +} + +void fscrypt_free_inode(struct inode *inode) +{ +} + +int fscrypt_drop_inode(struct inode *inode) +{ + return 0; +} + +/* Block device stubs */ +void bdev_fput(void *file) +{ +} + +void *bdev_file_open_by_dev(dev_t dev, int flags, void *holder, + const struct blk_holder_ops *ops) +{ + return ERR_PTR(-ENODEV); +} + +struct buffer_head *bdev_getblk(struct block_device *bdev, sector_t block, + unsigned int size, gfp_t gfp) +{ + return NULL; +} + +int trylock_buffer(struct buffer_head *bh) +{ + return 1; +} + +void submit_bh(int op, struct buffer_head *bh) +{ +} + +/* NFS export stubs */ +struct dentry *generic_fh_to_parent(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, u64, u32)) +{ + return ERR_PTR(-ESTALE); +} + +struct dentry *generic_fh_to_dentry(struct super_block *sb, struct fid *fid, + int fh_len, int fh_type, + struct inode *(*get_inode)(struct super_block *, u64, u32)) +{ + return ERR_PTR(-ESTALE); +} + +/* Inode stubs */ +int inode_generic_drop(struct inode *inode) { return 0; } + +void *alloc_inode_sb(struct super_block *sb, struct kmem_cache *cache, + gfp_t gfp) +{ + return NULL; +} + +void inode_set_iversion(struct inode *inode, u64 version) +{ +} + +/* rwlock stubs */ +void rwlock_init(rwlock_t *lock) +{ +} + +/* trace_ext4_drop_inode is now a macro in ext4_uboot.h */ + +/* Shutdown stub */ +void ext4_force_shutdown(void *sb, int flags) +{ +} + +/* Memory stubs */ +unsigned long roundup_pow_of_two(unsigned long n) +{ + unsigned long ret = 1; + + while (ret < n) + ret <<= 1; + return ret; +} + +void *kvzalloc(size_t size, gfp_t flags) +{ + return calloc(1, size); +} + +void ext4_kvfree_array_rcu(void *p) +{ + free(p); +} + +/* String stubs */ +/* strtomem_pad is now a macro in ext4_uboot.h */ + +char *strreplace(const char *str, char old, char new) +{ + char *s = (char *)str; + + while (*s) { + if (*s == old) + *s = new; + s++; + } + return (char *)str; +} + +char *kmemdup_nul(const char *s, size_t len, gfp_t gfp) +{ + char *buf; + + buf = kmalloc(len + 1, gfp); + if (buf) { + memcpy(buf, s, len); + buf[len] = '\0'; + } + return buf; +} + +/* Page allocation */ +unsigned long get_zeroed_page(gfp_t gfp) +{ + void *p = memalign(4096, 4096); + + if (p) + memset(p, 0, 4096); + return (unsigned long)p; +} + +void free_page(unsigned long addr) +{ + free((void *)addr); +} + +/* Trace stubs */ +void trace_ext4_error(struct super_block *sb, const char *func, unsigned int line) +{ +} + +/* Rate limiting */ +int ___ratelimit(struct ratelimit_state *rs, const char *func) +{ + return 1; +} + +/* I/O priority */ +int IOPRIO_PRIO_VALUE(int class, int data) +{ + return (class << 13) | data; +} + +void set_task_ioprio(void *task, int ioprio) +{ +} + +/* Fast commit */ +void ext4_fc_init(void *sb, void *journal) +{ +} + +/* Filesystem sync */ +int sync_filesystem(void *sb) +{ + return 0; +} + +/* Quota */ +int dquot_suspend(void *sb, int flags) +{ + return 0; +} + +/* MMP daemon */ +void ext4_stop_mmpd(void *sbi) +{ +} + +/* Sysfs */ +void ext4_unregister_sysfs(void *sb) +{ +} + +/* Journal destroy */ +int jbd2_journal_destroy(void *journal) +{ + return 0; +} + +/* percpu rwsem */ +void percpu_free_rwsem(struct percpu_rw_semaphore *sem) +{ +} + +/* Block device ops */ +void sync_blockdev(struct block_device *bdev) +{ +} + +void invalidate_bdev(struct block_device *bdev) +{ +} + +struct block_device *file_bdev(struct file *file) +{ + return NULL; +} + +/* xattr cache */ +void ext4_xattr_destroy_cache(void *cache) +{ +} + +/* kobject */ +void kobject_put(struct kobject *kobj) +{ +} + +/* completion */ +void wait_for_completion(struct completion *comp) +{ +} + +/* DAX */ +void *fs_dax_get_by_bdev(struct block_device *bdev, u64 *start, u64 *len, + void *holder) +{ + return NULL; +} + +void fs_put_dax(void *dax, void *holder) +{ +} + +/* Block size */ +int sb_set_blocksize(struct super_block *sb, int size) +{ + return size; +} + +/* Power of 2 check */ +int is_power_of_2(unsigned long n) +{ + return n != 0 && (n & (n - 1)) == 0; +} + +/* strscpy_pad is now a macro in ext4_uboot.h */ +/* kmemdup_nul is defined earlier in this file */ + +/* Address check */ +int generic_check_addressable(unsigned int blocksize_bits, u64 num_blocks) +{ + return 0; +} + +/* Block device blocks */ +u64 sb_bdev_nr_blocks(struct super_block *sb) +{ + return 0; +} + +/* bgl_lock_init is now a macro in ext4_uboot.h */ + +/* xattr handlers */ +const void *ext4_xattr_handlers[] = { NULL }; + +/* super_set_uuid is now a macro in ext4_uboot.h */ +/* super_set_sysfs_name_bdev is now a macro in ext4_uboot.h */ +/* bdev_can_atomic_write is now a macro in ext4_uboot.h */ +/* bdev_atomic_write_unit_max_bytes is now a macro in ext4_uboot.h */ + +/* Multi-mount protection */ +int ext4_multi_mount_protect(void *sb, unsigned long long mmp_block) +{ + return 0; +} + +/* Generic dentry ops */ +void generic_set_sb_d_ops(struct super_block *sb) +{ +} + +struct dentry *d_make_root(struct inode *inode) +{ + return NULL; +} + +/* percpu init rwsem */ +int percpu_init_rwsem(struct percpu_rw_semaphore *sem) +{ + return 0; +} + +/* Atomic operations */ +void atomic_add(int val, atomic_t *v) +{ + v->counter += val; +} + +void atomic64_add(s64 val, atomic64_t *v) +{ + v->counter += val; +} + +/* Discard */ +unsigned int bdev_max_discard_sectors(struct block_device *bdev) +{ + return 0; +} + +/* Rate limit init */ +void ratelimit_state_init(void *rs, int interval, int burst) +{ +} + +/* Sysfs */ +int ext4_register_sysfs(void *sb) +{ + return 0; +} + +/* dentry put */ +void dput(void *dentry) +{ +} + +/* timer_delete_sync is now a macro in linux/timer.h */ + +/* Get parent */ +void *ext4_get_parent(void *dentry) +{ + return (void *)-ESTALE; +} + +/* fsnotify */ +void fsnotify_sb_error(struct super_block *sb, struct inode *inode, int error) +{ +} + +/* JBD2 force commit */ +int jbd2_journal_force_commit(void *journal) +{ + return 0; +} + +/* File path */ +char *file_path(struct file *file, char *buf, int buflen) +{ + return buf; +} + +/* Fast commit delete */ +void ext4_fc_del(struct inode *inode) +{ +} + +/* invalidate_inode_buffers is now a macro in ext4_uboot.h */ +/* clear_inode is now a macro in ext4_uboot.h */ +/* fscrypt_put_encryption_info is now a macro in ext4_uboot.h */ +/* fsverity_cleanup_inode is now a macro in ext4_uboot.h */ + +/* ext4_ioctl - file ioctls not supported in U-Boot */ +long ext4_ioctl(struct file *file, unsigned int cmd, unsigned long arg) +{ + return -ENOTSUPP; +} + +/* JBD2 journal abort */ +void jbd2_journal_abort(void *journal, int error) +{ +} + +/* JBD2 journal inode release */ +void jbd2_journal_release_jbd_inode(void *journal, void *jinode) +{ +} diff --git a/fs/ext4l/super.c b/fs/ext4l/super.c index 33e7c08c952..2a67c6d8156 100644 --- a/fs/ext4l/super.c +++ b/fs/ext4l/super.c @@ -17,37 +17,7 @@ * David S. Miller (davem@caip.rutgers.edu), 1995 */ -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include "ext4_uboot.h" #include "ext4.h" #include "ext4_extents.h" /* Needed for trace points definition */ diff --git a/include/linux/freezer.h b/include/linux/freezer.h index be38266beeb..98eecec4394 100644 --- a/include/linux/freezer.h +++ b/include/linux/freezer.h @@ -8,10 +8,10 @@ #define _LINUX_FREEZER_H #define set_freezable() do { } while (0) -#define try_to_freeze() 0 -#define freezing(task) 0 -#define frozen(task) 0 +#define try_to_freeze() do { } while (0) +#define freezing(task) ({ (void)(task); 0; }) +#define frozen(task) ({ (void)(task); 0; }) #define freezable_schedule() do { } while (0) -#define freezable_schedule_timeout(t) 0 +#define freezable_schedule_timeout(t) ({ (void)(t); 0; }) #endif /* _LINUX_FREEZER_H */ diff --git a/include/linux/init.h b/include/linux/init.h index ea74422c337..7917508ffd7 100644 --- a/include/linux/init.h +++ b/include/linux/init.h @@ -12,8 +12,8 @@ #define _LINUX_INIT_H /* Section markers - these are no-ops in U-Boot */ -#define __init -#define __exit +#define __init __maybe_unused +#define __exit __maybe_unused #define __initdata #define __exitdata #define __initconst diff --git a/include/linux/kthread.h b/include/linux/kthread.h index ba35274e9a4..89c9f17760a 100644 --- a/include/linux/kthread.h +++ b/include/linux/kthread.h @@ -10,9 +10,9 @@ struct task_struct; #define kthread_create(fn, data, fmt, ...) \ - ((struct task_struct *)__builtin_return_address(0)) + ({ (void)(fn); (struct task_struct *)__builtin_return_address(0); }) #define kthread_run(fn, data, fmt, ...) \ - ((struct task_struct *)__builtin_return_address(0)) + ({ (void)(fn); (struct task_struct *)__builtin_return_address(0); }) #define kthread_stop(task) do { } while (0) #define kthread_should_stop() 0 #define kthread_should_park() 0 diff --git a/include/linux/mutex.h b/include/linux/mutex.h index 21835cfcd31..b13d85ef4e9 100644 --- a/include/linux/mutex.h +++ b/include/linux/mutex.h @@ -18,7 +18,7 @@ struct mutex { }; /* No-op macros that don't reference argument - for backward compatibility */ -#define DEFINE_MUTEX(name) struct mutex name = { .locked = 0 } +#define DEFINE_MUTEX(name) struct mutex name __maybe_unused = { .locked = 0 } #define mutex_init(lock) do { } while (0) #define mutex_lock(lock) do { } while (0) #define mutex_unlock(lock) do { } while (0) diff --git a/include/linux/percpu_counter.h b/include/linux/percpu_counter.h index 425648e6377..58d52d01310 100644 --- a/include/linux/percpu_counter.h +++ b/include/linux/percpu_counter.h @@ -14,12 +14,14 @@ struct percpu_counter { s64 count; + s64 counter; /* Alias for count - some code uses this name */ }; static inline int percpu_counter_init(struct percpu_counter *fbc, s64 amount, gfp_t gfp) { fbc->count = amount; + fbc->counter = amount; return 0; } diff --git a/include/linux/sched.h b/include/linux/sched.h index c16833f0db1..04672cee991 100644 --- a/include/linux/sched.h +++ b/include/linux/sched.h @@ -11,11 +11,17 @@ #include +/* io_context for I/O scheduling */ +struct io_context { + unsigned int ioprio; +}; + struct task_struct { int pid; char comm[16]; void *journal_info; /* For jbd2 */ unsigned int flags; /* PF_* flags */ + struct io_context *io_context; /* For I/O scheduling */ }; extern struct task_struct *current; diff --git a/include/linux/slab.h b/include/linux/slab.h index ac588dec6e2..e83817cc7ff 100644 --- a/include/linux/slab.h +++ b/include/linux/slab.h @@ -90,7 +90,7 @@ struct kmem_cache { }; struct kmem_cache *get_mem(int element_sz); -#define kmem_cache_create(a, sz, c, d, e) get_mem(sz) +#define kmem_cache_create(a, sz, c, d, e) ({ (void)(e); get_mem(sz); }) void *kmem_cache_alloc(struct kmem_cache *obj, gfp_t flag); static inline void *kmem_cache_zalloc(struct kmem_cache *obj, gfp_t flags) diff --git a/include/linux/timer.h b/include/linux/timer.h index ea1b838dad8..c150fc40cd3 100644 --- a/include/linux/timer.h +++ b/include/linux/timer.h @@ -15,16 +15,22 @@ struct timer_list { #define DEFINE_TIMER(name, func) \ struct timer_list name = { .function = func } -#define setup_timer(timer, func, data) do { } while (0) -#define timer_setup(timer, func, flags) do { } while (0) +#define setup_timer(timer, func, data) do { (void)(func); } while (0) +#define timer_setup(timer, func, flags) do { (void)(func); } while (0) #define init_timer(timer) do { } while (0) #define add_timer(timer) do { } while (0) -#define del_timer(timer) 0 -#define del_timer_sync(timer) do { } while (0) -#define mod_timer(timer, expires) 0 -#define timer_pending(timer) 0 +#define del_timer(timer) ({ (void)(timer); 0; }) +#define del_timer_sync(timer) do { (void)(timer); } while (0) +#define mod_timer(timer, expires) do { (void)(timer); (void)(expires); } while (0) +#define timer_pending(timer) ({ (void)(timer); 0; }) #define from_timer(var, callback_timer, timer_fieldname) \ container_of(callback_timer, typeof(*var), timer_fieldname) +#define timer_container_of(var, callback_timer, timer_fieldname) \ + container_of(callback_timer, typeof(*var), timer_fieldname) + +#define timer_shutdown_sync(timer) do { } while (0) +#define timer_delete_sync(timer) do { (void)(timer); } while (0) + #endif /* _LINUX_TIMER_H */ diff --git a/include/linux/workqueue.h b/include/linux/workqueue.h index 13afe18f805..687da2a98a8 100644 --- a/include/linux/workqueue.h +++ b/include/linux/workqueue.h @@ -16,8 +16,8 @@ struct delayed_work { struct work_struct work; }; -#define INIT_WORK(work, func) do { } while (0) -#define INIT_DELAYED_WORK(work, func) do { } while (0) +#define INIT_WORK(work, func) do { (void)(func); } while (0) +#define INIT_DELAYED_WORK(work, func) do { (void)(func); } while (0) #define schedule_work(work) do { } while (0) #define schedule_delayed_work(work, delay) 0 #define cancel_work_sync(work) 0