aboutsummaryrefslogtreecommitdiffstats
path: root/src/gfile/gfile.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/gfile/gfile.c')
-rw-r--r--src/gfile/gfile.c40
1 files changed, 39 insertions, 1 deletions
diff --git a/src/gfile/gfile.c b/src/gfile/gfile.c
index e8ba37c6..6aadda09 100644
--- a/src/gfile/gfile.c
+++ b/src/gfile/gfile.c
@@ -56,6 +56,9 @@ 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);
+ bool_t (*sync) (GFILE *f);
} GFILEVMT;
// The chain of FileSystems
@@ -97,7 +100,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 +478,40 @@ 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;
+}
+
+bool_t gfileSync(GFILE *f) {
+ if (!f->vmt->sync)
+ return FALSE;
+ return f->vmt->sync(f);
+}
+
/********************************************************
* String VMT routines
********************************************************/
@@ -505,6 +542,7 @@ bool_t gfileEOF(GFILE *f) {
0, 0, 0, 0,
0, 0, StringRead, StringWrite,
0, 0, 0,
+ 0, 0
};
#endif