Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
W
wendelin.core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
651eaf72
Commit
651eaf72
authored
Nov 09, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
29cced29
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
28 deletions
+27
-28
bigfile/_bigfile.c
bigfile/_bigfile.c
+27
-28
No files found.
bigfile/_bigfile.c
View file @
651eaf72
...
...
@@ -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
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment