diff options
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 @@ | |||
24 | #include "dir.h" | 24 | #include "dir.h" |
25 | #include "debug.h" | 25 | #include "debug.h" |
26 | #include "atoi.h" | 26 | #include "atoi.h" |
27 | //#include "dircache.h" | ||
28 | 27 | ||
29 | #define MAX_OPEN_DIRS 8 | 28 | #define MAX_OPEN_DIRS 8 |
30 | 29 | ||
@@ -32,22 +31,9 @@ static DIR_UNCACHED opendirs[MAX_OPEN_DIRS]; | |||
32 | 31 | ||
33 | #ifdef HAVE_MULTIVOLUME | 32 | #ifdef HAVE_MULTIVOLUME |
34 | 33 | ||
35 | /* how to name volumes, first char must be outside of legal file names, | ||
36 | a number gets appended to enumerate, if applicable */ | ||
37 | #ifdef HAVE_MMC | ||
38 | static const char* vol_names = "<MMC%d>"; | ||
39 | #define VOL_ENUM_POS 4 /* position of %d, to avoid runtime calculation */ | ||
40 | #elif defined(HAVE_HOTSWAP) | ||
41 | static const char* vol_names = "<microSD%d>"; | ||
42 | #define VOL_ENUM_POS 8 /* position of %d, to avoid runtime calculation */ | ||
43 | #else | ||
44 | static const char* vol_names = "<HD%d>"; | ||
45 | #define VOL_ENUM_POS 3 | ||
46 | #endif | ||
47 | |||
48 | /* returns on which volume this is, and copies the reduced name | 34 | /* returns on which volume this is, and copies the reduced name |
49 | (sortof a preprocessor for volume-decorated pathnames) */ | 35 | (sortof a preprocessor for volume-decorated pathnames) */ |
50 | static int strip_volume(const char* name, char* namecopy) | 36 | int strip_volume(const char* name, char* namecopy) |
51 | { | 37 | { |
52 | int volume = 0; | 38 | int volume = 0; |
53 | const char *temp = name; | 39 | const char *temp = name; |
@@ -55,7 +41,7 @@ static int strip_volume(const char* name, char* namecopy) | |||
55 | while (*temp == '/') /* skip all leading slashes */ | 41 | while (*temp == '/') /* skip all leading slashes */ |
56 | ++temp; | 42 | ++temp; |
57 | 43 | ||
58 | if (*temp && !strncmp(temp, vol_names, VOL_ENUM_POS)) | 44 | if (*temp && !strncmp(temp, VOL_NAMES, VOL_ENUM_POS)) |
59 | { | 45 | { |
60 | temp += VOL_ENUM_POS; /* behind special name */ | 46 | temp += VOL_ENUM_POS; /* behind special name */ |
61 | volume = atoi(temp); /* number is following */ | 47 | volume = atoi(temp); /* number is following */ |
@@ -199,7 +185,7 @@ struct dirent_uncached* readdir_uncached(DIR_UNCACHED* dir) | |||
199 | memset(theent, 0, sizeof(*theent)); | 185 | memset(theent, 0, sizeof(*theent)); |
200 | theent->attribute = FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME; | 186 | theent->attribute = FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME; |
201 | snprintf(theent->d_name, sizeof(theent->d_name), | 187 | snprintf(theent->d_name, sizeof(theent->d_name), |
202 | vol_names, dir->volumecounter); | 188 | VOL_NAMES, dir->volumecounter); |
203 | return theent; | 189 | return theent; |
204 | } | 190 | } |
205 | } | 191 | } |