diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2022-03-07 11:53:40 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2022-03-11 10:58:20 -0500 |
commit | 7fa48faeb55fb43b6a4e727d0abd104b267c89a4 (patch) | |
tree | 4f3a735bc72009dc100045c8964d937be1cce7e4 /firmware/include | |
parent | 439b4e8bcad57fac53f4286033f431e7e9df6546 (diff) | |
download | rockbox-7fa48faeb55fb43b6a4e727d0abd104b267c89a4.tar.gz rockbox-7fa48faeb55fb43b6a4e727d0abd104b267c89a4.zip |
multiboot: Refactor duplicated functions to a separate file
The implementation of write_bootdata() and get_redirect_dir() was
copied verbatim in two different places, obviously a bad thing for
maintainability. This moves them to a new file multiboot.c as they
are only used for multiboot.
Change-Id: Id0279216e4dd019f8bf612a81d3835eff010e506
Diffstat (limited to 'firmware/include')
-rw-r--r-- | firmware/include/dircache_redirect.h | 1 | ||||
-rw-r--r-- | firmware/include/rb-loader.h | 20 |
2 files changed, 5 insertions, 16 deletions
diff --git a/firmware/include/dircache_redirect.h b/firmware/include/dircache_redirect.h index c8905455f9..65b2184d2b 100644 --- a/firmware/include/dircache_redirect.h +++ b/firmware/include/dircache_redirect.h | |||
@@ -27,6 +27,7 @@ | |||
27 | 27 | ||
28 | #if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) && !defined(BOOTLOADER) | 28 | #if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) && !defined(BOOTLOADER) |
29 | #include "rb-loader.h" | 29 | #include "rb-loader.h" |
30 | #include "multiboot.h" | ||
30 | #include "bootdata.h" | 31 | #include "bootdata.h" |
31 | #include "crc32.h" | 32 | #include "crc32.h" |
32 | #endif | 33 | #endif |
diff --git a/firmware/include/rb-loader.h b/firmware/include/rb-loader.h index 71b6e038aa..d554ace95e 100644 --- a/firmware/include/rb-loader.h +++ b/firmware/include/rb-loader.h | |||
@@ -18,21 +18,9 @@ | |||
18 | * | 18 | * |
19 | ****************************************************************************/ | 19 | ****************************************************************************/ |
20 | 20 | ||
21 | #ifndef __RB_LOADER_H__ | ||
22 | #define __RB_LOADER_H__ | ||
23 | |||
21 | int load_firmware(unsigned char* buf, const char* firmware, int buffer_size); | 24 | int load_firmware(unsigned char* buf, const char* firmware, int buffer_size); |
22 | 25 | ||
23 | #ifdef HAVE_MULTIBOOT /* defined by config.h */ | 26 | #endif /* __RB_LOADER_H__ */ |
24 | /* Check in root of this <volume> for rockbox_main.<playername> | ||
25 | * if this file empty or there is a single slash '/' | ||
26 | * buf = '<volume#>/<rootdir>/<firmware(name)>\0' | ||
27 | * If instead '/<*DIRECTORY*>' is supplied | ||
28 | * addpath will be set to this DIRECTORY buf = | ||
29 | * '/<volume#>/addpath/<rootdir>/<firmware(name)>\0' | ||
30 | * On error returns Negative number or 0 | ||
31 | * On success returns bytes from snprintf | ||
32 | * and generated path will be placed in buf | ||
33 | * note: if supplied buffer is too small return will be | ||
34 | * the number of bytes that would have been written | ||
35 | */ | ||
36 | int get_redirect_dir(char* buf, int buffer_size, int volume, | ||
37 | const char* rootdir, const char* firmware); | ||
38 | #endif | ||