µGFX  2.9
version 2.9
gfile_fs.h
Go to the documentation of this file.
1 /*
2  * This file is subject to the terms of the GFX License. If a copy of
3  * the license was not distributed with this file, you can obtain one at:
4  *
5  * http://ugfx.io/license.html
6  */
7 
8 /**
9  * @file src/gfile/gfile_fs.h
10  * @brief GFILE file system header.
11  *
12  */
13 
14 #ifndef _GFILE_FS_H
15 #define _GFILE_FS_H
16 
17 struct GFILE {
18  const struct GFILEVMT * vmt;
19  gU16 flags;
20  #define GFILEFLG_OPEN 0x0001 // File is open
21  #define GFILEFLG_READ 0x0002 // Read the file
22  #define GFILEFLG_WRITE 0x0004 // Write the file
23  #define GFILEFLG_APPEND 0x0008 // Append on each write
24  #define GFILEFLG_BINARY 0x0010 // Treat as a binary file
25  #define GFILEFLG_DELONCLOSE 0x0020 // Delete on close
26  #define GFILEFLG_CANSEEK 0x0040 // Seek operations are valid
27  #define GFILEFLG_FAILONBLOCK 0x0080 // Fail on a blocking call
28  #define GFILEFLG_MUSTEXIST 0x0100 // On open file must exist
29  #define GFILEFLG_MUSTNOTEXIST 0x0200 // On open file must not exist
30  #define GFILEFLG_TRUNC 0x0400 // On open truncate the file
31  void * obj;
32  gFileSize pos;
33 };
34 
35 struct gfileList {
36  const struct GFILEVMT * vmt;
37  gBool dirs;
38 };
39 
40 typedef struct GFILEVMT {
41  gU8 flags;
42  #define GFSFLG_WRITEABLE 0x0001
43  #define GFSFLG_CASESENSITIVE 0x0002
44  #define GFSFLG_SEEKABLE 0x0004
45  #define GFSFLG_FAST 0x0010
46  #define GFSFLG_SMALL 0x0020
47  #define GFSFLG_TEXTMODES 0x0040
48  char prefix;
49  gBool (*del) (const char *fname);
50  gBool (*exists) (const char *fname);
51  gFileSize (*filesize) (const char *fname);
52  gBool (*ren) (const char *oldname, const char *newname);
53  gBool (*open) (GFILE *f, const char *fname);
54  void (*close) (GFILE *f);
55  int (*read) (GFILE *f, void *buf, int size);
56  int (*write) (GFILE *f, const void *buf, int size);
57  gBool (*setpos) (GFILE *f, gFileSize pos);
58  gFileSize (*getsize) (GFILE *f);
59  gBool (*eof) (GFILE *f);
60  gBool (*mount) (const char *drive);
61  gBool (*unmount) (const char *drive);
62  gBool (*sync) (GFILE *f);
63  #if GFILE_NEED_FILELISTS
64  gfileList * (*flopen) (const char *path, gBool dirs);
65  const char *(*flread) (gfileList *pfl);
66  void (*flclose) (gfileList *pfl);
67  #endif
68 } GFILEVMT;
69 
70 GFILE *_gfileFindSlot(const char *mode);
71 
72 #endif //_GFILE_FS_H
struct GFILE GFILE
A file pointer.
Definition: gfile.h:34