forked from len0rd/rockbox
Database: Bug fix: The filename seek index is invalid if FLAG_DIRCACHE
is set on a database entry and the dircache went offline. In this case, retrieve() and get_next() need to abort and take the ramcache offline as well. git-svn-id: svn://svn.rockbox.org/rockbox/trunk@30255 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
parent
fa81cdc61a
commit
c027dc20be
1 changed files with 36 additions and 11 deletions
|
@ -721,14 +721,26 @@ static bool retrieve(struct tagcache_search *tcs, struct index_entry *idx,
|
||||||
struct tagfile_entry *ep;
|
struct tagfile_entry *ep;
|
||||||
|
|
||||||
# ifdef HAVE_DIRCACHE
|
# ifdef HAVE_DIRCACHE
|
||||||
if (tag == tag_filename && (idx->flag & FLAG_DIRCACHE)
|
if (tag == tag_filename && (idx->flag & FLAG_DIRCACHE))
|
||||||
&& is_dircache_intact())
|
|
||||||
{
|
{
|
||||||
/* for tag_filename, seek is a dircache index */
|
/* for tag_filename, seek is a dircache index */
|
||||||
|
if (is_dircache_intact())
|
||||||
|
{
|
||||||
dircache_copy_path(seek, buf, size);
|
dircache_copy_path(seek, buf, size);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* The seek is useless now, there's nothing we can return. */
|
||||||
|
logf("retrieve: dircache gone, cannot read file name");
|
||||||
|
tagcache_unload_ramcache();
|
||||||
|
// XXX do this when there's a way to not trigger an
|
||||||
|
// update before reloading:
|
||||||
|
// tagcache_start_scan();
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
# endif
|
# endif
|
||||||
if (tag != tag_filename)
|
if (tag != tag_filename)
|
||||||
{
|
{
|
||||||
|
@ -1496,8 +1508,9 @@ static bool get_next(struct tagcache_search *tcs)
|
||||||
{
|
{
|
||||||
|
|
||||||
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
#if defined(HAVE_TC_RAMCACHE) && defined(HAVE_DIRCACHE)
|
||||||
if (tcs->type == tag_filename && (flag & FLAG_DIRCACHE)
|
if (tcs->type == tag_filename && (flag & FLAG_DIRCACHE))
|
||||||
&& is_dircache_intact())
|
{
|
||||||
|
if (is_dircache_intact())
|
||||||
{
|
{
|
||||||
size_t len = dircache_copy_path(tcs->position, buf, sizeof buf);
|
size_t len = dircache_copy_path(tcs->position, buf, sizeof buf);
|
||||||
tcs->result_len = len + 1;
|
tcs->result_len = len + 1;
|
||||||
|
@ -1507,6 +1520,18 @@ static bool get_next(struct tagcache_search *tcs)
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
|
/* The seek is useless now, there's nothing we can return. */
|
||||||
|
logf("get_next: dircache gone, cannot read file name");
|
||||||
|
tagcache_unload_ramcache();
|
||||||
|
// XXX do this when there's a way to not trigger an
|
||||||
|
// update before reloading:
|
||||||
|
// tagcache_start_scan();
|
||||||
|
tcs->valid = false;
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
#endif
|
#endif
|
||||||
if (tcs->type != tag_filename)
|
if (tcs->type != tag_filename)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue