Commit 3f814c0b authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent c52b5571
......@@ -42,7 +42,7 @@ using std::pair;
// from wendelin/bigfile/virtmem.h
extern "C" {
struct BigFileH;
struct VMA;
}
......@@ -144,7 +144,7 @@ public:
void decref();
public:
pair<Mapping, error> mmap(int64_t blk_start, int64_t blk_len);
pair<Mapping, error> mmap(int64_t blk_start, int64_t blk_len, VMA *vma=nil);
};
// Mapping represents one mapping of FileH.
......@@ -153,9 +153,9 @@ struct _Mapping : object {
FileH fileh;
int64_t blk_start; // offset of this mapping in file
BigFileH *virt_fileh; // mmapped under this virtmem file handle XXX -> VMA XXX can be nil
uint8_t *mem_start; // mmapped memory [mem_start, mem_stop)
uint8_t *mem_stop;
VMA *vma; // mmapped under this virtmem VMA | nil if created standalone from virtmem
int64_t blk_stop() const {
//XXX reenable
......@@ -171,7 +171,7 @@ struct _Mapping : object {
private:
_Mapping();
~_Mapping();
friend pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len);
friend pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma);
public:
void decref();
};
......
......@@ -289,7 +289,7 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
}
// mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len) {
pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma) {
_FileH& f = *this;
// XXX err ctx
// XXX (blk_start + blk_len) * blk_size overflow
......@@ -326,6 +326,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len) {
mmap->blk_start = blk_start;
mmap->mem_start = mem_start;
mmap->mem_stop = mem_stop;
mmap->vma = vma;
for (auto _ : f._pinned) { // XXX keep f._pinned ↑blk and use binary search?
int64_t blk = _.first;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment