summaryrefslogtreecommitdiff
path: root/apps/tagcache.c
diff options
context:
space:
mode:
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r--apps/tagcache.c33
1 files changed, 28 insertions, 5 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c
index 6abf957bc2..f7746f1ec3 100644
--- a/apps/tagcache.c
+++ b/apps/tagcache.c
@@ -75,6 +75,7 @@
75#include "usb.h" 75#include "usb.h"
76#include "metadata.h" 76#include "metadata.h"
77#include "tagcache.h" 77#include "tagcache.h"
78#include "yesno.h"
78#include "core_alloc.h" 79#include "core_alloc.h"
79#include "crc32.h" 80#include "crc32.h"
80#include "misc.h" 81#include "misc.h"
@@ -5064,17 +5065,39 @@ void tagcache_unload_ramcache(void)
5064#endif /* HAVE_TC_RAMCACHE */ 5065#endif /* HAVE_TC_RAMCACHE */
5065 5066
5066#ifndef __PCTOOL__ 5067#ifndef __PCTOOL__
5068
5069/*
5070 * db_file_exists is noinline to minimize stack usage
5071 */
5072static bool NO_INLINE db_file_exists(const char* filename)
5073{
5074 char buf[MAX_PATH];
5075
5076 snprintf(buf, sizeof(buf), "%s/%s", tc_stat.db_path, filename);
5077
5078 return file_exists(buf);
5079}
5080
5067static void tagcache_thread(void) 5081static void tagcache_thread(void)
5068{ 5082{
5069 struct queue_event ev; 5083 struct queue_event ev;
5070 bool check_done = false; 5084 bool check_done = false;
5071 5085 cpu_boost(true);
5072 /* If the previous cache build/update was interrupted, commit 5086 /* If the previous cache build/update was interrupted, commit
5073 * the changes first in foreground. */ 5087 * the changes first in foreground. */
5074 cpu_boost(true); 5088 if (db_file_exists(TAGCACHE_FILE_TEMP))
5075 allocate_tempbuf(); 5089 {
5076 commit(); 5090 static const char *lines[] = {ID2P(LANG_TAGCACHE_BUSY),
5077 free_tempbuf(); 5091 ID2P(LANG_TAGCACHE_UPDATE)};
5092 static const struct text_message message = {lines, 2};
5093
5094 if (gui_syncyesno_run_w_tmo(HZ * 5, YESNO_YES, &message, NULL, NULL) == YESNO_YES)
5095 {
5096 allocate_tempbuf();
5097 commit();
5098 free_tempbuf();
5099 }
5100 }
5078 5101
5079#ifdef HAVE_TC_RAMCACHE 5102#ifdef HAVE_TC_RAMCACHE
5080#ifdef HAVE_EEPROM_SETTINGS 5103#ifdef HAVE_EEPROM_SETTINGS