2014-07-16 08:31:10 +00:00
|
|
|
#ifndef VFILE_H
|
|
|
|
#define VFILE_H
|
|
|
|
|
|
|
|
#include "common.h"
|
|
|
|
|
2014-07-16 09:08:54 +00:00
|
|
|
#include "memory.h"
|
|
|
|
|
2014-07-16 08:31:10 +00:00
|
|
|
struct VFile {
|
|
|
|
bool (*close)(struct VFile* vf);
|
2014-07-16 10:02:16 +00:00
|
|
|
off_t (*seek)(struct VFile* vf, off_t offset, int whence);
|
|
|
|
ssize_t (*read)(struct VFile* vf, void* buffer, size_t size);
|
|
|
|
ssize_t (*readline)(struct VFile* vf, char* buffer, size_t size);
|
|
|
|
ssize_t (*write)(struct VFile* vf, void* buffer, size_t size);
|
2014-07-16 09:08:54 +00:00
|
|
|
void* (*map)(struct VFile* vf, size_t size, int flags);
|
|
|
|
void (*unmap)(struct VFile* vf, void* memory, size_t size);
|
|
|
|
void (*truncate)(struct VFile* vf, size_t size);
|
2014-07-16 08:31:10 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct VFile* VFileOpen(const char* path, int flags);
|
|
|
|
struct VFile* VFileFromFD(int fd);
|
|
|
|
|
|
|
|
#endif
|