mirror of
https://github.com/Rockbox/rockbox.git
synced 2025-10-14 02:27:39 -04:00
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
This commit is contained in:
parent
7d8c02d105
commit
b8ad90aba8
1 changed files with 7 additions and 16 deletions
|
@ -155,7 +155,9 @@ static bool check_event_queue(void)
|
||||||
{
|
{
|
||||||
struct queue_event ev;
|
struct queue_event ev;
|
||||||
|
|
||||||
queue_wait_w_tmo(&dircache_queue, &ev, 0);
|
if(!queue_peek(&dircache_queue, &ev))
|
||||||
|
return false;
|
||||||
|
|
||||||
switch (ev.id)
|
switch (ev.id)
|
||||||
{
|
{
|
||||||
case DIRCACHE_STOP:
|
case DIRCACHE_STOP:
|
||||||
|
@ -163,8 +165,6 @@ static bool check_event_queue(void)
|
||||||
#ifdef HAVE_HOTSWAP
|
#ifdef HAVE_HOTSWAP
|
||||||
case SYS_FS_CHANGED:
|
case SYS_FS_CHANGED:
|
||||||
#endif
|
#endif
|
||||||
/* Put the event back into the queue. */
|
|
||||||
queue_post(&dircache_queue, ev.id, ev.data);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1092,6 +1092,7 @@ void dircache_mkdir(const char *path)
|
||||||
if (block_until_ready())
|
if (block_until_ready())
|
||||||
return ;
|
return ;
|
||||||
|
|
||||||
|
|
||||||
logf("mkdir: %s", path);
|
logf("mkdir: %s", path);
|
||||||
dircache_new_entry(path, ATTR_DIRECTORY);
|
dircache_new_entry(path, ATTR_DIRECTORY);
|
||||||
}
|
}
|
||||||
|
@ -1211,17 +1212,9 @@ void dircache_add_file(const char *path, long startcluster)
|
||||||
entry->startcluster = startcluster;
|
entry->startcluster = startcluster;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Check if dircache state is still valid. With hotswap, on fs changed,
|
static bool is_disable_msg_pending(void)
|
||||||
* the dircache became invalid but functions could be called before the
|
|
||||||
* dircache thread processes the message */
|
|
||||||
static void check_dircache_state(void)
|
|
||||||
{
|
{
|
||||||
if(check_event_queue())
|
return check_event_queue();
|
||||||
{
|
|
||||||
/* Keep this coherent with check_event_queue(). Currently, all the
|
|
||||||
* messages that return true will lead to disable. */
|
|
||||||
dircache_initialized = false;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
DIR_CACHED* opendir_cached(const char* name)
|
DIR_CACHED* opendir_cached(const char* name)
|
||||||
|
@ -1248,10 +1241,8 @@ DIR_CACHED* opendir_cached(const char* name)
|
||||||
}
|
}
|
||||||
|
|
||||||
pdir->busy = true;
|
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->internal_entry = NULL;
|
||||||
pdir->regulardir = opendir_uncached(name);
|
pdir->regulardir = opendir_uncached(name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue