[Concept,04/19] sandbox: Move malloc_dump_to_file() prototype to os.h

Message ID 20260314231618.338113-5-sjg@u-boot.org
State New
Headers
Series test: Fix pytest inter-test side effects |

Commit Message

Simon Glass March 14, 2026, 11:15 p.m. UTC
  From: Simon Glass <sjg@chromium.org>

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 <sjg@chromium.org>
---

 include/malloc.h | 11 -----------
 include/os.h     | 11 +++++++++++
 2 files changed, 11 insertions(+), 11 deletions(-)
  

Patch

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
  *