aboutsummaryrefslogtreecommitdiffstats
path: root/src/gfile/inc_memfs.c
blob: fee089ce25dcb2480fef7e2aa48044dbe2ec178b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
 * 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, char *buf, int size);
static int MEMWrite(GFILE *f, char *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, char *buf, int size) {
	memset(buf, ((char *)f->fd)+f->pos, size);
	return size;
}
static int MEMWrite(GFILE *f, char *buf, int size) {
	memset(((char *)f->fd)+f->pos, buf, size);
	return size;
}
static bool_t MEMSetpos(GFILE *f, long int pos) {
	return TRUE;
}