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

.

parent c9df6fe7
......@@ -920,20 +920,24 @@ pyfileh_open(PyObject *pyfile0, PyObject *args)
RAM *ram = ram_get_default(NULL); // TODO get ram from args
int err;
if (!PyArg_ParseTuple(args, "")) // XXX parse mmap_overlay=None (True/False)
int mmap_overlay = -1; /* -1 means None; https://bugs.python.org/issue14705 */
if (!PyArg_ParseTuple(args, "|i", &mmap_overlay))
return NULL;
// XXX verify if pyfile has .mmapper()
// if mmap_overlay or (mmap_overlay==None and has(pyfile.mmapper)):
// mmaper = pyfile.mmapper()
if (mmap_overlay == -1)
mmap_overlay = (pyfile->blkmmap_ops != NULL ? 1 : 0);
if (mmap_overlay && pyfile->blkmmap_ops == NULL) {
PyErr_SetString(PyExc_TypeError, "BigFile subtype does not provide blkmmapper");
return NULL;
}
pyfileh = PyType_New(PyBigFileH, &PyBigFileH_Type, NULL);
if (!pyfileh)
return NULL;
Py_INCREF(pyfile);
err = fileh_open(&pyfileh->fileh, &pyfile->file, ram, DONT_MMAP_OVERLAY); // XXX -> MMAP_OVERLAY if requested
err = fileh_open(&pyfileh->fileh, &pyfile->file, ram,
mmap_overlay ? MMAP_OVERLAY : DONT_MMAP_OVERLAY);
if (err) {
XPyErr_SetFromErrno();
Py_DECREF(pyfile);
......
......@@ -110,6 +110,11 @@ struct PyBigFile {
* automatically adds support for weakrefs for in-python defined children */
BigFile file;
/* PyCapsule object with blkmmapper if BigFile subclass has it | NULL */
PyObject *blkmmapper_pycapsule; // XXX traverse for GC?
/* bigfile_ops extract from ^^^ capsule | NULL */
bigfile_ops *blkmmap_ops;
};
typedef struct PyBigFile PyBigFile;
......
......@@ -24,6 +24,8 @@
"""XXX"""
from __future__ import print_function, absolute_import
cdef extern from "wcfs/internal/wcfs.h":
pass
......
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