diff options
| author | Tom Rini <trini@konsulko.com> | 2023-10-02 10:55:44 -0400 |
|---|---|---|
| committer | Tom Rini <trini@konsulko.com> | 2023-10-02 10:55:44 -0400 |
| commit | ac897385bbfa30cfdfb62ccf24acfcd4b274b2ff (patch) | |
| tree | ae567980737beb24ca24e2ee8cfeaf6eb9e26e3f /arch/sandbox/cpu | |
| parent | 4459ed60cb1e0562bc5b40405e2b4b9bbf766d57 (diff) | |
| parent | e29b932aa07fa0226d325b35d96cd4eea0370129 (diff) | |
Merge branch 'next'
Signed-off-by: Tom Rini <trini@konsulko.com>
Diffstat (limited to 'arch/sandbox/cpu')
| -rw-r--r-- | arch/sandbox/cpu/os.c | 24 | ||||
| -rw-r--r-- | arch/sandbox/cpu/start.c | 7 |
2 files changed, 25 insertions, 6 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 9e93a0fa571..85d0d6a1703 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -258,6 +258,30 @@ int os_unmap(void *buf, int size) return 0; } +int os_persistent_file(char *buf, int maxsize, const char *fname) +{ + const char *dirname = getenv("U_BOOT_PERSISTENT_DATA_DIR"); + char *ptr; + int len; + + len = strlen(fname) + (dirname ? strlen(dirname) + 1 : 0) + 1; + if (len > maxsize) + return -ENOSPC; + + ptr = buf; + if (dirname) { + strcpy(ptr, dirname); + ptr += strlen(dirname); + *ptr++ = '/'; + } + strcpy(ptr, fname); + + if (access(buf, F_OK) == -1) + return -ENOENT; + + return 0; +} + /* Restore tty state when we exit */ static struct termios orig_term; static bool term_setup; diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index 234652872ec..1026898727f 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -119,12 +119,7 @@ int sandbox_early_getopt_check(void) os_exit(0); } - -static int sandbox_misc_init_f(void *ctx, struct event *event) -{ - return sandbox_early_getopt_check(); -} -EVENT_SPY(EVT_MISC_INIT_F, sandbox_misc_init_f); +EVENT_SPY_SIMPLE(EVT_MISC_INIT_F, sandbox_early_getopt_check); static int sandbox_cmdline_cb_help(struct sandbox_state *state, const char *arg) { |
