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
cce405b1
Commit
cce405b1
authored
Jan 13, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
bc4a30e4
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
22 additions
and
1 deletion
+22
-1
wcfs/internal/_wcfs.pxd
wcfs/internal/_wcfs.pxd
+2
-0
wcfs/internal/_wcfs.pyx
wcfs/internal/_wcfs.pyx
+9
-0
wcfs/internal/wcfs.cpp
wcfs/internal/wcfs.cpp
+9
-0
wcfs/internal/wcfs.h
wcfs/internal/wcfs.h
+1
-0
wcfs/wcfs_test.py
wcfs/wcfs_test.py
+1
-1
No files found.
wcfs/internal/_wcfs.pxd
View file @
cce405b1
...
@@ -100,11 +100,13 @@ cdef extern from "wcfs/internal/wcfs.h" namespace "wcfs" nogil:
...
@@ -100,11 +100,13 @@ cdef extern from "wcfs/internal/wcfs.h" namespace "wcfs" nogil:
cppclass
_FileH
:
cppclass
_FileH
:
size_t
blksize
size_t
blksize
error
close
()
pair
[
Mapping
,
error
]
mmap
(
int64_t
blk_start
,
int64_t
blk_len
)
# `VMA *vma=nil` not exposed
pair
[
Mapping
,
error
]
mmap
(
int64_t
blk_start
,
int64_t
blk_len
)
# `VMA *vma=nil` not exposed
cppclass
FileH
(
refptr
[
_FileH
]):
cppclass
FileH
(
refptr
[
_FileH
]):
# FileH.X = FileH->X in C++
# FileH.X = FileH->X in C++
size_t
blksize
"_ptr()->blksize"
size_t
blksize
"_ptr()->blksize"
error
close
"_ptr()->close"
()
pair
[
Mapping
,
error
]
mmap
"_ptr()->mmap"
(
int64_t
blk_start
,
int64_t
blk_len
)
pair
[
Mapping
,
error
]
mmap
"_ptr()->mmap"
(
int64_t
blk_start
,
int64_t
blk_len
)
cppclass
_Mapping
:
cppclass
_Mapping
:
...
...
wcfs/internal/_wcfs.pyx
View file @
cce405b1
...
@@ -98,6 +98,12 @@ cdef class PyFileH:
...
@@ -98,6 +98,12 @@ cdef class PyFileH:
def
__dealloc__
(
PyFileH
pywfileh
):
def
__dealloc__
(
PyFileH
pywfileh
):
pywfileh
.
wfileh
=
nil
pywfileh
.
wfileh
=
nil
def
close
(
PyFileH
pywfileh
):
with
nogil
:
err
=
wfileh_close_pyexc
(
pywfileh
.
wfileh
)
if
err
!=
nil
:
raise
pyerr
(
err
)
def
mmap
(
PyFileH
pywfileh
,
int64_t
blk_start
,
int64_t
blk_len
):
def
mmap
(
PyFileH
pywfileh
,
int64_t
blk_start
,
int64_t
blk_len
):
with
nogil
:
with
nogil
:
_
=
wfileh_mmap_pyexc
(
pywfileh
.
wfileh
,
blk_start
,
blk_len
)
_
=
wfileh_mmap_pyexc
(
pywfileh
.
wfileh
,
blk_start
,
blk_len
)
...
@@ -285,6 +291,9 @@ cdef nogil:
...
@@ -285,6 +291,9 @@ cdef nogil:
error
wconn_resync_pyexc
(
Conn
wconn
,
Tid
at
)
except
+
topyexc
:
error
wconn_resync_pyexc
(
Conn
wconn
,
Tid
at
)
except
+
topyexc
:
return
wconn
.
resync
(
at
)
return
wconn
.
resync
(
at
)
error
wfileh_close_pyexc
(
FileH
wfileh
)
except
+
topyexc
:
return
wfileh
.
close
()
pair
[
Mapping
,
error
]
wfileh_mmap_pyexc
(
FileH
wfileh
,
int64_t
blk_start
,
int64_t
blk_len
)
except
+
topyexc
:
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
)
return
wfileh
.
mmap
(
blk_start
,
blk_len
)
...
...
wcfs/internal/wcfs.cpp
View file @
cce405b1
...
@@ -295,6 +295,15 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
...
@@ -295,6 +295,15 @@ pair<FileH, error> _Conn::open(zodb::Oid foid) {
return
make_pair
(
f
,
nil
);
return
make_pair
(
f
,
nil
);
}
}
// close releases resources associated with FileH.
// XXX what happens with mappings?
error
_FileH
::
close
()
{
_FileH
&
fileh
=
*
this
;
// XXX err ctx
return
fileh
.
_headf
->
close
();
}
// mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
// mmap creates file mapping representing file[blk_start +blk_len) data as of wconn.at database state.
//
//
// If vma != nil, created mapping is associated with that vma of user-space virtual memory manager.
// If vma != nil, created mapping is associated with that vma of user-space virtual memory manager.
...
...
wcfs/internal/wcfs.h
View file @
cce405b1
...
@@ -155,6 +155,7 @@ public:
...
@@ -155,6 +155,7 @@ public:
void
decref
();
void
decref
();
public:
public:
error
close
();
pair
<
Mapping
,
error
>
mmap
(
int64_t
blk_start
,
int64_t
blk_len
,
VMA
*
vma
=
nil
);
pair
<
Mapping
,
error
>
mmap
(
int64_t
blk_start
,
int64_t
blk_len
,
VMA
*
vma
=
nil
);
};
};
...
...
wcfs/wcfs_test.py
View file @
cce405b1
...
@@ -1744,7 +1744,7 @@ def test_wcfspy_virtmem():
...
@@ -1744,7 +1744,7 @@ def test_wcfspy_virtmem():
defer
(
wconn
.
close
)
defer
(
wconn
.
close
)
fh
=
wconn
.
open
(
zf
.
_p_oid
)
fh
=
wconn
.
open
(
zf
.
_p_oid
)
# XXX
defer(fh.close)
defer
(
fh
.
close
)
# create mmap with 1 block beyond file size
# create mmap with 1 block beyond file size
m1
=
fh
.
mmap
(
2
,
3
)
m1
=
fh
.
mmap
(
2
,
3
)
...
...
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