diff options
author | Miika Pekkarinen <miipekk@ihme.org> | 2008-03-11 19:39:26 +0000 |
---|---|---|
committer | Miika Pekkarinen <miipekk@ihme.org> | 2008-03-11 19:39:26 +0000 |
commit | 52d827a26dec8bc4967cf3c2984a10ace114fa21 (patch) | |
tree | 83b9660b904934a62df38ee0ed138c66f3cdebb1 /firmware/common/dir_uncached.c | |
parent | afde7f74d4325c3a5a6883167c1f74f4fb689f90 (diff) |
FS#7598 - Dircache support for multivolume targets (by Phil Light).
git-svn-id: svn://svn.rockbox.org/rockbox/trunk@16632 a1c6a512-1295-4272-9138-f99709370657
Diffstat (limited to 'firmware/common/dir_uncached.c')
-rw-r--r-- | firmware/common/dir_uncached.c | 20 |
1 files changed, 3 insertions, 17 deletions
diff --git a/firmware/common/dir_uncached.c b/firmware/common/dir_uncached.c index e6b59c30ec..129ef35603 100644 --- a/firmware/common/dir_uncached.c +++ b/firmware/common/dir_uncached.c @@ -24,7 +24,6 @@ #include "dir.h" #include "debug.h" #include "atoi.h" -//#include "dircache.h" #define MAX_OPEN_DIRS 8 @@ -32,22 +31,9 @@ static DIR_UNCACHED opendirs[MAX_OPEN_DIRS]; #ifdef HAVE_MULTIVOLUME -/* how to name volumes, first char must be outside of legal file names, - a number gets appended to enumerate, if applicable */ -#ifdef HAVE_MMC -static const char* vol_names = "<MMC%d>"; -#define VOL_ENUM_POS 4 /* position of %d, to avoid runtime calculation */ -#elif defined(HAVE_HOTSWAP) -static const char* vol_names = "<microSD%d>"; -#define VOL_ENUM_POS 8 /* position of %d, to avoid runtime calculation */ -#else -static const char* vol_names = "<HD%d>"; -#define VOL_ENUM_POS 3 -#endif - /* returns on which volume this is, and copies the reduced name (sortof a preprocessor for volume-decorated pathnames) */ -static int strip_volume(const char* name, char* namecopy) +int strip_volume(const char* name, char* namecopy) { int volume = 0; const char *temp = name; @@ -55,7 +41,7 @@ static int strip_volume(const char* name, char* namecopy) while (*temp == '/') /* skip all leading slashes */ ++temp; - if (*temp && !strncmp(temp, vol_names, VOL_ENUM_POS)) + if (*temp && !strncmp(temp, VOL_NAMES, VOL_ENUM_POS)) { temp += VOL_ENUM_POS; /* behind special name */ volume = atoi(temp); /* number is following */ @@ -199,7 +185,7 @@ struct dirent_uncached* readdir_uncached(DIR_UNCACHED* dir) memset(theent, 0, sizeof(*theent)); theent->attribute = FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME; snprintf(theent->d_name, sizeof(theent->d_name), - vol_names, dir->volumecounter); + VOL_NAMES, dir->volumecounter); return theent; } } |