diff options
Diffstat (limited to 'src/gfile/gfile.c')
-rw-r--r-- | src/gfile/gfile.c | 32 |
1 files changed, 31 insertions, 1 deletions
diff --git a/src/gfile/gfile.c b/src/gfile/gfile.c index e8ba37c6..b7ebbc97 100644 --- a/src/gfile/gfile.c +++ b/src/gfile/gfile.c @@ -56,6 +56,8 @@ typedef struct GFILEVMT { bool_t (*setpos) (GFILE *f, long int pos); long int (*getsize) (GFILE *f); bool_t (*eof) (GFILE *f); + bool_t (*mount) (const char *drive); + bool_t (*unmount) (const char *drive); } GFILEVMT; // The chain of FileSystems @@ -97,7 +99,7 @@ GFILE *gfileStdErr; /******************************************************** * The FAT file-system VMT ********************************************************/ -#ifndef GFILE_NEED_FATFS +#if GFILE_NEED_FATFS #include "src/gfile/inc_fatfs.c" #endif @@ -475,6 +477,34 @@ bool_t gfileEOF(GFILE *f) { return f->vmt->eof(f); } +bool_t gfileMount(char fs, const char* drive) { + const GFILEVMT *p; + + // Find the correct VMT + for(p = FsChain; p; p = p->next) { + if (p->prefix == fs) { + if (!p->mount) + return FALSE; + return p->mount(drive); + } + } + return FALSE; +} + +bool_t gfileUnmount(char fs, const char* drive) { + const GFILEVMT *p; + + // Find the correct VMT + for(p = FsChain; p; p = p->next) { + if (p->prefix == fs) { + if (!p->mount) + return FALSE; + return p->unmount(drive); + } + } + return FALSE; +} + /******************************************************** * String VMT routines ********************************************************/ |