diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2010-05-21 12:50:50 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2010-05-21 12:50:50 +0000 |
commit | b8ad90aba84ab3cc75cb2405b2e455c526f61c38 (patch) | |
tree | 35a5a2851a4b182685caebb63c7dc5334cd63971 /firmware/common/dircache.c | |
parent | 7d8c02d1059f74eb88d175509fd95b34d0c9b0dd (diff) | |
download | rockbox-b8ad90aba84ab3cc75cb2405b2e455c526f61c38.tar.gz rockbox-b8ad90aba84ab3cc75cb2405b2e455c526f61c38.zip |
dircache:
- fix check_event_queue to use queue_peek and not mess message order
- change check_dircache_state to a more modest check to avoid messing up dircache state
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@26228 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/dircache.c')
-rw-r--r-- | firmware/common/dircache.c | 23 |
1 files changed, 7 insertions, 16 deletions
diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index 4a033f5f83..f8365e1137 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -155,7 +155,9 @@ static bool check_event_queue(void) { struct queue_event ev; - queue_wait_w_tmo(&dircache_queue, &ev, 0); + if(!queue_peek(&dircache_queue, &ev)) + return false; + switch (ev.id) { case DIRCACHE_STOP: @@ -163,8 +165,6 @@ static bool check_event_queue(void) #ifdef HAVE_HOTSWAP case SYS_FS_CHANGED: #endif - /* Put the event back into the queue. */ - queue_post(&dircache_queue, ev.id, ev.data); return true; } @@ -1092,6 +1092,7 @@ void dircache_mkdir(const char *path) if (block_until_ready()) return ; + logf("mkdir: %s", path); dircache_new_entry(path, ATTR_DIRECTORY); } @@ -1211,17 +1212,9 @@ void dircache_add_file(const char *path, long startcluster) entry->startcluster = startcluster; } -/* Check if dircache state is still valid. With hotswap, on fs changed, - * the dircache became invalid but functions could be called before the - * dircache thread processes the message */ -static void check_dircache_state(void) +static bool is_disable_msg_pending(void) { - if(check_event_queue()) - { - /* Keep this coherent with check_event_queue(). Currently, all the - * messages that return true will lead to disable. */ - dircache_initialized = false; - } + return check_event_queue(); } DIR_CACHED* opendir_cached(const char* name) @@ -1248,10 +1241,8 @@ DIR_CACHED* opendir_cached(const char* name) } pdir->busy = true; - /* check real dircache state */ - check_dircache_state(); - if (!dircache_initialized) + if (!dircache_initialized || is_disable_msg_pending()) { pdir->internal_entry = NULL; pdir->regulardir = opendir_uncached(name); |