diff options
author | Heinrich Schuchardt <heinrich.schuchardt@canonical.com> | 2022-01-11 01:50:24 +0100 |
---|---|---|
committer | Simon Glass <sjg@chromium.org> | 2022-01-13 09:13:41 -0700 |
commit | 880dbc5f808b65f62b47c78939e12d32c1701ed6 (patch) | |
tree | ad070134af1229b18b7ade25070aeef82182baf1 /arch/sandbox | |
parent | dca7926c2cb82ff4aea665ed97e38520d39865a5 (diff) | |
download | u-boot-880dbc5f808b65f62b47c78939e12d32c1701ed6.zip u-boot-880dbc5f808b65f62b47c78939e12d32c1701ed6.tar.gz u-boot-880dbc5f808b65f62b47c78939e12d32c1701ed6.tar.bz2 |
sandbox: compatibility of os_get_filesize()
U-Boot define loff_t as long long. But the header
/usr/include/linux/types.h may not define it.
This has lead to a build error on Alpine Linux.
So let's use long long instead of loff_t for
the size parameter of function os_get_filesize().
Reported-by: Milan P. Stanić <mps@arvanta.net>
Signed-off-by: Heinrich Schuchardt <heinrich.schuchardt@canonical.com>
Tested-by: Milan P. Stanić <mps@arvanta.net>
Reviewed-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'arch/sandbox')
-rw-r--r-- | arch/sandbox/cpu/os.c | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index 6837bfc..40ebe32 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -624,7 +624,13 @@ const char *os_dirent_get_typename(enum os_dirent_t type) return os_dirent_typename[OS_FILET_UNKNOWN]; } -int os_get_filesize(const char *fname, loff_t *size) +/* + * For compatibility reasons avoid loff_t here. + * U-Boot defines loff_t as long long. + * But /usr/include/linux/types.h may not define it at all. + * Alpine Linux being one example. + */ +int os_get_filesize(const char *fname, long long *size) { struct stat buf; int ret; @@ -667,7 +673,7 @@ int os_read_ram_buf(const char *fname) { struct sandbox_state *state = state_get_current(); int fd, ret; - loff_t size; + long long size; ret = os_get_filesize(fname, &size); if (ret < 0) |