From patchwork Fri Jan 2 00:50:42 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1176 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=1767315131; bh=+VwixHsEgnj/K6Hx5Dm+fV6CcG+s4S+ps7DBnTOnPgo=; 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=gP2s9ZRPmlkY5ltpWN9/WiNNXPKnhe2Mp8uXWWbA9trCL8iJTDwlsMkoyzmZwfkZw 4Rau/FKpyB0ING4ppy9qGysToBZw+/eqUOOVYHECZSEuoldaynyIZnASFmyOpWKvs8 jcfCmoGkHLwaU46ghRF0/UagVCz5JS8CMXDZwPi/C6iENC2ghtAiWulSXbdgJW++z0 MqoVW7Pu24NoxkQzvXGbd17eB6EbvwjOHTIB8/pK8jR6Nb8Qy+brq5nb3aEaeUgHDd evKVd5MJU3M20L3KH3EHKGHPgHZSh8HKoLh76nzmcIgU1LP3Z6D1zHA+1ycW6xMVao a+4fSEt/aNkuw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 9D7D168F56 for ; Thu, 1 Jan 2026 17:52:11 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id oYpORN3_CcwV for ; Thu, 1 Jan 2026 17:52:11 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315129; bh=+VwixHsEgnj/K6Hx5Dm+fV6CcG+s4S+ps7DBnTOnPgo=; 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=ecL9aB1PbNxIyTdsaHJtqcTdqygM5PffBFqZitEOmsrcEc/yXnN3+HgUhhZP+MjcG HzcNJ+eNDnx+broRaN9PH+b/qv7Asa9EGb/P/RSJAEJuqGn8eFTTY0AWLseLTZkNWV 5R4DLEZiSmSuLYhBQfngPS93E5POdC6gzOkG6+jgh7zM9NU6IgdTvRM+FiiQRQHBq9 YbF7BzjmhOKGZyc/tf+koQsin4uhueD8cHV9ACDNCGzNHAInHlTdJ6xsoIZ7vRKT92 dQdOzNE4IrTjHM2mdYSdi8l2ZLYAr9yaoAInqlQnYVQuQsTPMTV4GLeKe1gBb9Grg7 KTQD6MbZLVSYw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4673268F58 for ; Thu, 1 Jan 2026 17:52:09 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315127; bh=Fnw4oB8CzyP2cRsSfs6zjeETaPQakn0TG2eOt/APwK4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=EV/BspvCH8HtrgFM/Xu6kkZ7QL9BKjfSOplw4FI1FEp+TgsgRYHA0NvH0UL88N7Oc X7DuDZrSb/cRSd8KniUa7iFcR4VHR4QNh5CFSVbyYVK/kG57BHIoUyck2YJIxXvE6r d4R1jhikkS397Z+adoXSL4XGWQAaMc8pSsG686uRRuddVIDvBu+AYvRKy3RLr3oGgQ yL500d6ydCAiMam3FqcOkIFdeZoFoVH0NkHwllFTFr4FZ8UE4ihFL9PznO/19M15i+ 5cn2BwoYWX6PjY3IgX/cYnTQLY8eFGJw77ZRfm/N2t8FB94mDnV8O8yWELGOtlX61B X2iIYU3NqBHkQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 20D7668F56; Thu, 1 Jan 2026 17:52:07 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id VfKzECTyO3x7; Thu, 1 Jan 2026 17:52:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767315120; bh=oc8LbB9fPol8zy9BxeeMRA8mfae4O+Ud5NkMgcbzXxs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=kNqPGfNZ1C7fmL740eQwYsinDGUEtXlOD85gvNqKFl3t1JCcRDMHyPmmn0DReV9xe diEl59erRCREF64XipahMW0sTe7H+pDj8pBQ/B5YgcKtFM14+dnI3Ry7w1YDtec0YR 6wp7sKMVeH8lPyNYFUOnlEJbEqfmQRZTftgy/RdVcUxzZEBQKNfN0ygS1La0FzxZLq wxEPgkUmVuK49OTSF0aRKLEE2Gw4SYgvz7iTu8UnPwpo/zbkiudMhrgRlCebqugRWb ztlmcE9t0LFpDamhjY1cg/qXDTzztfBqxx5si2lwj9acACbZhDM4NC+QPTPI3cyqf5 pk+sl70oORA9Q== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 66C8C68F58; Thu, 1 Jan 2026 17:52:00 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Thu, 1 Jan 2026 17:50:42 -0700 Message-ID: <20260102005112.552256-13-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260102005112.552256-1-sjg@u-boot.org> References: <20260102005112.552256-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: GDPG7LSV4DIOBIQWF77GS6ZDOTHXGKT7 X-Message-ID-Hash: GDPG7LSV4DIOBIQWF77GS6ZDOTHXGKT7 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: Heinrich Schuchardt , Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH v2 12/30] ext4l: Move message buffer functions to support.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 Move the message buffer functions from interface.c to support.c since they are internal support code rather than filesystem-interface functions. This keeps interface.c focused on functions called from the U-Boot filesystem layer. Functions moved: - ext4l_msg_init() - ext4l_record_msg() - ext4l_get_msg_buf() - ext4l_print_msgs() Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- (no changes since v1) fs/ext4l/ext4_uboot.h | 6 +++-- fs/ext4l/interface.c | 51 ------------------------------------------- fs/ext4l/support.c | 51 +++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 55 insertions(+), 53 deletions(-) diff --git a/fs/ext4l/ext4_uboot.h b/fs/ext4l/ext4_uboot.h index 087d8394ab6..37a4abb537f 100644 --- a/fs/ext4l/ext4_uboot.h +++ b/fs/ext4l/ext4_uboot.h @@ -2892,12 +2892,14 @@ void bh_cache_clear(void); int bh_cache_sync(void); int ext4l_read_block(sector_t block, size_t size, void *buffer); int ext4l_write_block(sector_t block, size_t size, void *buffer); +void ext4l_msg_init(void); +void ext4l_record_msg(const char *msg, int len); +struct membuf *ext4l_get_msg_buf(void); +void ext4l_print_msgs(void); /* ext4l interface functions (interface.c) */ struct blk_desc *ext4l_get_blk_dev(void); struct disk_partition *ext4l_get_partition(void); -void ext4l_record_msg(const char *msg, int len); -struct membuf *ext4l_get_msg_buf(void); #define sb_is_blkdev_sb(sb) ({ (void)(sb); 0; }) diff --git a/fs/ext4l/interface.c b/fs/ext4l/interface.c index 7c37c99488a..aebcc17fd3a 100644 --- a/fs/ext4l/interface.c +++ b/fs/ext4l/interface.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -24,9 +23,6 @@ #include "ext4_uboot.h" #include "ext4.h" -/* Message buffer size */ -#define EXT4L_MSG_BUF_SIZE 4096 - /* Global state */ static struct blk_desc *ext4l_dev_desc; static struct disk_partition ext4l_part; @@ -42,10 +38,6 @@ static int ext4l_open_dirs; /* Global super_block pointer for filesystem operations */ static struct super_block *ext4l_sb; -/* Message recording buffer */ -static struct membuf ext4l_msg_buf; -static char ext4l_msg_data[EXT4L_MSG_BUF_SIZE]; - /** * ext4l_get_blk_dev() - Get the current block device * @@ -150,49 +142,6 @@ void ext4l_clear_blk_dev(void) ext4l_mounted = 0; } -/** - * ext4l_msg_init() - Initialize the message buffer - */ -static void ext4l_msg_init(void) -{ - membuf_init(&ext4l_msg_buf, ext4l_msg_data, EXT4L_MSG_BUF_SIZE); -} - -/** - * ext4l_record_msg() - Record a message in the buffer - * - * @msg: Message string to record - * @len: Length of message - */ -void ext4l_record_msg(const char *msg, int len) -{ - membuf_put(&ext4l_msg_buf, msg, len); -} - -/** - * ext4l_get_msg_buf() - Get the message buffer - * - * Return: Pointer to the message buffer - */ -struct membuf *ext4l_get_msg_buf(void) -{ - return &ext4l_msg_buf; -} - -/** - * ext4l_print_msgs() - Print all recorded messages - * - * Prints the contents of the message buffer to the console. - */ -static void ext4l_print_msgs(void) -{ - char *data; - int len; - - while ((len = membuf_getraw(&ext4l_msg_buf, 80, true, &data)) > 0) - printf("%.*s", len, data); -} - int ext4l_probe(struct blk_desc *fs_dev_desc, struct disk_partition *fs_partition) { diff --git a/fs/ext4l/support.c b/fs/ext4l/support.c index 72bf819c3d6..1fc0bc0aa21 100644 --- a/fs/ext4l/support.c +++ b/fs/ext4l/support.c @@ -10,6 +10,7 @@ */ #include +#include #include #include #include @@ -19,6 +20,13 @@ #include "ext4_uboot.h" #include "ext4.h" +/* Message buffer size */ +#define EXT4L_MSG_BUF_SIZE 4096 + +/* Message recording buffer */ +static struct membuf ext4l_msg_buf; +static char ext4l_msg_data[EXT4L_MSG_BUF_SIZE]; + /* * Global task_struct for U-Boot. * This must be a single global instance shared across all translation units, @@ -46,6 +54,49 @@ u32 ext4l_crc32c(u32 crc, const void *address, unsigned int length) return crc32c_cal(crc, address, length, ext4l_crc32c_table); } +/** + * ext4l_msg_init() - Initialise the message buffer + */ +void ext4l_msg_init(void) +{ + membuf_init(&ext4l_msg_buf, ext4l_msg_data, EXT4L_MSG_BUF_SIZE); +} + +/** + * ext4l_record_msg() - Record a message in the buffer + * + * @msg: Message string to record + * @len: Length of message + */ +void ext4l_record_msg(const char *msg, int len) +{ + membuf_put(&ext4l_msg_buf, msg, len); +} + +/** + * ext4l_get_msg_buf() - Get the message buffer + * + * Return: Pointer to the message buffer + */ +struct membuf *ext4l_get_msg_buf(void) +{ + return &ext4l_msg_buf; +} + +/** + * ext4l_print_msgs() - Print all recorded messages + * + * Prints the contents of the message buffer to the console. + */ +void ext4l_print_msgs(void) +{ + char *data; + int len; + + while ((len = membuf_getraw(&ext4l_msg_buf, 80, true, &data)) > 0) + printf("%.*s", len, data); +} + /* * iget_locked - allocate a new inode * @sb: super block of filesystem