VFS: Add VFile.sync for memory vfs

This commit is contained in:
Jeffrey Pfau 2015-07-12 15:49:04 -07:00
parent 1b8fe1aa09
commit 386da2accd
1 changed files with 9 additions and 0 deletions

View File

@ -20,6 +20,7 @@ static void* _vfmMap(struct VFile* vf, size_t size, int flags);
static void _vfmUnmap(struct VFile* vf, void* memory, size_t size); static void _vfmUnmap(struct VFile* vf, void* memory, size_t size);
static void _vfmTruncate(struct VFile* vf, size_t size); static void _vfmTruncate(struct VFile* vf, size_t size);
static ssize_t _vfmSize(struct VFile* vf); static ssize_t _vfmSize(struct VFile* vf);
static bool _vfmSync(struct VFile* vf, const void* buffer, size_t size);
struct VFile* VFileFromMemory(void* mem, size_t size) { struct VFile* VFileFromMemory(void* mem, size_t size) {
if (!mem || !size) { if (!mem || !size) {
@ -43,6 +44,7 @@ struct VFile* VFileFromMemory(void* mem, size_t size) {
vfm->d.unmap = _vfmUnmap; vfm->d.unmap = _vfmUnmap;
vfm->d.truncate = _vfmTruncate; vfm->d.truncate = _vfmTruncate;
vfm->d.size = _vfmSize; vfm->d.size = _vfmSize;
vfm->d.sync = _vfmSync;
return &vfm->d; return &vfm->d;
} }
@ -137,3 +139,10 @@ ssize_t _vfmSize(struct VFile* vf) {
struct VFileMem* vfm = (struct VFileMem*) vf; struct VFileMem* vfm = (struct VFileMem*) vf;
return vfm->size; return vfm->size;
} }
bool _vfmSync(struct VFile* vf, const void* buffer, size_t size) {
UNUSED(vf);
UNUSED(buffer);
UNUSED(size);
return true;
}