diff options
author | Simon Glass <sjg@chromium.org> | 2022-09-06 20:27:08 -0600 |
---|---|---|
committer | Tom Rini <trini@konsulko.com> | 2022-09-29 16:09:56 -0400 |
commit | 73c5cb9dacbcf2e988fffa66750c4206fccc8cbc (patch) | |
tree | 2665b1f5aaf1519c9600694ff0be67da23e9de58 /arch/sandbox/include/asm/state.h | |
parent | 2b90e0d54efe6e83c9313c863184b71eb811853e (diff) |
sandbox: Add a function to load a relative file path
At present this implementation is specific to loading the test FDT. We
plan to load others, so create a generic function to handle this.
The path is now limited to 256 characters, to simplify the code.
When there is an empty argv[0] (which should not happen), the function now
just uses the path as is, with no prefix.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox/include/asm/state.h')
-rw-r--r-- | arch/sandbox/include/asm/state.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/arch/sandbox/include/asm/state.h b/arch/sandbox/include/asm/state.h index 07c768ae5df..12741ee064a 100644 --- a/arch/sandbox/include/asm/state.h +++ b/arch/sandbox/include/asm/state.h @@ -266,6 +266,20 @@ void state_reset_for_test(struct sandbox_state *state); void state_show(struct sandbox_state *state); /** + * state_get_rel_filename() - Get a filename relative to the executable + * + * This uses argv[0] to obtain a filename path + * + * @rel_path: Relative path to build, e.g. "arch/sandbox/dts/test.dtb". Must not + * have a trailing / + * @buf: Buffer to use to return the filename + * @size: Size of buffer + * @return length of filename (including terminator), -ENOSPC if @size is too + * small + */ +int state_get_rel_filename(const char *rel_path, char *buf, int size); + +/** * Initialize the test system state */ int state_init(void); |