Commit 651eaf72 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 29cced29
......@@ -168,7 +168,33 @@ pyvma_len(PyObject *pyvma0)
}
/* pyvma vs cyclic GC */ // XXX move closer to pyvma_dealloc
PyFunc(pyvma_filerange, "filerange() -> (pgoffset, pglen) -- file range this vma covers")
(PyObject *pyvma0, PyObject *args)
{
PyVMA *pyvma = container_of(pyvma0, PyVMA, pyobj);
VMA *vma = &pyvma->vma;
Py_ssize_t pgoffset, pglen; // XXX Py_ssize_t vs pgoff_t
pgoffset = vma->f_pgoffset;
pglen = (vma->addr_stop - vma->addr_start) / vma->fileh->ramh->ram->pagesize;
/* NOTE ^^^ addr_stop and addr_start must be page-aligned */
return Py_BuildValue("(nn)", pgoffset, pglen);
}
PyFunc(pyvma_pagesize, "pagesize() -> pagesize -- page size of RAM underlying this VMA")
(PyObject *pyvma0, PyObject *args)
{
PyVMA *pyvma = container_of(pyvma0, PyVMA, pyobj);
VMA *vma = &pyvma->vma;
Py_ssize_t pagesize = vma->fileh->ramh->ram->pagesize;
return Py_BuildValue("n", pagesize);
}
/* pyvma vs cyclic GC */
static int
pyvma_traverse(PyObject *pyvma0, visitproc visit, void *arg)
{
......@@ -221,32 +247,6 @@ pyvma_clear(PyObject *pyvma0)
}
PyFunc(pyvma_filerange, "filerange() -> (pgoffset, pglen) -- file range this vma covers")
(PyObject *pyvma0, PyObject *args)
{
PyVMA *pyvma = container_of(pyvma0, PyVMA, pyobj);
VMA *vma = &pyvma->vma;
Py_ssize_t pgoffset, pglen; // XXX Py_ssize_t vs pgoff_t
pgoffset = vma->f_pgoffset;
pglen = (vma->addr_stop - vma->addr_start) / vma->fileh->ramh->ram->pagesize;
/* NOTE ^^^ addr_stop and addr_start must be page-aligned */
return Py_BuildValue("(nn)", pgoffset, pglen);
}
PyFunc(pyvma_pagesize, "pagesize() -> pagesize -- page size of RAM underlying this VMA")
(PyObject *pyvma0, PyObject *args)
{
PyVMA *pyvma = container_of(pyvma0, PyVMA, pyobj);
VMA *vma = &pyvma->vma;
Py_ssize_t pagesize = vma->fileh->ramh->ram->pagesize;
return Py_BuildValue("n", pagesize);
}
static void
pyvma_dealloc(PyObject *pyvma0)
{
......@@ -267,7 +267,6 @@ pyvma_dealloc(PyObject *pyvma0)
/* pyvma->fileh indicates whether vma was yet created (via fileh_mmap()) or not */
if (fileh) {
vma_unmap(vma);
//vma->fileh = NULL;
PyBigFileH *pyfileh = container_of(fileh, PyBigFileH, fileh);
Py_DECREF(pyfileh);
......
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