diff options
-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 c5f2a99943..3145f3693b 100644 --- a/apps/main.c +++ b/apps/main.c | |||
@@ -172,7 +172,14 @@ static int init_dircache(bool preinit) | |||
172 | } | 172 | } |
173 | 173 | ||
174 | if (result < 0) | 174 | if (result < 0) |
175 | gui_syncsplash(0, "Failed! Result: %d", result); | 175 | { |
176 | /* Initialization of dircache failed. Manual action is | ||
177 | * necessary to enable dircache again. | ||
178 | */ | ||
179 | gui_syncsplash(0, "Dircache failed, disabled. Result: %d", result); | ||
180 | global_settings.dircache = false; | ||
181 | } | ||
182 | |||
176 | } | 183 | } |
177 | 184 | ||
178 | if (clear) | 185 | if (clear) |
diff --git a/apps/tree.c b/apps/tree.c index c3c5ce3239..5f5cb1137a 100644 --- a/apps/tree.c +++ b/apps/tree.c | |||
@@ -1348,7 +1348,8 @@ void tree_flush(void) | |||
1348 | { | 1348 | { |
1349 | global_status.dircache_size = dircache_get_cache_size(); | 1349 | global_status.dircache_size = dircache_get_cache_size(); |
1350 | # ifdef HAVE_EEPROM_SETTINGS | 1350 | # ifdef HAVE_EEPROM_SETTINGS |
1351 | dircache_save(); | 1351 | if (firmware_settings.initialized) |
1352 | dircache_save(); | ||
1352 | # endif | 1353 | # endif |
1353 | dircache_disable(); | 1354 | dircache_disable(); |
1354 | } | 1355 | } |
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 023f00f848..e69ecf3d5c 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, | |||
405 | return cache_entry; | 405 | return cache_entry; |
406 | } | 406 | } |
407 | 407 | ||
408 | #if 1 | 408 | #ifdef HAVE_EEPROM_SETTINGS |
409 | /** | 409 | /** |
410 | * Function to load the internal cache structure from disk to initialize | 410 | * Function to load the internal cache structure from disk to initialize |
411 | * the dircache really fast and little disk access. | 411 | * the dircache really fast and little disk access. |
@@ -480,9 +480,6 @@ int dircache_save(void) | |||
480 | 480 | ||
481 | remove(DIRCACHE_FILE); | 481 | remove(DIRCACHE_FILE); |
482 | 482 | ||
483 | while (thread_enabled) | ||
484 | sleep(1); | ||
485 | |||
486 | if (!dircache_initialized) | 483 | if (!dircache_initialized) |
487 | return -1; | 484 | return -1; |
488 | 485 | ||
@@ -718,7 +715,7 @@ bool dircache_is_enabled(void) | |||
718 | */ | 715 | */ |
719 | bool dircache_is_initializing(void) | 716 | bool dircache_is_initializing(void) |
720 | { | 717 | { |
721 | return dircache_initializing; | 718 | return dircache_initializing || thread_enabled; |
722 | } | 719 | } |
723 | 720 | ||
724 | /** | 721 | /** |
@@ -835,7 +832,7 @@ void dircache_copy_path(const struct dircache_entry *entry, char *buf, int size) | |||
835 | static int block_until_ready(void) | 832 | static int block_until_ready(void) |
836 | { | 833 | { |
837 | /* Block until dircache has been built. */ | 834 | /* Block until dircache has been built. */ |
838 | while (!dircache_initialized && dircache_initializing) | 835 | while (!dircache_initialized && dircache_is_initializing()) |
839 | sleep(1); | 836 | sleep(1); |
840 | 837 | ||
841 | if (!dircache_initialized) | 838 | if (!dircache_initialized) |
@@ -918,7 +915,7 @@ void dircache_bind(int fd, const char *path) | |||
918 | struct dircache_entry *entry; | 915 | struct dircache_entry *entry; |
919 | 916 | ||
920 | /* Queue requests until dircache has been built. */ | 917 | /* Queue requests until dircache has been built. */ |
921 | if (!dircache_initialized && dircache_initializing) | 918 | if (!dircache_initialized && dircache_is_initializing()) |
922 | { | 919 | { |
923 | if (fdbind_idx >= MAX_PENDING_BINDINGS) | 920 | if (fdbind_idx >= MAX_PENDING_BINDINGS) |
924 | return ; | 921 | return ; |