Commit 0149d7c8 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent 77cd4f01
......@@ -563,10 +563,13 @@ class ZBigFile(LivePersistent):
wcfileh = None
if _use_wcfs:
# TODO maintain zconn -> wconn in sync (p_jar -> wconn)
zstor = self._p_jar.db().storage
zurl = wcfs.zstor_2zurl(zstor)
wc = wcfs.join(zurl, shared=True)
wcfileh = wc.open(self)
wconn = wc.connect(p_jar.at())
wcfileh = wconn.open(self._p_oid)
#wcfileh_mmap = lambda blk_start, blk_len: wconn.mmap(self._p_oid, blk_start, blk_len)
fileh = _ZBigFileH(self, wcfileh)
self._v_filehset.add(fileh)
......@@ -654,19 +657,14 @@ Connection.open = Connection_open
@implementer(ISynchronizer)
class _ZBigFileH(object):
# .zfile ZBigFile we were opened for
# .wcfileh handle for ZBigFile in wcfs | None
# # .wcfileh handle for ZBigFile in wcfs | None
# .zfileh handle for ZBigFile (overlayed over .wcfileh if .wcfile != ø)
def __init__(self, zfile, wcfileh):
# def __init__(self, zfile, wcfileh):
def __init__(self, zfile, wc): # wc: wcfs.WCFS | None
self.zfile = zfile
self.wcfileh = wcfileh
# FIXME for now we use only wcfs handle
# TODO setup overlaying
if wcfileh is not None:
self.zfileh = wcfileh
else:
# XXX
self.zfileh = zfile._v_file.fileh_open()
# self.wcfileh = wcfileh
self.zfileh = zfile._v_file.fileh_open() # XXX pass wcfileh in
# FIXME zfile._p_jar could be None (ex. ZBigFile is newly created
# before first commit)
......
......@@ -335,7 +335,7 @@ void vma_unmap(VMA *vma)
/* unmap whole vma at once - the kernel unmaps each mapping in turn.
* NOTE error here would mean something is broken */
if (fileh->mmap_overlay) {
fileh->file->file_ops->munmap(fileh->file, vma);
fileh->file->file_ops->munmap(vma, fileh->file);
} else {
xmunmap((void *)vma->addr_start, len);
}
......
......@@ -124,7 +124,7 @@ struct bigfile_ops {
* XXX called under virtmem lock?
* Must not fail.
*/
void (*munmap) (BigFile *file, VMA *vma);
void (*munmap) (VMA *vma, BigFile *file);
/* release is called to release resources associated with file.
......
......@@ -50,11 +50,11 @@ cdef extern from "wcfs_misc.h" namespace "zodb" nogil:
ctypedef uint64_t Tid
ctypedef uint64_t Oid
cdef extern from "wcfs_misc.h" nogil:
cdef extern from "wcfs_misc.h" namespace "wcfs" nogil:
const Tid TidHead
cdef extern from "wcfs_watchlink.h" nogil:
cdef extern from "wcfs_watchlink.h" namespace "wcfs" nogil:
cppclass _WatchLink:
error close()
error closeWrite()
......@@ -85,7 +85,7 @@ cdef extern from "wcfs_watchlink.h" nogil:
error _twlinkwrite(WatchLink wlink, const string& pkt)
cdef extern from "wcfs.h" nogil:
cdef extern from "wcfs.h" namespace "wcfs" nogil:
cppclass WCFS:
string mountpoint
......
......@@ -40,6 +40,9 @@ using std::pair;
#include "wcfs_misc.h"
// wcfs::
namespace wcfs {
struct _File;
struct _Mapping;
struct PinReq;
......@@ -92,6 +95,7 @@ public:
public:
error close();
// XXX move mmap -> _FileH ?
pair<_Mapping*, error> mmap(zodb::Oid foid, int64_t blk_start, int64_t blk_len);
error resync(zodb::Tid at);
......@@ -101,4 +105,6 @@ private:
};
} // wcfs::
#endif
......@@ -149,7 +149,13 @@ typedef uint64_t Oid;
} // zodb::
// wcfs::
namespace wcfs {
// TidHead is invalid Tid which is largest Tid value and means @head.
const zodb::Tid TidHead = -1ULL;
} // wcfs::
#endif
......@@ -29,7 +29,6 @@
#include <wendelin/bigfile/virtmem.h>
#include <wendelin/bigfile/ram.h>
//#include <wendelin/bug.h>
#include <golang/fmt.h>
......@@ -42,12 +41,13 @@
#include <sys/stat.h>
#include <unistd.h>
using std::min;
using std::max;
using std::vector;
// wcfs::
namespace wcfs {
static string h(uint64_t v); // v -> 016x hex representation
#define h_(v) (h(v).c_str())
static error mmap_zero_into_ro(void *addr, size_t size);
......@@ -570,3 +570,6 @@ void _Conn::decref() {
if (__decref())
delete this;
}
} // wcfs::
......@@ -25,6 +25,11 @@
#include <golang/strings.h>
#include <string.h>
// wcfs::
namespace wcfs {
// XXX temp, place, ok=?
const char *v(error err) {
if (err != nil)
......@@ -468,3 +473,6 @@ string rxPkt::to_string() const {
const rxPkt& pkt = *this;
return string(pkt.data, pkt.datalen);
}
} // wcfs::
......@@ -34,6 +34,9 @@ using cxx::set;
#include "wcfs.h"
#include "wcfs_misc.h"
// wcfs::
namespace wcfs {
struct PinReq;
......@@ -131,4 +134,7 @@ struct PinReq {
// for testing
error _twlinkwrite(WatchLink wlink, const string &pkt);
} // wcfs::
#endif
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