Index: apps/misc.h =================================================================== --- apps/misc.h (revision 17660) +++ apps/misc.h (working copy) @@ -122,6 +122,11 @@ bool file_exists(const char *file); bool dir_exists(const char *path); +#ifdef HAVE_VOLUMELABEL +/* check, if the file belongs to a mounted volume */ +bool mounted_volume(const char *file); +#endif + /* * removes the extension of filename (if it doesn't start with a .) * puts the result in buffer Index: apps/misc.c =================================================================== --- apps/misc.c (revision 17660) +++ apps/misc.c (working copy) @@ -1143,6 +1143,25 @@ return true; } +#ifdef HAVE_VOLUMELABEL +bool mounted_volume(const char *file) +{ + if (file[0] != '<') + return true; + else + { + char dir[15]; + char* pos; + strncpy(dir,file,sizeof(dir)); + pos = strchr(dir, '>'); + if ( pos == NULL || pos > &dir[sizeof(dir)] ) + return false; + *(pos+1) = 0; + return file_exists(dir); + } +} +#endif + /* * removes the extension of filename (if it doesn't start with a .) * puts the result in buffer Index: apps/playlist.c =================================================================== --- apps/playlist.c (revision 17660) +++ apps/playlist.c (working copy) @@ -2871,6 +2871,10 @@ { int result; +#ifdef HAVE_VOLUMELABEL + if (!file_exists(filename)) + return -1; +#endif if (!playlist) playlist = ¤t_playlist; Index: apps/tagcache.c =================================================================== --- apps/tagcache.c (revision 17660) +++ apps/tagcache.c (working copy) @@ -4047,7 +4047,11 @@ continue; /* Now check if the file exists. */ - if (!file_exists(buf)) + if (!file_exists(buf) +#ifdef HAVE_VOLUMELABEL + && mounted_volume(buf) +#endif + ) { logf("Entry no longer valid."); logf("-> %s / %d", buf, tfe.tag_length); Index: firmware/export/config-e200.h =================================================================== --- firmware/export/config-e200.h (revision 17660) +++ firmware/export/config-e200.h (working copy) @@ -156,6 +156,8 @@ #ifndef BOOTLOADER #define HAVE_MULTIVOLUME #define HAVE_HOTSWAP +/* define if you want to have mountpoint names derived from volume labels */ +#define HAVE_VOLUMELABEL #endif /* #define USB_IPODSTYLE */ Index: firmware/export/fat.h =================================================================== --- firmware/export/fat.h (revision 17660) +++ firmware/export/fat.h (working copy) @@ -122,4 +122,9 @@ extern unsigned int fat_get_cluster_size(IF_MV_NONVOID(int volume)); /* public for debug info screen */ extern bool fat_ismounted(int volume); +#ifdef HAVE_VOLUMELABEL +extern char* fat_vol_name(int volume); +extern int fat_vol_name_sz(int volume); #endif + +#endif Index: firmware/common/dircache.c =================================================================== --- firmware/common/dircache.c (revision 17660) +++ firmware/common/dircache.c (working copy) @@ -294,8 +294,14 @@ if (volume > 0) { ce->d_name = ((char *)dircache_root+dircache_size); +#ifdef HAVE_VOLUMELABEL + strncpy(ce->d_name, fat_vol_name(volume), + sizeof(ce->d_name)); + ce->name_len = fat_vol_name_sz(volume); +#else snprintf(ce->d_name, VOL_ENUM_POS + 3, VOL_NAMES, volume); ce->name_len = VOL_ENUM_POS + 3; +#endif dircache_size += ce->name_len; ce->attribute = FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME; ce->size = 0; Index: firmware/common/dir_uncached.c =================================================================== --- firmware/common/dir_uncached.c (revision 17660) +++ firmware/common/dir_uncached.c (working copy) @@ -40,7 +40,27 @@ while (*temp == '/') /* skip all leading slashes */ ++temp; - + +#ifdef HAVE_VOLUMELABEL + if ( *temp ) + { + int i; + for ( i=1; iattribute = FAT_ATTR_DIRECTORY | FAT_ATTR_VOLUME; +#ifdef HAVE_VOLUMELABEL + strncpy(theent->d_name, fat_vol_name(dir->volumecounter), + sizeof(theent->d_name)); +#else snprintf(theent->d_name, sizeof(theent->d_name), VOL_NAMES, dir->volumecounter); +#endif return theent; } } Index: firmware/drivers/fat.c =================================================================== --- firmware/drivers/fat.c (revision 17660) +++ firmware/drivers/fat.c (working copy) @@ -23,6 +23,7 @@ #include #include "fat.h" #include "ata.h" +#include "dir.h" #include "debug.h" #include "panic.h" #include "system.h" @@ -167,7 +168,11 @@ #ifdef HAVE_MULTIVOLUME int drive; /* on which physical device is this located */ bool mounted; /* flag if this volume is mounted */ +#ifdef HAVE_VOLUMELABEL + char mountpt[14]; /* mount point */ + int mountpt_sz; /* length of mount point name */ #endif +#endif }; static struct bpb fat_bpbs[NUM_VOLUMES]; /* mounted partition info */ @@ -279,6 +284,10 @@ for (i=0; ibpb_rootclus = 0 - dirclusters; /* backwards, before the data*/ fat_bpb->rootdiroffset = dirclusters * fat_bpb->bpb_secperclus - rootdirsectors; +#ifdef HAVE_VOLUMELABEL + snprintf(fat_bpb->mountpt, sizeof(fat_bpb->mountpt)-2, + "%s", buf + BS_VOLLAB); +#endif } else #endif /* #ifdef HAVE_FAT16SUPPORT */ @@ -401,6 +414,10 @@ fat_bpb->bpb_fsinfo = secmult * BYTES2INT16(buf,BPB_FSINFO); fat_bpb->rootdirsector = cluster2sec(IF_MV2(fat_bpb,) fat_bpb->bpb_rootclus); +#ifdef HAVE_VOLUMELABEL + snprintf(fat_bpb->mountpt, sizeof(fat_bpb->mountpt)-2, + "%s", buf + BS_32_VOLLAB); +#endif } rc = bpb_is_sane(IF_MV(fat_bpb)); @@ -445,7 +462,32 @@ #ifdef HAVE_MULTIVOLUME fat_bpb->mounted = true; +#ifdef HAVE_VOLUMELABEL +/* default if no volume label is found */ +/* should be refined, when there are several equal labels, + and/or we have a flag for using volume labels as mount points */ + if ( fat_bpb->mountpt[0] == 0 ) + { + snprintf(fat_bpb->mountpt,sizeof(fat_bpb->mountpt),VOL_NAMES,volume); + fat_bpb->mountpt_sz = strlen(fat_bpb->mountpt); + } + else + { + /* trim trailing blanks and add '<' and '>'*/ + char* c = fat_bpb->mountpt + strlen(fat_bpb->mountpt); + while ( (*c == 0 || *c == ' ') && c > fat_bpb->mountpt) + { + *c = 0; + c--; + } + memmove(fat_bpb->mountpt+1, fat_bpb->mountpt, + strlen(fat_bpb->mountpt)); + fat_bpb->mountpt[0] = '<'; + fat_bpb->mountpt[strlen(fat_bpb->mountpt)] = '>'; + fat_bpb->mountpt_sz = strlen(fat_bpb->mountpt); + } #endif +#endif return 0; } @@ -477,6 +519,10 @@ rc = 0; } fat_bpb->mounted = false; +#ifdef HAVE_VOLUMELABEL + memset(fat_bpb->mountpt,0,sizeof(fat_bpb->mountpt)); + fat_bpb->mountpt_sz = 0; +#endif return rc; } #endif /* #ifdef HAVE_HOTSWAP */ @@ -2517,4 +2563,16 @@ { return (volume