diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2007-04-07 17:48:51 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2007-04-07 17:48:51 +0000 |
| commit | 7b1e827f0cf6930a61671c1c26aab8ed662b4134 (patch) | |
| tree | 44627faf8f6b12bcbaf453763278748eb568628b | |
| parent | 8e6e25c353e95e6566a7dfabbd2ca31b0b9db09e (diff) | |
| download | rockbox-7b1e827f0cf6930a61671c1c26aab8ed662b4134.zip rockbox-7b1e827f0cf6930a61671c1c26aab8ed662b4134.tar.gz rockbox-7b1e827f0cf6930a61671c1c26aab8ed662b4134.tar.bz2 rockbox-7b1e827f0cf6930a61671c1c26aab8ed662b4134.tar.xz | |
Dircache fixes: Stop scanning properly if shutdown is initiated. Require user to re-enable dircache if initialization fails. Don't create statefile unless eeprom settings have been initialized.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@13060 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | apps/main.c | 9 | ||||
| -rw-r--r-- | apps/tree.c | 3 | ||||
| -rw-r--r-- | firmware/common/dircache.c | 11 |
3 files changed, 14 insertions, 9 deletions
diff --git a/apps/main.c b/apps/main.c index c5f2a99..3145f36 100644 --- a/apps/main.c +++ b/apps/main.c @@ -172,7 +172,14 @@ static int init_dircache(bool preinit) } if (result < 0) - gui_syncsplash(0, "Failed! Result: %d", result); + { + /* Initialization of dircache failed. Manual action is + * necessary to enable dircache again. + */ + gui_syncsplash(0, "Dircache failed, disabled. Result: %d", result); + global_settings.dircache = false; + } + } if (clear) diff --git a/apps/tree.c b/apps/tree.c index c3c5ce3..5f5cb11 100644 --- a/apps/tree.c +++ b/apps/tree.c @@ -1348,7 +1348,8 @@ void tree_flush(void) { global_status.dircache_size = dircache_get_cache_size(); # ifdef HAVE_EEPROM_SETTINGS - dircache_save(); + if (firmware_settings.initialized) + dircache_save(); # endif dircache_disable(); } diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 023f00f..e69ecf3 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -405,7 +405,7 @@ static struct dircache_entry* dircache_get_entry(const char *path, return cache_entry; } -#if 1 +#ifdef HAVE_EEPROM_SETTINGS /** * Function to load the internal cache structure from disk to initialize * the dircache really fast and little disk access. @@ -480,9 +480,6 @@ int dircache_save(void) remove(DIRCACHE_FILE); - while (thread_enabled) - sleep(1); - if (!dircache_initialized) return -1; @@ -718,7 +715,7 @@ bool dircache_is_enabled(void) */ bool dircache_is_initializing(void) { - return dircache_initializing; + return dircache_initializing || thread_enabled; } /** @@ -835,7 +832,7 @@ void dircache_copy_path(const struct dircache_entry *entry, char *buf, int size) static int block_until_ready(void) { /* Block until dircache has been built. */ - while (!dircache_initialized && dircache_initializing) + while (!dircache_initialized && dircache_is_initializing()) sleep(1); if (!dircache_initialized) @@ -918,7 +915,7 @@ void dircache_bind(int fd, const char *path) struct dircache_entry *entry; /* Queue requests until dircache has been built. */ - if (!dircache_initialized && dircache_initializing) + if (!dircache_initialized && dircache_is_initializing()) { if (fdbind_idx >= MAX_PENDING_BINDINGS) return ; |