diff options
| author | Miika Pekkarinen <miipekk@ihme.org> | 2005-10-08 18:41:11 +0000 |
|---|---|---|
| committer | Miika Pekkarinen <miipekk@ihme.org> | 2005-10-08 18:41:11 +0000 |
| commit | b76e8c09fa4f273738fb5f56d75a9dd1344ec51b (patch) | |
| tree | f4450f698fcc9e4500094869bdae2d1291862b13 | |
| parent | 1a4083d8289b12577d83da3e6a310335bc9be014 (diff) | |
| download | rockbox-b76e8c09fa4f273738fb5f56d75a9dd1344ec51b.zip rockbox-b76e8c09fa4f273738fb5f56d75a9dd1344ec51b.tar.gz rockbox-b76e8c09fa4f273738fb5f56d75a9dd1344ec51b.tar.bz2 rockbox-b76e8c09fa4f273738fb5f56d75a9dd1344ec51b.tar.xz | |
Fixed a problem with dircache where filetree modified dircache
structures directly. Moved #ifdef directly to SOURCES instead of
dircache.c to decide whether to compile the cache or not.
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@7599 a1c6a512-1295-4272-9138-f99709370657
| -rw-r--r-- | firmware/SOURCES | 2 | ||||
| -rw-r--r-- | firmware/common/dircache.c | 16 | ||||
| -rw-r--r-- | firmware/export/config.h | 2 |
3 files changed, 14 insertions, 6 deletions
diff --git a/firmware/SOURCES b/firmware/SOURCES index febc794..bee9fd5 100644 --- a/firmware/SOURCES +++ b/firmware/SOURCES @@ -11,7 +11,9 @@ common/ctype.c common/dir.c common/file.c #endif +#ifdef HAVE_DIRCACHE common/dircache.c +#endif common/disk.c common/errno.c common/memcmp.c diff --git a/firmware/common/dircache.c b/firmware/common/dircache.c index a777ea9..4cd01ec 100644 --- a/firmware/common/dircache.c +++ b/firmware/common/dircache.c @@ -24,8 +24,6 @@ #include "config.h" -#ifdef HAVE_DIRCACHE - #include <stdio.h> #include <errno.h> #include <string.h> @@ -775,8 +773,18 @@ struct dircache_entry* readdir_cached(DIRCACHED* dir) dir->entry = ce->next; + strncpy(dir->secondary_entry.d_name, ce->d_name, MAX_PATH-1); + /* Can't do `dir->secondary_entry = *ce` + because that modifies the d_name pointer. */ + dir->secondary_entry.size = ce->size; + dir->secondary_entry.startcluster = ce->startcluster; + dir->secondary_entry.attribute = ce->attribute; + dir->secondary_entry.wrttime = ce->wrttime; + dir->secondary_entry.wrtdate = ce->wrtdate; + dir->secondary_entry.next = NULL; + //logf("-> %s", ce->name); - return ce; + return &dir->secondary_entry; } int closedir_cached(DIRCACHED* dir) @@ -788,5 +796,3 @@ int closedir_cached(DIRCACHED* dir) return 0; } -#endif /* HAVE_DIRCACHE */ - diff --git a/firmware/export/config.h b/firmware/export/config.h index f009419..966f47c 100644 --- a/firmware/export/config.h +++ b/firmware/export/config.h @@ -120,7 +120,7 @@ /* Enable the directory cache if we have plenty of RAM. */ /* Cache is just temporarily disabled for simulator build. * Do the small fix in dircache.c to enable this. */ -#if MEM > 8 && !defined(BOOTLOADER) && !defined(SIMULATOR) +#if (MEMORYSIZE > 8 || MEM > 8) && !defined(BOOTLOADER) && !defined(SIMULATOR) #define HAVE_DIRCACHE 1 #endif |