2017-07-14 23:56:23 +00:00
|
|
|
#ifndef MEMFILE_HPP
|
|
|
|
#define MEMFILE_HPP
|
|
|
|
|
2018-05-07 20:17:00 +00:00
|
|
|
#include <atomic>
|
|
|
|
|
2015-06-18 23:13:37 +00:00
|
|
|
struct memfile {
|
2017-11-07 23:25:54 +00:00
|
|
|
int fd = 0;
|
|
|
|
char *map = NULL;
|
2018-05-07 20:17:00 +00:00
|
|
|
std::atomic<long long> len;
|
2017-11-07 23:25:54 +00:00
|
|
|
long long off = 0;
|
|
|
|
unsigned long tree = 0;
|
2018-05-07 20:17:00 +00:00
|
|
|
|
|
|
|
memfile()
|
|
|
|
: len(0) {
|
|
|
|
}
|
2015-06-18 23:13:37 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
struct memfile *memfile_open(int fd);
|
|
|
|
int memfile_close(struct memfile *file);
|
|
|
|
int memfile_write(struct memfile *file, void *s, long long len);
|
2017-07-14 23:56:23 +00:00
|
|
|
|
|
|
|
#endif
|