Rockbox

  • Status Closed
  • Percent Complete
    100%
  • Task Type Patches
  • Category Operating System/Drivers
  • Assigned To No-one
  • Operating System All players
  • Severity Low
  • Priority Very Low
  • Reported Version Daily build (which?)
  • Due in Version Undecided
  • Due Date Undecided
  • Votes 1
  • Private
Attached to Project: Rockbox
Opened by phillight - 2007-08-13
Last edited by miipekk - 2008-03-11

FS#7598 - Dircache support for multivolume targets.

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.

Closed by  miipekk
2008-03-11 19:39
Reason for closing:  Accepted

Fix e200 sim build & reset entry count on cache rebuild.

Fixes hang that occured when swapping cards with dircache disabled.

Anonymous Submitter commented on 2007-09-08 14:28

Sync’d to todays SVN, was out of sync because of the c200 port.

Anonymous Submitter commented on 2007-09-08 14:30

Oops wrong file…

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”.

could somone sync to the svn? i get hunk errors when applying the patch

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.

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:/

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.

This version removes some duplication of code that was in the previous patch by better use of ifdefs.

Loading...

Available keyboard shortcuts

Tasklist

Task Details

Task Editing