aboutsummaryrefslogtreecommitdiffstats
path: root/src/gfile/gfile.c
diff options
context:
space:
mode:
authorpashamray <pashamray@gmail.com>2014-07-02 13:02:01 +0300
committerpashamray <pashamray@gmail.com>2014-07-02 13:02:01 +0300
commite67fbb3e6b82742eae4096faff2a1e47e25804e3 (patch)
tree35df6e920e377ac05ba37c9479de47e8522cee75 /src/gfile/gfile.c
parent2127c61eeeea920ba79923bc6f29a1e2de80d61d (diff)
parent2b141cea7f30cb45f559db5949dcfbf0ebb7c613 (diff)
downloaduGFX-e67fbb3e6b82742eae4096faff2a1e47e25804e3.tar.gz
uGFX-e67fbb3e6b82742eae4096faff2a1e47e25804e3.tar.bz2
uGFX-e67fbb3e6b82742eae4096faff2a1e47e25804e3.zip
Tectu/ugfx слито с master
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