Commit 1947412d authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 6d1e34da
......@@ -905,7 +905,12 @@ out:
static const struct bigfile_ops pybigfile_ops = {
.loadblk = pybigfile_loadblk,
.storeblk = pybigfile_storeblk,
// XXX .mmap*
// TODO .mmap*
.mmap_setup_read = NULL,
.remmap_blk_read = NULL,
.munmap = NULL,
//.release =
};
......@@ -952,6 +957,17 @@ static PyObject *
pyfile_new(PyTypeObject *type, PyObject *args, PyObject *kw)
{
PyBigFile *self;
PyObject *blkmmapper;
blkmmapper = PyObject_GetAttrString((PyObject*)type, "blkmmapper");
PyErr_Clear(); /* GetAttr raises exception if there is no attribute */
if (blkmmapper) {
if (!PyCapsule_IsValid(blkmmapper, "wendelin.bigfile.IBlkMMapper")) {
Py_DECREF(blkmmapper);
return PyErr_Format(PyExc_TypeError,
"%s: .blkmmapper is not a valid pycapsule with mmap methods", type->tp_name);
}
}
self = (PyBigFile *)PyType_GenericNew(type, args, kw);
if (!self)
......
......@@ -88,7 +88,7 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# blkmmapper is pycapsule with virtmem mmap functions for _ZBigFile.
# The functions rely on .wfileh being initialized by .fileh_open()
blkmmapper = PyCapsule_New(<void*>&ZBigFile_mmap_ops, "bigfile.blkmmaper", NULL)
blkmmapper = PyCapsule_New(<void*>&ZBigFile_mmap_ops, "wendelin.bigfile.IBlkMMaper", NULL)
# fileh_open wraps BigFile.fileh_open and makes sure that WCFS file handle
# corresponding to ZBigFile is opened if use_wcfs=True.
......
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