1
0
Fork 0
forked from len0rd/rockbox

Get rid of the parent_dir field in dir_uncached.c by using the same FAT trick as in dircache. This should save ~20KB on 512B/sector targets and ~80KB on 2K/sector ones.

git-svn-id: svn://svn.rockbox.org/rockbox/trunk@25105 a1c6a512-1295-4272-9138-f99709370657
This commit is contained in:
Amaury Pouly 2010-03-10 08:56:27 +00:00
parent 0be28e819f
commit 56069476be
2 changed files with 7 additions and 3 deletions

View file

@ -114,11 +114,16 @@ DIR_UNCACHED* opendir_uncached(const char* name)
} }
if ( (entry.attr & FAT_ATTR_DIRECTORY) && if ( (entry.attr & FAT_ATTR_DIRECTORY) &&
(!strcasecmp(part, entry.name)) ) { (!strcasecmp(part, entry.name)) ) {
pdir->parent_dir = pdir->fatdir; /* in reality, the parent_dir parameter of fat_opendir is
* useless because it's sole purpose it to have a way to
* update the file metadata, but here we are only reading
* a directory so there's no need for that kind of stuff.
* Consequently, we can safely pass NULL of it because
* fat_opendir and fat_open are NULL-protected. */
if ( fat_opendir(IF_MV2(volume,) if ( fat_opendir(IF_MV2(volume,)
&pdir->fatdir, &pdir->fatdir,
entry.firstcluster, entry.firstcluster,
&pdir->parent_dir) < 0 ) { NULL) < 0 ) {
DEBUGF("Failed opening dir '%s' (%ld)\n", DEBUGF("Failed opening dir '%s' (%ld)\n",
part, entry.firstcluster); part, entry.firstcluster);
pdir->busy = false; pdir->busy = false;

View file

@ -61,7 +61,6 @@ typedef struct {
bool busy; bool busy;
long startcluster; long startcluster;
struct fat_dir fatdir; struct fat_dir fatdir;
struct fat_dir parent_dir;
struct dirent_uncached theent; struct dirent_uncached theent;
#ifdef HAVE_MULTIVOLUME #ifdef HAVE_MULTIVOLUME
int volumecounter; /* running counter for faked volume entries */ int volumecounter; /* running counter for faked volume entries */