Rockbox

Tasklist

FS#7598 - Dircache support for multivolume targets.

Attached to Project: Rockbox
Opened by Phil Light (phillight) - Monday, 13 August 2007, 21:57 GMT
Last edited by Miika Pekkarinen (miipekk) - Tuesday, 11 March 2008, 19:39 GMT
Task Type Patches
Category Operating System/Drivers
Status Closed
Assigned To No-one
Operating System All players
Severity Low
Priority Normal
Reported Version Daily build (which?)
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 1
Private No

Details

This patch add support for dircache on targets with multivolume support. Additional volumes are appended to the root directory of the cache with filenames such as <microSD1> in the same way as for the uncached multivolume support.

At the moment I think this only affects the e200 as the only multivolume target with sufficient RAM for dircache to be enabled(?)

For targets with hotswap, the cache is rebuilt on insertion/removal of the card.
This task depends upon

Closed by  Miika Pekkarinen (miipekk)
Tuesday, 11 March 2008, 19:39 GMT
Reason for closing:  Accepted
Comment by Phil Light (phillight) - Tuesday, 14 August 2007, 20:41 GMT
Fix e200 sim build & reset entry count on cache rebuild.
Comment by Phil Light (phillight) - Wednesday, 15 August 2007, 21:38 GMT
Fixes hang that occured when swapping cards with dircache disabled.
Comment by Anonymous Submitter - Saturday, 08 September 2007, 14:28 GMT
Sync'd to todays SVN, was out of sync because of the c200 port.
Comment by Anonymous Submitter - Saturday, 08 September 2007, 14:30 GMT
Oops wrong file...
Comment by Phil Light (phillight) - Sunday, 11 November 2007, 13:20 GMT
Sync
Comment by Thomas Martitz (kugel.) - Friday, 21 December 2007, 20:11 GMT
We need a code clean up in order to get this committed, Slasheri said. Like "so that vol_names etc. aren't defined multiple times".
Comment by Michael Hahn (disorganizer) - Saturday, 26 January 2008, 00:22 GMT
could somone sync to the svn? i get hunk errors when applying the patch
Comment by Charles Philip Chan (cpchan) - Saturday, 26 January 2008, 01:22 GMT
Synced
Comment by Phil Light (phillight) - Saturday, 26 January 2008, 18:41 GMT
Code clean up: no longer uses multiple definitions of vol_names and strip_volume.

This version also no longer increases the dircache stack size, as this should be unnecessary.
Comment by Miika Pekkarinen (miipekk) - Wednesday, 30 January 2008, 18:33 GMT
Thanks for the patch, it looks quite good now. But I still found one memory allocation issue to be solved. Now there is the following code:

...
memset(ce, 0, sizeof(struct dircache_entry));

#if defined(HAVE_MULTIVOLUME) && !defined(SIMULATOR)
if (volume > 0)
{
snprintf(ce->d_name, VOL_ENUM_POS + 3, VOL_NAMES, volume);
ce->name_len = VOL_ENUM_POS + 3;
...

You are trying to write to a memory location that is just a null pointer reference (ce->d_name). You have to allocate ce->d_name first before using it. And the second parameter "size" for snprintf (i.e., VOL_ENUM_POS+3) should be the maximum allocated size of the buffer (ce->d_name) to prevent buffer overflows, not the length of the data to be written.

But I will look again once that problem is solved, no time now to fix it:/
Comment by Phil Light (phillight) - Wednesday, 30 January 2008, 22:57 GMT
Okay, I *think* that this allocates memory correctly. I still use VOL_ENUM_POS+3 for the max size as this is now the allocated size of the buffer.

I've also fixed compilation for non-multivolume targets.
Comment by Phil Light (phillight) - Monday, 10 March 2008, 23:41 GMT
This version removes some duplication of code that was in the previous patch by better use of ifdefs.

Loading...