diff options
Diffstat (limited to 'apps/tagcache.c')
-rw-r--r-- | apps/tagcache.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/apps/tagcache.c b/apps/tagcache.c index 228b7cb751..c853c9d5e8 100644 --- a/apps/tagcache.c +++ b/apps/tagcache.c | |||
@@ -484,12 +484,12 @@ static int NO_INLINE open_db_fd(const char* filename, int mode) | |||
484 | 484 | ||
485 | if(mode & O_CREAT) | 485 | if(mode & O_CREAT) |
486 | { | 486 | { |
487 | if (mkdir(global_settings.tagcache_db_path) < 0 && errno != EEXIST) | 487 | if (mkdir(tc_stat.db_path) < 0 && errno != EEXIST) |
488 | return -1; | 488 | return -1; |
489 | } | 489 | } |
490 | 490 | ||
491 | return open_pathfmt(buf, sizeof(buf), mode, "%s/%s", | 491 | return open_pathfmt(buf, sizeof(buf), mode, "%s/%s", |
492 | global_settings.tagcache_db_path, filename); | 492 | tc_stat.db_path, filename); |
493 | } | 493 | } |
494 | 494 | ||
495 | static int NO_INLINE remove_db_file(const char* filename) | 495 | static int NO_INLINE remove_db_file(const char* filename) |
@@ -497,7 +497,7 @@ static int NO_INLINE remove_db_file(const char* filename) | |||
497 | char buf[MAX_PATH]; | 497 | char buf[MAX_PATH]; |
498 | 498 | ||
499 | snprintf(buf, sizeof(buf), "%s/%s", | 499 | snprintf(buf, sizeof(buf), "%s/%s", |
500 | global_settings.tagcache_db_path, filename); | 500 | tc_stat.db_path, filename); |
501 | 501 | ||
502 | return remove(buf); | 502 | return remove(buf); |
503 | } | 503 | } |
@@ -513,7 +513,7 @@ static int open_tag_fd(struct tagcache_header *hdr, int tag, bool write) | |||
513 | 513 | ||
514 | fd = open_pathfmt(fname, sizeof(fname), | 514 | fd = open_pathfmt(fname, sizeof(fname), |
515 | write ? O_RDWR : O_RDONLY, "%s/" TAGCACHE_FILE_INDEX, | 515 | write ? O_RDWR : O_RDONLY, "%s/" TAGCACHE_FILE_INDEX, |
516 | global_settings.tagcache_db_path, tag); | 516 | tc_stat.db_path, tag); |
517 | if (fd < 0) | 517 | if (fd < 0) |
518 | { | 518 | { |
519 | logf("tag file open failed: tag=%d write=%d file= " TAGCACHE_FILE_INDEX, | 519 | logf("tag file open failed: tag=%d write=%d file= " TAGCACHE_FILE_INDEX, |
@@ -891,7 +891,7 @@ static bool open_files(struct tagcache_search *tcs, int tag) | |||
891 | char fname[MAX_PATH]; | 891 | char fname[MAX_PATH]; |
892 | tcs->idxfd[tag] = open_pathfmt(fname, sizeof(fname), | 892 | tcs->idxfd[tag] = open_pathfmt(fname, sizeof(fname), |
893 | O_RDONLY, "%s/" TAGCACHE_FILE_INDEX, | 893 | O_RDONLY, "%s/" TAGCACHE_FILE_INDEX, |
894 | global_settings.tagcache_db_path, tag); | 894 | tc_stat.db_path, tag); |
895 | } | 895 | } |
896 | 896 | ||
897 | if (tcs->idxfd[tag] < 0) | 897 | if (tcs->idxfd[tag] < 0) |
@@ -1516,7 +1516,7 @@ static void remove_files(void) | |||
1516 | continue; | 1516 | continue; |
1517 | 1517 | ||
1518 | snprintf(buf, bufsz, "%s/" TAGCACHE_FILE_INDEX, | 1518 | snprintf(buf, bufsz, "%s/" TAGCACHE_FILE_INDEX, |
1519 | global_settings.tagcache_db_path, i); | 1519 | tc_stat.db_path, i); |
1520 | remove(buf); | 1520 | remove(buf); |
1521 | } | 1521 | } |
1522 | } | 1522 | } |
@@ -1676,7 +1676,7 @@ bool tagcache_search_add_clause(struct tagcache_search *tcs, | |||
1676 | char fname[MAX_PATH]; | 1676 | char fname[MAX_PATH]; |
1677 | tcs->idxfd[clause->tag] = open_pathfmt(fname, sizeof(fname), O_RDONLY, | 1677 | tcs->idxfd[clause->tag] = open_pathfmt(fname, sizeof(fname), O_RDONLY, |
1678 | "%s/" TAGCACHE_FILE_INDEX, | 1678 | "%s/" TAGCACHE_FILE_INDEX, |
1679 | global_settings.tagcache_db_path, clause->tag); | 1679 | tc_stat.db_path, clause->tag); |
1680 | } | 1680 | } |
1681 | } | 1681 | } |
1682 | 1682 | ||
@@ -2830,7 +2830,7 @@ static int build_index(int index_type, struct tagcache_header *h, int tmpfd) | |||
2830 | */ | 2830 | */ |
2831 | fd = open_pathfmt(buf, bufsz, O_WRONLY | O_CREAT | O_TRUNC, | 2831 | fd = open_pathfmt(buf, bufsz, O_WRONLY | O_CREAT | O_TRUNC, |
2832 | "%s/" TAGCACHE_FILE_INDEX, | 2832 | "%s/" TAGCACHE_FILE_INDEX, |
2833 | global_settings.tagcache_db_path, index_type); | 2833 | tc_stat.db_path, index_type); |
2834 | if (fd < 0) | 2834 | if (fd < 0) |
2835 | { | 2835 | { |
2836 | logf(TAGCACHE_FILE_INDEX " open fail", index_type); | 2836 | logf(TAGCACHE_FILE_INDEX " open fail", index_type); |
@@ -4487,7 +4487,7 @@ static bool check_deleted_files(void) | |||
4487 | 4487 | ||
4488 | logf("reverse scan..."); | 4488 | logf("reverse scan..."); |
4489 | fd = open_pathfmt(buf, bufsz, O_RDONLY, "%s/" TAGCACHE_FILE_INDEX, | 4489 | fd = open_pathfmt(buf, bufsz, O_RDONLY, "%s/" TAGCACHE_FILE_INDEX, |
4490 | global_settings.tagcache_db_path, tag_filename); | 4490 | tc_stat.db_path, tag_filename); |
4491 | if (fd < 0) | 4491 | if (fd < 0) |
4492 | { | 4492 | { |
4493 | logf(TAGCACHE_FILE_INDEX " open fail", tag_filename); | 4493 | logf(TAGCACHE_FILE_INDEX " open fail", tag_filename); |
@@ -5126,6 +5126,8 @@ void tagcache_init(void) | |||
5126 | write_lock = read_lock = 0; | 5126 | write_lock = read_lock = 0; |
5127 | 5127 | ||
5128 | #ifndef __PCTOOL__ | 5128 | #ifndef __PCTOOL__ |
5129 | strmemccpy(tc_stat.db_path, global_settings.tagcache_db_path, | ||
5130 | sizeof(tc_stat.db_path)); | ||
5129 | mutex_init(&command_queue_mutex); | 5131 | mutex_init(&command_queue_mutex); |
5130 | queue_init(&tagcache_queue, true); | 5132 | queue_init(&tagcache_queue, true); |
5131 | create_thread(tagcache_thread, tagcache_stack, | 5133 | create_thread(tagcache_thread, tagcache_stack, |
@@ -5133,6 +5135,8 @@ void tagcache_init(void) | |||
5133 | IF_PRIO(, PRIORITY_BACKGROUND) | 5135 | IF_PRIO(, PRIORITY_BACKGROUND) |
5134 | IF_COP(, CPU)); | 5136 | IF_COP(, CPU)); |
5135 | #else | 5137 | #else |
5138 | /* use default DB path */ | ||
5139 | strcpy(tc_stat.db_path, ROCKBOX_DIR); | ||
5136 | tc_stat.initialized = true; | 5140 | tc_stat.initialized = true; |
5137 | allocate_tempbuf(); | 5141 | allocate_tempbuf(); |
5138 | commit(); | 5142 | commit(); |