summaryrefslogtreecommitdiff
path: root/firmware/include
diff options
context:
space:
mode:
Diffstat (limited to 'firmware/include')
-rw-r--r--firmware/include/dircache_redirect.h26
-rw-r--r--firmware/include/disk_cache.h4
2 files changed, 21 insertions, 9 deletions
diff --git a/firmware/include/dircache_redirect.h b/firmware/include/dircache_redirect.h
index ddd86c6d86..d7314cf3b1 100644
--- a/firmware/include/dircache_redirect.h
+++ b/firmware/include/dircache_redirect.h
@@ -24,6 +24,7 @@
24#include "pathfuncs.h" 24#include "pathfuncs.h"
25#include "dir.h" 25#include "dir.h"
26#include "dircache.h" 26#include "dircache.h"
27#include "file.h"
27 28
28#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) && !defined(BOOTLOADER) 29#if defined(HAVE_MULTIBOOT) && !defined(SIMULATOR) && !defined(BOOTLOADER)
29#include "rb-loader.h" 30#include "rb-loader.h"
@@ -185,22 +186,33 @@ static inline void volume_onmount_internal(IF_MV_NONVOID(int volume))
185 186
186 if (multiboot_is_boot_volume(IF_MV_VOL(volume))) 187 if (multiboot_is_boot_volume(IF_MV_VOL(volume)))
187 { 188 {
188 int rtlen = get_redirect_dir(rtpath, sizeof(rtpath), volume, "", ""); 189 /* get the full path to the BOOTFILE
189 while (rtlen > 0 && rtpath[--rtlen] == PATH_SEPCH) 190 ie. /<0>/redirectdir/.rockbox/rockbox.ext */
190 rtpath[rtlen] = '\0'; /* remove extra separators */ 191 int rtlen = get_redirect_dir(rtpath, sizeof(rtpath),
192 volume, BOOTDIR, BOOTFILE);
193
194 if (rtlen <= 0 || rtlen >= (int) sizeof(rtpath))
195 rtlen = 0; /* path too long or sprintf error */
196 else if (file_exists(rtpath))
197 {
198 rtlen = get_redirect_dir(rtpath, sizeof(rtpath), volume, "", "");
199 while (rtlen > 0 && rtpath[--rtlen] == PATH_SEPCH)
200 rtpath[rtlen] = '\0'; /* remove separators */
201 }
202 else
203 rtlen = 0; /* No BOOTFILE found */
191 204
192#if 0 /*removed, causes issues with playback for now?*/ 205#if 0 /*removed, causes issues with playback for now?*/
193 if (rtlen <= 0 || rtpath[rtlen] == VOL_END_TOK) 206 if (rtlen <= 0 || rtpath[rtlen] == VOL_END_TOK)
194 root_unmount_volume(volume); /* unmount so root can be hidden*/ 207 root_unmount_volume(volume); /* unmount so root can be hidden*/
195#endif 208#endif
196 if (rtlen <= 0) /* Error occurred, card removed? Set root to default */ 209 if (rtlen <= 0 || root_mount_path(rtpath, NSITEM_CONTENTS) != 0)
197 { 210 { /* Error occurred, card removed? Set root to default */
211 boot_data_valid = false;
198 root_unmount_volume(volume); /* unmount so root can be hidden*/ 212 root_unmount_volume(volume); /* unmount so root can be hidden*/
199 goto standard_redirect; 213 goto standard_redirect;
200 } 214 }
201 root_mount_path(rtpath, NSITEM_CONTENTS);
202 } 215 }
203
204 } 216 }
205 else 217 else
206 { 218 {
diff --git a/firmware/include/disk_cache.h b/firmware/include/disk_cache.h
index 79b2ccf2c6..9787c64aec 100644
--- a/firmware/include/disk_cache.h
+++ b/firmware/include/disk_cache.h
@@ -36,7 +36,7 @@ static inline void dc_unlock_cache(void)
36 mutex_unlock(&disk_cache_mutex); 36 mutex_unlock(&disk_cache_mutex);
37} 37}
38 38
39void * dc_cache_probe(IF_MV(int volume,) unsigned long secnum, 39void * dc_cache_probe(IF_MV(int volume,) sector_t secnum,
40 unsigned int *flags); 40 unsigned int *flags);
41void dc_dirty_buf(void *buf); 41void dc_dirty_buf(void *buf);
42void dc_discard_buf(void *buf); 42void dc_discard_buf(void *buf);
@@ -46,7 +46,7 @@ void dc_discard_all(IF_MV_NONVOID(int volume));
46void dc_init(void) INIT_ATTR; 46void dc_init(void) INIT_ATTR;
47 47
48/* in addition to filling, writeback is implemented by the client */ 48/* in addition to filling, writeback is implemented by the client */
49extern void dc_writeback_callback(IF_MV(int volume, ) unsigned long sector, 49extern void dc_writeback_callback(IF_MV(int volume, ) sector_t sector,
50 void *buf); 50 void *buf);
51 51
52 52