From patchwork Wed Dec 31 22:29: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: 1146 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=1767220270; bh=y3u0I/IQ0qq6uPFMIoq5N9dtbakOGgdl7hG4XiamZTo=; 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=ZZbpvqJqL3J9Dhc+aSgjqiB1FE1PoiPoMxTjV7RtuUiDvF02nLyOFloSDNY0/0W98 mDg3FxTy75UPjpua7arwNUQqnwuvj8N1BTKNE737dgpQpqcqfmKa/R94xMWzImDZ1A He2fCaKqJO5djD6H0uHBa6w2Yy5xtfplQGQv1KhFTNeNhxWs4gpjqsrL2FH5A+sDxj cuLTZQBehS8PtnQRLNr+DANpwbwaU9WOz4KZluM1Vfhm+NfJbYviQXjXhBqozzu1O2 tpOf4nLCBI2yo9fS66Sq5j3Nr4jmu7qOmF+aOJMHi+CDRCEYurLaiaHxa2kQCxiNBi jZzW0E8lAh1Cw== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 64BD968FCB for ; Wed, 31 Dec 2025 15:31:10 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10024) with ESMTP id bo7hgmvsskMp for ; Wed, 31 Dec 2025 15:31:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220270; bh=y3u0I/IQ0qq6uPFMIoq5N9dtbakOGgdl7hG4XiamZTo=; 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=ZZbpvqJqL3J9Dhc+aSgjqiB1FE1PoiPoMxTjV7RtuUiDvF02nLyOFloSDNY0/0W98 mDg3FxTy75UPjpua7arwNUQqnwuvj8N1BTKNE737dgpQpqcqfmKa/R94xMWzImDZ1A He2fCaKqJO5djD6H0uHBa6w2Yy5xtfplQGQv1KhFTNeNhxWs4gpjqsrL2FH5A+sDxj cuLTZQBehS8PtnQRLNr+DANpwbwaU9WOz4KZluM1Vfhm+NfJbYviQXjXhBqozzu1O2 tpOf4nLCBI2yo9fS66Sq5j3Nr4jmu7qOmF+aOJMHi+CDRCEYurLaiaHxa2kQCxiNBi jZzW0E8lAh1Cw== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 4FA3068FCF for ; Wed, 31 Dec 2025 15:31:10 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220267; bh=1IMo+OI2LfHlEjFSeo4xOjaGN6R82szU9OQ/kE+LDJQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=LCIFTOXdpTqbEC+am3LsglyJq4KoTpjYMZxovXl3ZAuFBH5BL5LUtyH817njjmQlE tCirLJ4hbtmJzfHnyKgZicNIMEjWQhiiQIcqGDatazv6rFbV9+VVgiNYhJVwec5Sx0 r92T2coTeczLjgkVV9cje+qdZ7OIMm5oJZaFIOh01XFjuQB71A4PIs2/NVnuXnupMN lAIjn9a1i68DoOfKYvpYTI/TH5osGt8+WWoXEugkIW6jvzxiOhuB5lQN/m7XvqbE6u a97Vhz8WP2RDEpFryJJsO+kCMrAX4Q2fMSGa4/RpzEik4QXJ21OA0n19ZeJ6nKGcQH uivhbq3pbzN6g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id DBB7868FCB; Wed, 31 Dec 2025 15:31: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 1RJTKnEB5hdr; Wed, 31 Dec 2025 15:31:07 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1767220260; bh=gTzf6RpmaHEfr5sISaHsBrr3xXvDKb5SHVy7MwyI6jg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Q8XO9u/oCGAjydK6l0mLy9Qp9Irt+0NuchTrJvuqd1k/XgcVq9a+RU2Wspxuy0mAj o1SJ3Rg06in93+sk35Xd+rN5QeVig90yh3zJvFigumVtu0adYConh/wKSLYoAtEFTV Bm5c4nyWFr6HlO+0YYliBH323TmkuhsJoI3w7/qLDrKsa0vs6wfjBqRCQN55Uj+Ga8 X4raeCX5Tiz1Y7+TqSMyKCjzLIl5/lH7OmgC2DS7UAIN6nZ0LsCZ6i9jGYVe53v56u M53+lfcaFupvS6IqLSi5ExeSiBBWdBaB6xR1Y8eWSZgZa+qt5zHjFT1PuLmsjKNHvP /Z55lKIudq4Xw== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 86A5468F65; Wed, 31 Dec 2025 15:31:00 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Wed, 31 Dec 2025 15:29:41 -0700 Message-ID: <20251231223008.3251711-9-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20251231223008.3251711-1-sjg@u-boot.org> References: <20251231223008.3251711-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: W3COXNPMDDIAADPF327WU4LP4R2GPBDL X-Message-ID-Hash: W3COXNPMDDIAADPF327WU4LP4R2GPBDL 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 08/26] 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 --- 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