Commit a13208ca authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent e34344b3
......@@ -106,48 +106,6 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# functions that we give to virtmem bigfile_ops .mmap*
cdef extern from * nogil:
"""
#include "bigfile/_file_zodb.h"
void* virt_mmap_setup_read(VMA *vma, BigFile *file, blk_t blk, size_t blklen) {
_ZBigFile* _zfile = static_cast<_ZBigFile*>(file);
wcfs::FileH fileh; // XXX = ... somehow from file
wcfs::Mapping mmap;
error err;
tie(mmap, err) = fileh->mmap(blk, blklen, vma);
if (err != nil)
panic("TODO"); // XXX
mmap->incref(); // vma->mmap_overlay_server is keeping ref to mmap
vma->mmap_overlay_server = mmap._ptr();
// XXX here? -> in fileh->mmap? don't set at all here?
vma->addr_start = (uintptr_t)mmap->mem_start;
vma->addr_stop = (uintptr_t)mmap->mem_stop;
return (void*)vma->addr_start; // XXX kill if we set vma->addr_*
}
int virt_remmap_blk_read(VMA *vma, BigFile *file, blk_t blk) {
wcfs::_Mapping *mmap = static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server);
// XXX use file?
mmap->remmap_blk(blk); // XXX err
return 0;
}
void virt_munmap(VMA *vma, BigFile *file) {
// NOTE taking 1 ref back from vma->mmap_overlay_server
wcfs::Mapping mmap = adoptref(static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server));
vma->mmap_overlay_server = NULL;
mmap->unmap();
// XXX close mmap->fileh
}
"""
pass
......
// Copyright (C) 2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
#include "bigfile/_file_zodb.h"
void* virt_mmap_setup_read(VMA *vma, BigFile *file, blk_t blk, size_t blklen) {
_ZBigFile* _zfile = static_cast<_ZBigFile*>(file);
wcfs::FileH fileh; // XXX = ... somehow from file
wcfs::Mapping mmap;
error err;
tie(mmap, err) = fileh->mmap(blk, blklen, vma);
if (err != nil)
panic("TODO"); // XXX
mmap->incref(); // vma->mmap_overlay_server is keeping ref to mmap
vma->mmap_overlay_server = mmap._ptr();
// XXX here? -> in fileh->mmap? don't set at all here?
vma->addr_start = (uintptr_t)mmap->mem_start;
vma->addr_stop = (uintptr_t)mmap->mem_stop;
return (void*)vma->addr_start; // XXX kill if we set vma->addr_*
}
int virt_remmap_blk_read(VMA *vma, BigFile *file, blk_t blk) {
wcfs::_Mapping *mmap = static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server);
// XXX use file?
mmap->remmap_blk(blk); // XXX err
return 0;
}
void virt_munmap(VMA *vma, BigFile *file) {
// NOTE taking 1 ref back from vma->mmap_overlay_server
wcfs::Mapping mmap = adoptref(static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server));
vma->mmap_overlay_server = NULL;
mmap->unmap();
// XXX close mmap->fileh
}
......@@ -278,7 +278,8 @@ setup(
dsos = ['wendelin.bigfile.libvirtmem']),
PyGoExt('wendelin.bigfile._file_zodb',
['bigfile/_file_zodb.pyx'],
['bigfile/_file_zodb.pyx',
'bigfile/file_zodb.cpp'],
dsos = ['wendelin.wcfs.internal.libwcfs']),
PyGoExt('wendelin.wcfs.internal._wcfs',
......
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