diff options
author | Amaury Pouly <pamaury@rockbox.org> | 2010-03-10 08:56:27 +0000 |
---|---|---|
committer | Amaury Pouly <pamaury@rockbox.org> | 2010-03-10 08:56:27 +0000 |
commit | 56069476be65da87604d7b006aee7008445b965f (patch) | |
tree | 94804f1423d229b3370fb4c72d6585c601e875e2 | |
parent | 0be28e819face17564a75a11745c29d33317fcb0 (diff) | |
download | rockbox-56069476be65da87604d7b006aee7008445b965f.tar.gz rockbox-56069476be65da87604d7b006aee7008445b965f.zip |
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
-rw-r--r-- | firmware/common/dir_uncached.c | 9 | ||||
-rw-r--r-- | firmware/include/dir_uncached.h | 1 |
2 files changed, 7 insertions, 3 deletions
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c index 2052503c43..c6f3a6f2e1 100644 --- a/firmware/common/dir_uncached.c +++ b/firmware/common/dir_uncached.c | |||
@@ -114,11 +114,16 @@ DIR_UNCACHED* opendir_uncached(const char* name) | |||
114 | } | 114 | } |
115 | if ( (entry.attr & FAT_ATTR_DIRECTORY) && | 115 | if ( (entry.attr & FAT_ATTR_DIRECTORY) && |
116 | (!strcasecmp(part, entry.name)) ) { | 116 | (!strcasecmp(part, entry.name)) ) { |
117 | pdir->parent_dir = pdir->fatdir; | 117 | /* in reality, the parent_dir parameter of fat_opendir is |
118 | * useless because it's sole purpose it to have a way to | ||
119 | * update the file metadata, but here we are only reading | ||
120 | * a directory so there's no need for that kind of stuff. | ||
121 | * Consequently, we can safely pass NULL of it because | ||
122 | * fat_opendir and fat_open are NULL-protected. */ | ||
118 | if ( fat_opendir(IF_MV2(volume,) | 123 | if ( fat_opendir(IF_MV2(volume,) |
119 | &pdir->fatdir, | 124 | &pdir->fatdir, |
120 | entry.firstcluster, | 125 | entry.firstcluster, |
121 | &pdir->parent_dir) < 0 ) { | 126 | NULL) < 0 ) { |
122 | DEBUGF("Failed opening dir '%s' (%ld)\n", | 127 | DEBUGF("Failed opening dir '%s' (%ld)\n", |
123 | part, entry.firstcluster); | 128 | part, entry.firstcluster); |
124 | pdir->busy = false; | 129 | pdir->busy = false; |
diff --git a/firmware/include/dir_uncached.h b/firmware/include/dir_uncached.h index e198833c84..4e5acf34d1 100644 --- a/firmware/include/dir_uncached.h +++ b/firmware/include/dir_uncached.h | |||
@@ -61,7 +61,6 @@ typedef struct { | |||
61 | bool busy; | 61 | bool busy; |
62 | long startcluster; | 62 | long startcluster; |
63 | struct fat_dir fatdir; | 63 | struct fat_dir fatdir; |
64 | struct fat_dir parent_dir; | ||
65 | struct dirent_uncached theent; | 64 | struct dirent_uncached theent; |
66 | #ifdef HAVE_MULTIVOLUME | 65 | #ifdef HAVE_MULTIVOLUME |
67 | int volumecounter; /* running counter for faked volume entries */ | 66 | int volumecounter; /* running counter for faked volume entries */ |