Commit 1f8ad317 authored by Kirill Smelkov's avatar Kirill Smelkov

.

parent a0062f59
......@@ -330,7 +330,7 @@ error _Conn::__pin1(PinReq *req) {
pair<FileH, error> _Conn::open(zodb::Oid foid) {
_Conn& wconn = *this;
error err;
xerr::Contextf E("wcfs %s: conn @%s: open f<%s>", v(wconn._wc->mountpoint), v(wconn.at), v(foid));
xerr::Contextf E("%s: open f<%s>", v(wconn), v(foid));
// XXX wconn._atMu.RLock()
// XXX defer wconn._atMu.RUnlock()
......@@ -429,7 +429,7 @@ error _FileH::_open() {
error _FileH::close() {
_FileH& fileh = *this;
Conn wconn = fileh.wconn;
xerr::Contextf E("wcfs %s: conn @%s: close f<%s>", v(wconn->_wc->mountpoint), v(wconn->at), v(fileh.foid));
xerr::Contextf E("%s: close f<%s>", v(wconn), v(fileh.foid));
// XXX change all fileh.mmaps to cause EFAULT on any access after fileh.close
// XXX "watch foid -" -> wconn.wlink (stop watchingthe file)
......@@ -452,8 +452,7 @@ error _FileH::close() {
// virtmem calls FileH::mmap under virtmem lock when virtmem fileh is mmapped into vma.
pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma) {
_FileH& f = *this;
xerr::Contextf E("wcfs %s: conn @%s: mmap f<%s> [blk%ld +blk%ld)",
v(f.wconn->_wc->mountpoint), v(f.wconn->at), v(f.foid), blk_start, blk_len);
xerr::Contextf E("%s: mmap f<%s> [blk%ld +blk%ld)", v(f.wconn), v(f.foid), blk_start, blk_len);
error err;
......@@ -541,8 +540,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
error _Mapping::unmap() {
Mapping mmap = newref(this); // XXX newref for std::remove
FileH f = mmap->fileh;
xerr::Contextf E("wcfs %s: conn @%s: f<%s>: unmap",
v(f->wconn->_wc->mountpoint), v(f->wconn->at), v(f->foid));
xerr::Contextf E("%s: f<%s>: unmap", v(f->wconn), v(f->foid));
// NOTE virtmem lock is held by virtmem caller
// XXX locking
......@@ -576,12 +574,13 @@ error _Mapping::unmap() {
// resync resyncs connection and its mappings onto different database view.
error _Conn::resync(zodb::Tid at) {
_Conn& wconn = *this;
xerr::Contextf E("wcfs %s: conn @%s: resync -> @%s", v(wconn._wc->mountpoint), v(wconn.at), v(at));
// XXX locking
// wconn.atMu.Lock()
// defer wconn.atMu.Unlock()
xerr::Contextf E("%s: resync -> @%s", v(wconn), v(at));
error err;
// wconn._downMu.lock(); XXX
......@@ -660,8 +659,7 @@ error _Conn::resync(zodb::Tid at) {
error _Mapping::_remmapblk(int64_t blk, zodb::Tid at) {
_Mapping *mmap = this;
FileH f = mmap->fileh;
xerr::Contextf E("wcfs %s: conn @%s: f<%s>: remmapblk #%ld @%s",
v(f->wconn->_wc->mountpoint), v(f->wconn->at), v(f->foid), blk, v(at));
xerr::Contextf E("%s: f<%s>: remmapblk #%ld @%s", v(f->wconn), v(f->foid), blk, v(at));
ASSERT(mmap->blk_start <= blk && blk < mmap->blk_stop());
error err;
......@@ -819,6 +817,7 @@ string WCFS::String() const {
return fmt::sprintf("wcfs %s", v(wc.mountpoint));
}
// NOTE String must be called with Conn.atMu locked.
string _Conn::String() const {
const _Conn& wconn = *this;
return fmt::sprintf("%s: conn%d @%s", v(wconn._wc), wconn._wlink->fd(), v(wconn.at));
......
......@@ -282,7 +282,7 @@ void __Logf(const char *file, int line, char level, const char *format, ...) {
// wcfs::
namespace wcfs {
template<> string v_(const error& err) {
template<> string v_(error err) {
return (err != nil) ? err->Error() : "nil";
}
......
......@@ -199,12 +199,13 @@ const zodb::Tid TidHead = -1ULL;
//
// is not valid.
#define v(obj) (wcfs::v_(obj).c_str())
template<typename T> string v_(T* obj) { return obj->String(); }
template<typename T> string v_(const T* obj) { return obj->String(); }
template<typename T> string v_(const T& obj) { return obj.String(); }
template<typename T> string v_(T* obj) { return obj->String(); }
template<typename T> string v_(const T* obj) { return obj->String(); }
template<typename T> string v_(const T& obj) { return obj.String(); }
template<typename T> string v_(refptr<T> obj) { return obj->String(); }
template<> inline string v_(const string& s) { return s; }
template<> string v_(const error&);
template<> string v_(error);
template<> string v_(const zodb::Tid&);
template<> string v_(const zodb::Oid&);
......
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