From patchwork Sat Mar 14 23:15:55 2026 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Simon Glass X-Patchwork-Id: 1977 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=1773530253; bh=mkgZu8V8WwA8P2o+0mklPAesgql1sOdk+u/uCZzKRjs=; 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=rTBhP7ksIALTnVmSCiQYFuB2VeQ/TZxwNPovYLG4FclT9J3OWu6GmmWs0RZt887gl XLFr6O0dYzPmePHUxni4vTnmw1rHTad8l0n8OFt0NlWDn26MOCU3lWnmwQZpCalQiX arxX5jb1H4zJBMnf1HYhlq3a1avnhrCCCOFy0eJ7tojZJhOWlWxfov3PzoDcr3Rp+F pJK9kY+U6Tvv3uf+/ZnnpYgiyRBWZWao79wc2clwy76yIUlLR8AwcBNqL2EMUyZUTh XKRwXY/KcS7ZQjCt33EJXES1uaK7BlsCZWm4vI2BwzezSvfBT/AgJ89HpdL+13oyfa YUsQC6W2mxT2A== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id CB6AE6A033 for ; Sat, 14 Mar 2026 17:17:33 -0600 (MDT) 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 AtPr1ooqXRwR for ; Sat, 14 Mar 2026 17:17:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773530253; bh=mkgZu8V8WwA8P2o+0mklPAesgql1sOdk+u/uCZzKRjs=; 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=rTBhP7ksIALTnVmSCiQYFuB2VeQ/TZxwNPovYLG4FclT9J3OWu6GmmWs0RZt887gl XLFr6O0dYzPmePHUxni4vTnmw1rHTad8l0n8OFt0NlWDn26MOCU3lWnmwQZpCalQiX arxX5jb1H4zJBMnf1HYhlq3a1avnhrCCCOFy0eJ7tojZJhOWlWxfov3PzoDcr3Rp+F pJK9kY+U6Tvv3uf+/ZnnpYgiyRBWZWao79wc2clwy76yIUlLR8AwcBNqL2EMUyZUTh XKRwXY/KcS7ZQjCt33EJXES1uaK7BlsCZWm4vI2BwzezSvfBT/AgJ89HpdL+13oyfa YUsQC6W2mxT2A== Received: from mail.u-boot.org (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id 67F106A03A for ; Sat, 14 Mar 2026 17:17:33 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773530250; bh=0yMS5iUD2FCgULW3JgYPbrwE6HLLEGefgzb/OfT6HfI=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WWrr6znYHY95WAlA3ilCdKnN/JuG6Neqyf52bcLfduNijwsbwzyzdvZqBDFgGPO32 wZFP9oKzWGhE5EaeCHM+LgDqT1rZ9BbQMnINertyk+f6QmYrmEoc2YIfxpSEkNC8qF hGDnwzVGVE5ZoQgEk79wYISGvrPHFqSB1aUaqfvINFN3/jsdIqj1ZyW+nUBzF9EgS9 zgxwpk6Uno/b0koWXGeKiVYWM94LVBMOUyMYhmyLMlf4mdif42sAHLvEi79kDHxx+F N9ku0Bavb2V+L4C20WEqtG2Fw00NjpoX936Wvowq5y0PninxFwFB87cz8GOaJd5dcY NvcjpPtn9Rq/g== Received: from localhost (localhost [127.0.0.1]) by mail.u-boot.org (Postfix) with ESMTP id BC6A769ECF; Sat, 14 Mar 2026 17:17:30 -0600 (MDT) 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 5eExhYeDbI4a; Sat, 14 Mar 2026 17:17:30 -0600 (MDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=u-boot.org; s=default; t=1773530250; bh=/de3gpSlObIRDTMSufbUgeqdfK9cUK17u8OXWptI4zk=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uiyUOnuAdJL7iVxlXVK1wVzDWERW/jFRrK2guQMHulJJ2TWAcE2Bl+yjJXireGARb q9H5HBni+4xeQaf5CrQTzXMV6DNAK9bkXm4Mf+sENFUOZ6DKL6UALioGUfMQTYJ+c5 aiYBrtVS+x+siiLjfCrzvdY4XV+kCh9EVcGrqbKu1Z1aYUBf3a0Akn3UUv7N/pi6ew TcrPkMxP/6yDtvgLw37GXe3D1xBpiMgONbUCGeDy+sEjCTpWERzSQuDnimtnSItkV7 GNdmBQAKlkgZeslHTGGY/xBAqsA7cJdrLIltDn002oRvv+wCGyySGgE13CIvPfZCvU 1OOjbYDEcJ/5w== Received: from u-boot.org (unknown [73.34.74.121]) by mail.u-boot.org (Postfix) with ESMTPSA id 50D1C69FF7; Sat, 14 Mar 2026 17:17:30 -0600 (MDT) From: Simon Glass To: U-Boot Concept Date: Sat, 14 Mar 2026 17:15:55 -0600 Message-ID: <20260314231618.338113-5-sjg@u-boot.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20260314231618.338113-1-sjg@u-boot.org> References: <20260314231618.338113-1-sjg@u-boot.org> MIME-Version: 1.0 Message-ID-Hash: 3OQK6TWO7DZIKRCRT6SDOTNCBKHUB5GY X-Message-ID-Hash: 3OQK6TWO7DZIKRCRT6SDOTNCBKHUB5GY 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 X-Mailman-Version: 3.3.10 Precedence: list Subject: [Concept] [PATCH 04/19] sandbox: Move malloc_dump_to_file() prototype to os.h List-Id: Discussion and patches related to U-Boot Concept Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: From: Simon Glass This function is only available in sandbox builds and uses os_open() and os_write(). Move its declaration from malloc.h (which conflicts with asm/malloc.h in sandbox files) to os.h where it fits naturally alongside other sandbox host-file operations. This allows sandbox code that includes asm/malloc.h to call malloc_dump_to_file() via os.h without a forward declaration. Signed-off-by: Simon Glass --- include/malloc.h | 11 ----------- include/os.h | 11 +++++++++++ 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/malloc.h b/include/malloc.h index 3deb90b2a0b..610289f3a6c 100644 --- a/include/malloc.h +++ b/include/malloc.h @@ -712,17 +712,6 @@ void malloc_disable_testing(void); */ void malloc_dump(void); -/** - * malloc_dump_to_file() - Write heap dump to a host file - * - * @fname: Path to the output file on the host filesystem - * Return: 0 on success, negative error code on failure - * - * This is only available in sandbox builds. It writes the same information - * as malloc_dump() but to a file instead of the console. - */ -int malloc_dump_to_file(const char *fname); - /** * malloc_log_start() - Start logging malloc traffic * diff --git a/include/os.h b/include/os.h index bc556f2195f..41e3022657c 100644 --- a/include/os.h +++ b/include/os.h @@ -546,6 +546,17 @@ int os_map_file(const char *pathname, int os_flags, void **bufp, int *sizep); */ int os_unmap(void *buf, int size); +/** + * malloc_dump_to_file() - Write heap dump to a host file + * + * This is only available in sandbox builds. It writes the same information + * as malloc_dump() but to a file instead of the console. + * + * @fname: Path to the output file on the host filesystem + * Return: 0 on success, negative error code on failure + */ +int malloc_dump_to_file(const char *fname); + /* * os_find_text_base() - Find the text section in this running process *