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
28f4d7d4
Commit
28f4d7d4
authored
Jan 08, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
aaf238b5
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
55 additions
and
6 deletions
+55
-6
wcfs/internal/_wcfs.pxd
wcfs/internal/_wcfs.pxd
+23
-5
wcfs/internal/_wcfs.pyx
wcfs/internal/_wcfs.pyx
+28
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+4
-1
No files found.
wcfs/internal/_wcfs.pxd
View file @
28f4d7d4
...
...
@@ -30,7 +30,7 @@
from
golang
cimport
chan
,
structZ
,
string
,
error
,
refptr
from
golang
cimport
context
from
libc.stdint
cimport
int64_t
,
uint64_t
from
libc.stdint
cimport
int64_t
,
uint64_t
,
uint8_t
from
libcpp.utility
cimport
pair
from
libcpp.vector
cimport
vector
...
...
@@ -99,13 +99,28 @@ cdef extern from "wcfs/internal/wcfs.h" namespace "wcfs" nogil:
error
resync
"_ptr()->resync"
(
Tid
at
)
cppclass
_FileH
:
# XXX add mmap?
pass
pair
[
Mapping
,
error
]
mmap
(
int64_t
blk_start
,
int64_t
blk_len
)
# `VMA *vma=nil` not exposed
cppclass
FileH
(
refptr
[
_FileH
]):
# FileH.X = FileH->X in C++
# XXX add mmap?
pass
pair
[
Mapping
,
error
]
mmap
"_ptr()->mmap"
(
int64_t
blk_start
,
int64_t
blk_len
)
cppclass
_Mapping
:
int64_t
blk_start
int64_t
blk_stop
()
const
uint8_t
*
mem_start
uint8_t
*
mem_stop
void
unmap
()
cppclass
Mapping
(
refptr
[
_Mapping
]):
# Mapping.X = Mapping->X in C++
int64_t
blk_start
"_ptr()->blk_start"
int64_t
blk_stop
"_ptr()->blk_stop"
()
const
uint8_t
*
mem_start
"_ptr()->mem_start"
uint8_t
*
mem_stop
"_ptr()->mem_stop"
void
unmap
"_ptr()->unmap"
()
# ---- python bits ----
...
...
@@ -119,6 +134,9 @@ cdef class PyConn:
cdef
class
PyFileH
:
cdef
FileH
wfileh
cdef
class
PyMapping
:
cdef
Mapping
wmmap
cdef
class
PyWatchLink
:
cdef
WatchLink
wlink
...
...
wcfs/internal/_wcfs.pyx
View file @
28f4d7d4
...
...
@@ -96,6 +96,28 @@ cdef class PyFileH:
def
__dealloc__
(
PyFileH
pywfileh
):
pywfileh
.
wfileh
=
nil
def
mmap
(
PyFileH
pywfileh
,
int64_t
blk_start
,
int64_t
blk_len
):
with
nogil
:
_
=
wfileh_mmap_pyexc
(
pywfileh
.
wfileh
,
blk_start
,
blk_len
)
wmmap
=
_
.
first
err
=
_
.
second
if
err
!=
nil
:
raise
pyerr
(
err
)
cdef
PyMapping
pywmmap
=
PyMapping
.
__new__
(
PyMapping
)
pywmmap
.
wmmap
=
wmmap
return
pywmmap
cdef
class
PyMapping
:
def
__dealloc__
(
PyMapping
pywmmap
):
pywmmap
.
wmmap
=
nil
# XXX unmap too ?
def
unmap
(
PyMapping
pywmmap
):
with
nogil
:
wmmap_unmap_pyexc
(
pywmmap
.
wmmap
)
# XXX +err
# ----------------------------------------
cdef
class
PyWatchLink
:
...
...
@@ -233,6 +255,12 @@ cdef nogil:
error
wconn_resync_pyexc
(
Conn
wconn
,
Tid
at
)
except
+
topyexc
:
return
wconn
.
resync
(
at
)
pair
[
Mapping
,
error
]
wfileh_mmap_pyexc
(
FileH
wfileh
,
int64_t
blk_start
,
int64_t
blk_len
)
except
+
topyexc
:
return
wfileh
.
mmap
(
blk_start
,
blk_len
)
void
wmmap_unmap_pyexc
(
Mapping
wmmap
)
except
+
topyexc
:
wmmap
.
unmap
()
error
wlink_close_pyexc
(
WatchLink
wlink
)
except
+
topyexc
:
return
wlink
.
close
()
...
...
wcfs/wcfs_test.py
View file @
28f4d7d4
...
...
@@ -1743,8 +1743,11 @@ def test_wcfspy_virtmem():
wconn
=
t
.
wc
.
connect
(
at1
)
defer
(
wconn
.
close
)
wf
=
wconn
.
open
(
zf
.
_p_oid
)
# XXX defer(wf.close)
# create mmap with 1 block beyond file size
m1
=
w
conn
.
mmap
(
zf
.
_p_oid
,
2
,
3
)
m1
=
w
f
.
mmap
(
2
,
3
)
defer
(
m1
.
unmap
)
assert
m1
.
blk_start
==
2
...
...
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