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
a13208ca
Commit
a13208ca
authored
Dec 17, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
e34344b3
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
61 additions
and
43 deletions
+61
-43
bigfile/_file_zodb.pyx
bigfile/_file_zodb.pyx
+0
-42
bigfile/file_zodb.cpp
bigfile/file_zodb.cpp
+59
-0
setup.py
setup.py
+2
-1
No files found.
bigfile/_file_zodb.pyx
View file @
a13208ca
...
...
@@ -106,48 +106,6 @@ cdef public class _ZBigFile(BigFile) [object _ZBigFile, type _ZBigFile_Type]:
# functions that we give to virtmem bigfile_ops .mmap*
cdef
extern
from
*
nogil
:
"""
#include "bigfile/_file_zodb.h"
void* virt_mmap_setup_read(VMA *vma, BigFile *file, blk_t blk, size_t blklen) {
_ZBigFile* _zfile = static_cast<_ZBigFile*>(file);
wcfs::FileH fileh; // XXX = ... somehow from file
wcfs::Mapping mmap;
error err;
tie(mmap, err) = fileh->mmap(blk, blklen, vma);
if (err != nil)
panic("TODO"); // XXX
mmap->incref(); // vma->mmap_overlay_server is keeping ref to mmap
vma->mmap_overlay_server = mmap._ptr();
// XXX here? -> in fileh->mmap? don't set at all here?
vma->addr_start = (uintptr_t)mmap->mem_start;
vma->addr_stop = (uintptr_t)mmap->mem_stop;
return (void*)vma->addr_start; // XXX kill if we set vma->addr_*
}
int virt_remmap_blk_read(VMA *vma, BigFile *file, blk_t blk) {
wcfs::_Mapping *mmap = static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server);
// XXX use file?
mmap->remmap_blk(blk); // XXX err
return 0;
}
void virt_munmap(VMA *vma, BigFile *file) {
// NOTE taking 1 ref back from vma->mmap_overlay_server
wcfs::Mapping mmap = adoptref(static_cast<wcfs::_Mapping*>(vma->mmap_overlay_server));
vma->mmap_overlay_server = NULL;
mmap->unmap();
// XXX close mmap->fileh
}
"""
pass
...
...
bigfile/file_zodb.cpp
0 → 100644
View file @
a13208ca
// Copyright (C) 2019 Nexedi SA and Contributors.
// Kirill Smelkov <kirr@nexedi.com>
//
// This program is free software: you can Use, Study, Modify and Redistribute
// it under the terms of the GNU General Public License version 3, or (at your
// option) any later version, as published by the Free Software Foundation.
//
// You can also Link and Combine this program with other software covered by
// the terms of any of the Free Software licenses or any of the Open Source
// Initiative approved licenses and Convey the resulting work. Corresponding
// source of such a combination shall include the source code for all other
// software used.
//
// This program is distributed WITHOUT ANY WARRANTY; without even the implied
// warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
//
// See COPYING file for full licensing terms.
// See https://www.nexedi.com/licensing for rationale and options.
#include "bigfile/_file_zodb.h"
void
*
virt_mmap_setup_read
(
VMA
*
vma
,
BigFile
*
file
,
blk_t
blk
,
size_t
blklen
)
{
_ZBigFile
*
_zfile
=
static_cast
<
_ZBigFile
*>
(
file
);
wcfs
::
FileH
fileh
;
// XXX = ... somehow from file
wcfs
::
Mapping
mmap
;
error
err
;
tie
(
mmap
,
err
)
=
fileh
->
mmap
(
blk
,
blklen
,
vma
);
if
(
err
!=
nil
)
panic
(
"TODO"
);
// XXX
mmap
->
incref
();
// vma->mmap_overlay_server is keeping ref to mmap
vma
->
mmap_overlay_server
=
mmap
.
_ptr
();
// XXX here? -> in fileh->mmap? don't set at all here?
vma
->
addr_start
=
(
uintptr_t
)
mmap
->
mem_start
;
vma
->
addr_stop
=
(
uintptr_t
)
mmap
->
mem_stop
;
return
(
void
*
)
vma
->
addr_start
;
// XXX kill if we set vma->addr_*
}
int
virt_remmap_blk_read
(
VMA
*
vma
,
BigFile
*
file
,
blk_t
blk
)
{
wcfs
::
_Mapping
*
mmap
=
static_cast
<
wcfs
::
_Mapping
*>
(
vma
->
mmap_overlay_server
);
// XXX use file?
mmap
->
remmap_blk
(
blk
);
// XXX err
return
0
;
}
void
virt_munmap
(
VMA
*
vma
,
BigFile
*
file
)
{
// NOTE taking 1 ref back from vma->mmap_overlay_server
wcfs
::
Mapping
mmap
=
adoptref
(
static_cast
<
wcfs
::
_Mapping
*>
(
vma
->
mmap_overlay_server
));
vma
->
mmap_overlay_server
=
NULL
;
mmap
->
unmap
();
// XXX close mmap->fileh
}
setup.py
View file @
a13208ca
...
...
@@ -278,7 +278,8 @@ setup(
dsos
=
[
'wendelin.bigfile.libvirtmem'
]),
PyGoExt
(
'wendelin.bigfile._file_zodb'
,
[
'bigfile/_file_zodb.pyx'
],
[
'bigfile/_file_zodb.pyx'
,
'bigfile/file_zodb.cpp'
],
dsos
=
[
'wendelin.wcfs.internal.libwcfs'
]),
PyGoExt
(
'wendelin.wcfs.internal._wcfs'
,
...
...
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