all repos — mgba @ ee5c918ff24e6f5f23864518d9bdd64309115919

mGBA Game Boy Advance Emulator

src/util/vfs.h (view raw)

 1#ifndef VFS_H
 2#define VFS_H
 3
 4#include "common.h"
 5
 6#include "memory.h"
 7
 8struct VFile {
 9	bool (*close)(struct VFile* vf);
10	off_t (*seek)(struct VFile* vf, off_t offset, int whence);
11	ssize_t (*read)(struct VFile* vf, void* buffer, size_t size);
12	ssize_t (*readline)(struct VFile* vf, char* buffer, size_t size);
13	ssize_t (*write)(struct VFile* vf, void* buffer, size_t size);
14	void* (*map)(struct VFile* vf, size_t size, int flags);
15	void (*unmap)(struct VFile* vf, void* memory, size_t size);
16	void (*truncate)(struct VFile* vf, size_t size);
17};
18
19struct VDirEntry {
20	const char* (*name)(struct VDirEntry* vde);
21};
22
23struct VDir {
24	bool (*close)(struct VDir* vd);
25	void (*rewind)(struct VDir* vd);
26	struct VDirEntry* (*listNext)(struct VDir* vd);
27	struct VFile* (*openFile)(struct VDir* vd, const char* name, int mode);
28};
29
30struct VFile* VFileOpen(const char* path, int flags);
31struct VFile* VFileFromFD(int fd);
32
33struct VDir* VDirOpen(const char* path);
34
35#endif