Commit dd32feba authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 40b59cc4
...@@ -39,6 +39,18 @@ ...@@ -39,6 +39,18 @@
#include <wendelin/bigfile/types.h> #include <wendelin/bigfile/types.h>
#include <wendelin/bigfile/pagemap.h> #include <wendelin/bigfile/pagemap.h>
#if 0
#include <golang/libgolang.h>
#if BUILDING_LIBVIRTMEM
# define VIRTMEM_API LIBGOLANG_DSO_EXPORT
#else
# define VIRTMEM_API LIBGOLANG_DSO_IMPORT
#endif
#endif
#define VIRTMEM_API
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
#endif #endif
...@@ -189,7 +201,7 @@ typedef enum FileHOpenFlags FileHOpenFlags; ...@@ -189,7 +201,7 @@ typedef enum FileHOpenFlags FileHOpenFlags;
* *
* @return 0 - ok, !0 - fail * @return 0 - ok, !0 - fail
*/ */
int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags); VIRTMEM_API int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags);
/* close fileh /* close fileh
...@@ -197,7 +209,7 @@ int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags); ...@@ -197,7 +209,7 @@ int fileh_open(BigFileH *fileh, BigFile *file, RAM *ram, FileHOpenFlags flags);
* it's an error to call fileh_close with existing mappings * it's an error to call fileh_close with existing mappings
* it's an error to call fileh_close while writeout for fileh is in progress * it's an error to call fileh_close while writeout for fileh is in progress
*/ */
void fileh_close(BigFileH *fileh); VIRTMEM_API void fileh_close(BigFileH *fileh);
/* map fileh part into memory /* map fileh part into memory
...@@ -207,7 +219,7 @@ void fileh_close(BigFileH *fileh); ...@@ -207,7 +219,7 @@ void fileh_close(BigFileH *fileh);
* @vma[out] vma to initialize for this mmap * @vma[out] vma to initialize for this mmap
* @return 0 - ok, !0 - fail * @return 0 - ok, !0 - fail
*/ */
int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen); VIRTMEM_API int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen);
/* unmap mapping created by fileh_mmap() /* unmap mapping created by fileh_mmap()
...@@ -216,7 +228,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen); ...@@ -216,7 +228,7 @@ int fileh_mmap(VMA *vma, BigFileH *fileh, pgoff_t pgoffset, pgoff_t pglen);
* Changes made to fileh pages are preserved (to e.g. either other mappings and * Changes made to fileh pages are preserved (to e.g. either other mappings and
* later commit/discard). * later commit/discard).
*/ */
void vma_unmap(VMA *vma); VIRTMEM_API void vma_unmap(VMA *vma);
/* what to do at writeout */ /* what to do at writeout */
...@@ -256,7 +268,7 @@ enum WriteoutFlags { ...@@ -256,7 +268,7 @@ enum WriteoutFlags {
* it's an error for a given fileh to modify its pages while writeout is in * it's an error for a given fileh to modify its pages while writeout is in
* progress: until fileh_dirty_writeout(... | WRITEOUT_STORE) has finished. * progress: until fileh_dirty_writeout(... | WRITEOUT_STORE) has finished.
*/ */
int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags); VIRTMEM_API int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags);
/* discard changes made to fileh memory /* discard changes made to fileh memory
...@@ -270,7 +282,7 @@ int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags); ...@@ -270,7 +282,7 @@ int fileh_dirty_writeout(BigFileH *fileh, enum WriteoutFlags flags);
* it's an error for a given fileh to call fileh_dirty_discard() while writeout * it's an error for a given fileh to call fileh_dirty_discard() while writeout
* is in progress. * is in progress.
*/ */
void fileh_dirty_discard(BigFileH *fileh); VIRTMEM_API void fileh_dirty_discard(BigFileH *fileh);
...@@ -287,7 +299,7 @@ void fileh_dirty_discard(BigFileH *fileh); ...@@ -287,7 +299,7 @@ void fileh_dirty_discard(BigFileH *fileh);
* it's an error to call fileh_invalidate_page() while writeout for fileh is in * it's an error to call fileh_invalidate_page() while writeout for fileh is in
* progress. * progress.
*/ */
void fileh_invalidate_page(BigFileH *fileh, pgoff_t pgoffset); VIRTMEM_API void fileh_invalidate_page(BigFileH *fileh, pgoff_t pgoffset);
/* pagefault handler /* pagefault handler
......
...@@ -33,22 +33,6 @@ import sys ...@@ -33,22 +33,6 @@ import sys
_bigfile = PyGoExt('wendelin.bigfile._bigfile', _bigfile = PyGoExt('wendelin.bigfile._bigfile',
sources = [ sources = [
'bigfile/_bigfile.c', 'bigfile/_bigfile.c',
## TODO split -> libvirtmem
#'bigfile/pagefault.c',
#'bigfile/pagemap.c',
#'bigfile/ram.c',
#'bigfile/ram_shmfs.c',
#'bigfile/ram_hugetlbfs.c',
#'bigfile/virtmem.c',
#'lib/bug.c',
#'lib/utils.c',
## TODO split -> libwcfs
#'wcfs/internal/_wcfs.pyx',
#'wcfs/internal/wcfs_virtmem.cpp',
#'wcfs/internal/wcfs_watchlink.cpp',
#'wcfs/internal/wcfs_misc.cpp',
], ],
include_dirs = [ include_dirs = [
'./include', './include',
...@@ -255,11 +239,11 @@ setup( ...@@ -255,11 +239,11 @@ setup(
'./3rdparty/ccan', './3rdparty/ccan',
'./3rdparty/include' './3rdparty/include'
], ],
define_macros = [('_GNU_SOURCE',None)], # XXX dup define_macros = [('_GNU_SOURCE',None), ('BUILDING_LIBVIRTMEM',None)], # XXX dup
extra_compile_args = [ # XXX dup extra_compile_args = [ # XXX dup
'-std=gnu99', # declarations inside for-loop '-std=gnu99', # declarations inside for-loop
'-fplan9-extensions', # anonymous-structs + simple inheritance '-fplan9-extensions', # anonymous-structs + simple inheritance
'-fvisibility=hidden', # by default symbols not visible outside DSO #'-fvisibility=hidden', # by default symbols not visible outside DSO XXX reenable
# # in C99 declaration after statement is ok, and we explicitly compile with -std=gnu99. # # in C99 declaration after statement is ok, and we explicitly compile with -std=gnu99.
# # Python >= 3.4 however adds -Werror=declaration-after-statement even for extension # # Python >= 3.4 however adds -Werror=declaration-after-statement even for extension
......
...@@ -229,16 +229,16 @@ void _Conn::_pin1(PinReq *req) { ...@@ -229,16 +229,16 @@ void _Conn::_pin1(PinReq *req) {
//trace("\tremmapblk %d @%s" % (req->blk, (h(req.at) if req.at else "head"))) //trace("\tremmapblk %d @%s" % (req->blk, (h(req.at) if req.at else "head")))
// check if virtmem did not dirtied page corresponding to this block already // check if virtmem did not dirtied page corresponding to this block already
// XXX reenable (link to libbigfile dso) // XXX reenable (link to libbigfile dso)
#if 0
virt_lock(); virt_lock();
#if 0
TODO (mmap->file->blksize != mmap->fileh->ramh->ram->pagesize); TODO (mmap->file->blksize != mmap->fileh->ramh->ram->pagesize);
if (!__fileh_page_isdirty(mmap->fileh, req->blk)) { if (!__fileh_page_isdirty(mmap->fileh, req->blk)) {
#endif #endif
mmap->_remmapblk(req->blk, req->at); // XXX err mmap->_remmapblk(req->blk, req->at); // XXX err
#if 0 #if 0
} }
virt_unlock();
#endif #endif
virt_unlock();
//trace("\t-> remmaped"); XXX //trace("\t-> remmaped"); XXX
} }
......
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