Commit 5a975bb4 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 46b7c62f
...@@ -67,19 +67,19 @@ from wendelin.lib.zodb import zconn_at ...@@ -67,19 +67,19 @@ from wendelin.lib.zodb import zconn_at
cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
cdef object zself # reference to ZBigFile cdef object zself # reference to ZBigFile
cdef wcfs.Oid foid # = .zself._p_oid cdef wcfs.Oid foid # = .zself._p_oid
cdef wcfs.Conn wconn # WCFS connection XXX -> zconn instead ? XXX wconn is shared between files cdef wcfs.FileH wfileh # WCFS file handle
# XXX Cython does not allow __new__ nor to change arguments passed to __cinit__ / __init__ # XXX Cython does not allow __new__ nor to change arguments passed to __cinit__ / __init__
@staticmethod @staticmethod
def _new(zself, blksize): def _new(zself, blksize):
cdef _ZBigFile obj = _ZBigFile.__new__(_ZBigFile, blksize) cdef _ZBigFile obj = _ZBigFile.__new__(_ZBigFile, blksize)
obj.zself = zself obj.zself = zself
obj.foid = -1 # Note: zself._p_oid could be yet None for newly created ZBigFile # obj.foid = -1 # Note: zself._p_oid could be yet None for newly created ZBigFile
obj.wconn = nil # XXX obj.wfileh = nil # opened by blkmmapper
return obj return obj
def __dealloc__(_ZBigFile zf): def __dealloc__(_ZBigFile zf):
zf.wconn = nil zf.wfileh = nil
# redirect load/store/mapper to main class # redirect load/store/mapper to main class
...@@ -91,17 +91,18 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]: ...@@ -91,17 +91,18 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# #
# it is called from PyBigFile.fileh_open(mmap_overlay=True) and .zfile # it is called from PyBigFile.fileh_open(mmap_overlay=True) and .zfile
# should be already associaed with jar and have oid. # should be already associaed with jar and have oid.
def blkmapper(_ZBigFile zf): def blkmmapper(_ZBigFile zf):
cdef wcfs.PyConn pywconn cdef wcfs.PyFileH pywfileh
if zf.wconn == nil: if zf.wfileh == nil:
zconn = zf.zself._p_jar zconn = zf.zself._p_jar
assert zconn is not None assert zconn is not None
# XXX locking? or rely on that ZODB objects for must be used from under 1 thread only? # XXX locking? or rely on that ZODB objects for must be used from under 1 thread only?
zf.foid = u64(zf.zself._p_oid) # zf.foid = u64(zf.zself._p_oid)
# join zconn to wconn; link to wconn from _ZBigFile # join zconn to wconn; link to wconn from _ZBigFile
pywconn = pywconnOf(zconn) pywconn = pywconnOf(zconn)
zf.wconn = pywconn.wconn pywfileh = pywconn.open(zf.zself._p_oid)
zf.wfileh = pywfileh.wfileh
# functions that we give to virtmem bigfile_ops .mmap* # functions that we give to virtmem bigfile_ops .mmap*
......
...@@ -23,8 +23,10 @@ ...@@ -23,8 +23,10 @@
#include "bigfile/_file_zodb.h" #include "bigfile/_file_zodb.h"
void* virt_mmap_setup_read(VMA *vma, BigFile *file, blk_t blk, size_t blklen) { void* virt_mmap_setup_read(VMA *vma, BigFile *file, blk_t blk, size_t blklen) {
_ZBigFile* _zfile = static_cast<_ZBigFile*>(file); //_ZBigFile* _zfile = static_cast<_ZBigFile*>(file);
wcfs::FileH fileh; // XXX = ... somehow from file _ZBigFile* _zfile = NULL; // XXX
wcfs::FileH fileh = _zfile->wfileh;
wcfs::Mapping mmap; wcfs::Mapping mmap;
error err; error err;
......
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