aboutsummaryrefslogtreecommitdiffstats
path: root/src/gfile/inc_memfs.c
diff options
context:
space:
mode:
authorJoel Bodenmann <joel@unormal.org>2014-02-09 02:19:38 +0100
committerJoel Bodenmann <joel@unormal.org>2014-02-09 02:19:38 +0100
commitf68f4fcd21831894a1330131d7feefa0e63c39c1 (patch)
tree53f68c28ca4bc52a9ef0d393b362a488ca8e0ddf /src/gfile/inc_memfs.c
parent3c6df9a4a1b810411d9207fd2da39c3378bb9657 (diff)
parentc5f87f9952b11f0792dd1455e3f4286123c1d388 (diff)
downloaduGFX-f68f4fcd21831894a1330131d7feefa0e63c39c1.tar.gz
uGFX-f68f4fcd21831894a1330131d7feefa0e63c39c1.tar.bz2
uGFX-f68f4fcd21831894a1330131d7feefa0e63c39c1.zip
Merge branch 'gfile'
Diffstat (limited to 'src/gfile/inc_memfs.c')
-rw-r--r--src/gfile/inc_memfs.c43
1 files changed, 43 insertions, 0 deletions
diff --git a/src/gfile/inc_memfs.c b/src/gfile/inc_memfs.c
new file mode 100644
index 00000000..434150d8
--- /dev/null
+++ b/src/gfile/inc_memfs.c
@@ -0,0 +1,43 @@
+/*
+ * This file is subject to the terms of the GFX License. If a copy of
+ * the license was not distributed with this file, you can obtain one at:
+ *
+ * http://ugfx.org/license.html
+ */
+
+/**
+ * This file is included by src/gfile/gfile.c
+ */
+
+/********************************************************
+ * The Memory pointer file-system VMT
+ ********************************************************/
+
+#include <string.h>
+
+static int MEMRead(GFILE *f, void *buf, int size);
+static int MEMWrite(GFILE *f, const void *buf, int size);
+static bool_t MEMSetpos(GFILE *f, long int pos);
+
+static const GFILEVMT FsMemVMT = {
+ 0, // next
+ GFSFLG_SEEKABLE|GFSFLG_WRITEABLE, // flags
+ 0, // prefix
+ 0, 0, 0, 0,
+ 0, 0, MEMRead, MEMWrite,
+ MEMSetpos, 0, 0,
+};
+
+static int MEMRead(GFILE *f, void *buf, int size) {
+ memcpy(buf, ((char *)f->obj)+f->pos, size);
+ return size;
+}
+static int MEMWrite(GFILE *f, const void *buf, int size) {
+ memcpy(((char *)f->obj)+f->pos, buf, size);
+ return size;
+}
+static bool_t MEMSetpos(GFILE *f, long int pos) {
+ (void) f;
+ (void) pos;
+ return TRUE;
+}