From patchwork Mon Jan 19 20:41:10 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1647 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=1768855394; bh=a2gfkbUZhXLHRJc2e4oY1wMMK3Wwray1EXJ+3h4YmlE=; 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=BtdsgcJ5J1uab+ePR4xepBzrtH3sV3S54UJuJvozeW/TPdR6jxiKX3WHLciRfxUZx Z2Ieh+aEo9JUw43NUAy8jwcX6y7Mwb964gi7ZtTZI0t8GYr6embQptk4t0HKWXEQaq +rINuzXwAY3R2GyqIxig8/sQ4+5hM9wBZCL8R0TWmSzZu85Wx/toWzSVbGF2oRqqvD IfayUjK7jjHpy7PaNQePxnB9dXiXlJ9v52/0HR21bzgj/IG44RCC8B8mWSuzG1a63a Yqer7N4pBGpEC2fmPOE/eS9DMbhp0srKOpoxbTJ/p9lucFiiaNgz6g5Q3RZtudsgbM JiMS3DLSbOF6Q== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id C936069519 for ; Mon, 19 Jan 2026 13:43: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 10024) with ESMTP id scU0RoN0KxZi for ; Mon, 19 Jan 2026 13:43:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768855394; bh=a2gfkbUZhXLHRJc2e4oY1wMMK3Wwray1EXJ+3h4YmlE=; 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=BtdsgcJ5J1uab+ePR4xepBzrtH3sV3S54UJuJvozeW/TPdR6jxiKX3WHLciRfxUZx Z2Ieh+aEo9JUw43NUAy8jwcX6y7Mwb964gi7ZtTZI0t8GYr6embQptk4t0HKWXEQaq +rINuzXwAY3R2GyqIxig8/sQ4+5hM9wBZCL8R0TWmSzZu85Wx/toWzSVbGF2oRqqvD IfayUjK7jjHpy7PaNQePxnB9dXiXlJ9v52/0HR21bzgj/IG44RCC8B8mWSuzG1a63a Yqer7N4pBGpEC2fmPOE/eS9DMbhp0srKOpoxbTJ/p9lucFiiaNgz6g5Q3RZtudsgbM JiMS3DLSbOF6Q== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id B69CB69513 for ; Mon, 19 Jan 2026 13:43:14 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768855393; bh=kpSupJOGoOK3GzEuqXdBMej89hMDmcaj6t05R/9+fEE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=belVGeqh0VROJz1zopYEnCBp3NE8Q0wEgkIcohPPwM/H8795/63/2Xy70Kus7pU93 Rw86i9lVkgDSsfJf1QrF8HxPbIq0MX5TIuhb1XYBrgcSOHKIFMHOUFHdevOLtoKUyB XsPKDOM94101uQfjAc5BRTyiH2fh/oG6ptj+qJwD5tvLCpQf3Mf2w4Z/CDHtWmnmsm YK80IAMiMNvZhKvQoFdOcSbK5NzFCfipidplUglWANu5layfyAzFikiYV46oFAOApN CqsZ23srqtrqPIte3mBF/5NmO7dRxFajjz9oaRV4Ch/4xmyQb41CIRhrUuUBF6SXj9 Y7qHCqGIUJJyQ== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 098A4693E3; Mon, 19 Jan 2026 13:43:13 -0700 (MST) X-Virus-Scanned: Debian amavis at Received: from mail.u-boot.org ([127.0.0.1]) by localhost (mail.u-boot.org [127.0.0.1]) (amavis, port 10026) with ESMTP id pdGSMBhkMCds; Mon, 19 Jan 2026 13:43:12 -0700 (MST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1768855388; bh=Wi9ggxO5/CfRsNvZJA5VQfj24817U7iwzE66+m4xzGs=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=GJg7edElq+5OMdhrJEClcXWiPIkvNzqSpsHNC1pa3HUOjAQ1zVRMUO/GuQMH52vMu VOlKUkA85G2Gdtqy9glwnhN9EFW9lFNxhv/K2dsHAtUSjqqGBCldv1LTsL4vYMDS8F migqST0blXx0eytOEqw2YKxqetLWIQdoDT0Xck+9O7l7OhT/NWVBMg6DQE8ApB/D1G VeXyiTOhHtV06StIhX33Y8VtW3PfsBE9qa980hp9pqna4YVN6XUWArPicx/YPM8PPi L1uWY1C46sqBbmyRuR+hDhpyyD4z7RVHjlWA6fiz1ahTAPQelyHpmTISoxgBLlRl44 QPxGTaKe7yCFA== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 9D73C693BA; Mon, 19 Jan 2026 13:43:08 -0700 (MST) From: Simon Glass To: U-Boot Concept Date: Mon, 19 Jan 2026 13:41:10 -0700 Message-ID: <20260119204130.3972647-18-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260119204130.3972647-1-sjg@u-boot.org> References: <20260119204130.3972647-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 65UN4LR4UEXJAXPEZTZZSDYRC7QBQMM3 X-Message-ID-Hash: 65UN4LR4UEXJAXPEZTZZSDYRC7QBQMM3 X-MailFrom: sjg@u-boot.org X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; loop; banned-address; emergency; member-moderation; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header CC: Simon Glass , "Claude Opus 4 . 5" X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 17/27] sandbox: expo: Add expo_dump_file() 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 function to dump expo structures to a file, which is useful for debugging. This uses the configurable output function added in the previous patch. Co-developed-by: Claude Opus 4.5 Signed-off-by: Simon Glass --- boot/expo_dump.c | 36 ++++++++++++++++++++++++++++++++++++ include/expo.h | 9 +++++++++ 2 files changed, 45 insertions(+) diff --git a/boot/expo_dump.c b/boot/expo_dump.c index cb0a1e443e3..940a505b313 100644 --- a/boot/expo_dump.c +++ b/boot/expo_dump.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include "scene_internal.h" @@ -306,3 +307,38 @@ void expo_dump(struct expo *exp, struct membuf *mb) expo_dump_(&ctx, exp); } + +/** + * dump_out_file() - Output function that writes to a file + * + * @priv: Pointer to file descriptor (int *) + * @buf: Buffer containing data to output + * @len: Length of data in buffer + */ +static void dump_out_file(void *priv, const char *buf, int len) +{ + int *fdp = priv; + + os_write(*fdp, buf, len); +} + +int expo_dump_file(struct expo *exp, const char *fname) +{ + struct dump_ctx ctx; + int fd; + + fd = os_open(fname, OS_O_WRONLY | OS_O_CREAT | OS_O_TRUNC); + if (fd < 0) + return fd; + + ctx.out = dump_out_file; + ctx.priv = &fd; + ctx.scn = NULL; + ctx.indent = 0; + + expo_dump_(&ctx, exp); + + os_close(fd); + + return 0; +} diff --git a/include/expo.h b/include/expo.h index e3451d8dd23..c854d78255b 100644 --- a/include/expo.h +++ b/include/expo.h @@ -1279,6 +1279,15 @@ void expo_damage_add(struct expo *exp, const struct vid_bbox *bbox); */ void expo_dump(struct expo *exp, struct membuf *mb); +/** + * expo_dump_file() - Dump expo structure to a file (sandbox only) + * + * @exp: Expo to dump + * @fname: Filename to write to + * Return: 0 if OK, -ve on error + */ +int expo_dump_file(struct expo *exp, const char *fname); + /** * scene_dump() - Dump scene structure to a membuf *