Commit 56411971 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 323df0d2
......@@ -96,7 +96,7 @@ LINKC = $(LINK.c) $< $(LOADLIBES) $(LDLIBS) -o $@
# tests without instrumentation
test.t : $(TESTS:%=%.trun)
%.trun : %.t
$(XRUN<)
gdb -q -ex run -ex backtrace -ex quit $(XRUN<)
%.t : %.c $(ccan_config)
$(LINKC)
......
......@@ -223,6 +223,8 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
void *addr;
size_t len = pglen * fileh->ramh->ram->pagesize;
int err = 0;
BigFile *file = fileh->file;
const bigfile_ops *fops = file->file_ops;
sigset_t save_sigset;
sigsegv_block(&save_sigset);
......@@ -235,11 +237,22 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen)
if (!vma->page_ismappedv)
goto fail;
// XXX hardcoded - allow user choise?
vma->mmap_overlay = (fops->mmap_setup_read != NULL);
if (vma->mmap_overlay) {
TODO (file->blksize != fileh->ramh->ram->pagesize);
addr = fops->mmap_setup_read(file, pgoffset, pglen, vma);
if (!addr)
goto fail;
// XXX + mmap(fileh->dirty_pages)
} else {
/* allocate address space somewhere */
// XXX overlay: -> mmap(base, READ) + mmap(fileh->dirty_pages)
addr = mem_valloc(NULL, len);
if (!addr)
goto fail;
}
/* everything allocated - link it up */
vma->addr_start = (uintptr_t)addr;
......
......@@ -96,6 +96,6 @@ struct bigfile_ops {
*/
void (*release) (BigFile *file);
};
typedef struct bigfile_ops bigfile_ops;
#endif
......@@ -137,6 +137,9 @@ struct VMA {
/* whether corresponding to pgoffset-f_offset page is mapped in this VMA */
bitmap *page_ismappedv; /* len ~ Δaddr / pagesize */
// XXX name
unsigned mmap_overlay : 1; /* whether base data are taken as file mmap XXX */
};
......
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