From 52d827a26dec8bc4967cf3c2984a10ace114fa21 Mon Sep 17 00:00:00 2001 From: Miika Pekkarinen Date: Tue, 11 Mar 2008 19:39:26 +0000 Subject: 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 --- firmware/common/dir_uncached.c | 20 +++----------------- 1 file changed, 3 insertions(+), 17 deletions(-) (limited to 'firmware/common/dir_uncached.c') 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 = ""; -#define VOL_ENUM_POS 4 /* position of %d, to avoid runtime calculation */ -#elif defined(HAVE_HOTSWAP) -static const char* vol_names = ""; -#define VOL_ENUM_POS 8 /* position of %d, to avoid runtime calculation */ -#else -static const char* vol_names = ""; -#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; } } -- cgit v1.2.3