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
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Joshua
wendelin.core
Commits
a36a24a0
Commit
a36a24a0
authored
Feb 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
862d57af
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
54 additions
and
36 deletions
+54
-36
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+34
-20
wcfs/client/wcfs.h
wcfs/client/wcfs.h
+4
-0
wcfs/client/wcfs_misc.cpp
wcfs/client/wcfs_misc.cpp
+3
-3
wcfs/client/wcfs_misc.h
wcfs/client/wcfs_misc.h
+12
-12
wcfs/client/wcfs_watchlink.cpp
wcfs/client/wcfs_watchlink.cpp
+1
-1
No files found.
wcfs/client/wcfs.cpp
View file @
a36a24a0
...
@@ -121,10 +121,12 @@ error _Conn::close() {
...
@@ -121,10 +121,12 @@ error _Conn::close() {
wconn
.
_atMu
.
RLock
();
wconn
.
_atMu
.
RLock
();
defer
([
&
]()
{
defer
([
&
]()
{
wconn
.
_atMu
.
RUnlock
();
wconn
.
_atMu
.
RUnlock
();
});
});
xerr
::
Contextf
E
(
"wcfs %s: close conn @%s"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
));
xerr
::
Contextf
E
(
"%s: close"
,
v
(
wconn
));
// xerr::Contextf E("wcfs %s: close %s", v(wconn._wc->mountpoint), v(wconn.at));
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
// XXX + conn # e.g. from wconn._wlink.id? or wlink.close should include its id itself?
// (or ._wlink._f.fd() ?)
// (or ._wlink._f.fd() ?)
...
@@ -793,6 +795,36 @@ static error mmap_into_ro(void *addr, size_t size, os::File f, off_t offset) {
...
@@ -793,6 +795,36 @@ static error mmap_into_ro(void *addr, size_t size, os::File f, off_t offset) {
}
}
// _assertVMAOk() verifies that mmap and vma are related to each other and cover
// exactly the same virtual memory rane.
//
// It panics if mmap and vma do not exactly relate to each other or cover
// different virtual memory range.
void
_Mapping
::
_assertVMAOk
()
{
_Mapping
*
mmap
=
this
;
VMA
*
vma
=
mmap
->
vma
;
if
(
!
(
vma
->
mmap_overlay_server
==
static_cast
<
void
*>
(
mmap
)))
panic
(
"BUG: mmap and vma do not link to each other"
);
if
(
!
(
vma
->
addr_start
==
uintptr_t
(
mmap
->
mem_start
)
&&
vma
->
addr_stop
==
uintptr_t
(
mmap
->
mem_stop
)))
panic
(
"BUG: mmap and vma cover different virtual memory ranges"
);
// verified ok
}
string
WCFS
::
String
()
const
{
const
WCFS
&
wc
=
*
this
;
return
fmt
::
sprintf
(
"wcfs %s"
,
v
(
wc
.
mountpoint
));
}
string
_Conn
::
String
()
const
{
const
_Conn
&
wconn
=
*
this
;
return
""
;
// XXX temp
//return fmt::sprintf("%s: conn%d @%s", v(wconn._wc), wconn._wlink->_f.fd(), v(wconn.at));
}
_Conn
::
_Conn
()
{}
_Conn
::
_Conn
()
{}
_Conn
::~
_Conn
()
{}
_Conn
::~
_Conn
()
{}
void
_Conn
::
decref
()
{
void
_Conn
::
decref
()
{
...
@@ -814,24 +846,6 @@ void _Mapping::decref() {
...
@@ -814,24 +846,6 @@ void _Mapping::decref() {
delete
this
;
delete
this
;
}
}
// _assertVMAOk() verifies that mmap and vma are related to each other and cover
// exactly the same virtual memory rane.
//
// It panics if mmap and vma do not exactly relate to each other or cover
// different virtual memory range.
void
_Mapping
::
_assertVMAOk
()
{
_Mapping
*
mmap
=
this
;
VMA
*
vma
=
mmap
->
vma
;
if
(
!
(
vma
->
mmap_overlay_server
==
static_cast
<
void
*>
(
mmap
)))
panic
(
"BUG: mmap and vma do not link to each other"
);
if
(
!
(
vma
->
addr_start
==
uintptr_t
(
mmap
->
mem_start
)
&&
vma
->
addr_stop
==
uintptr_t
(
mmap
->
mem_stop
)))
panic
(
"BUG: mmap and vma cover different virtual memory ranges"
);
// verified ok
}
dict
<
int64_t
,
zodb
::
Tid
>
_tfileh_pinned
(
FileH
fileh
)
{
dict
<
int64_t
,
zodb
::
Tid
>
_tfileh_pinned
(
FileH
fileh
)
{
return
fileh
->
_pinned
;
return
fileh
->
_pinned
;
}
}
...
...
wcfs/client/wcfs.h
View file @
a36a24a0
...
@@ -149,6 +149,8 @@ struct WCFS {
...
@@ -149,6 +149,8 @@ struct WCFS {
string
_path
(
const
string
&
obj
);
string
_path
(
const
string
&
obj
);
tuple
<
os
::
File
,
error
>
_open
(
const
string
&
path
,
int
flags
=
O_RDONLY
);
tuple
<
os
::
File
,
error
>
_open
(
const
string
&
path
,
int
flags
=
O_RDONLY
);
pair
<
WatchLink
,
error
>
_openwatch
();
pair
<
WatchLink
,
error
>
_openwatch
();
string
String
()
const
;
};
};
// Conn represents logical connection that provides view of data on wcfs
// Conn represents logical connection that provides view of data on wcfs
...
@@ -202,6 +204,8 @@ public:
...
@@ -202,6 +204,8 @@ public:
error
close
();
error
close
();
error
resync
(
zodb
::
Tid
at
);
error
resync
(
zodb
::
Tid
at
);
string
String
()
const
;
private:
private:
error
_pinner
(
context
::
Context
ctx
);
error
_pinner
(
context
::
Context
ctx
);
error
__pinner
(
context
::
Context
ctx
);
error
__pinner
(
context
::
Context
ctx
);
...
...
wcfs/client/wcfs_misc.cpp
View file @
a36a24a0
...
@@ -282,12 +282,12 @@ void __Logf(const char *file, int line, char level, const char *format, ...) {
...
@@ -282,12 +282,12 @@ void __Logf(const char *file, int line, char level, const char *format, ...) {
// wcfs::
// wcfs::
namespace
wcfs
{
namespace
wcfs
{
template
<
>
string
v_
(
error
err
)
{
template
<
>
string
v_
(
const
error
&
err
)
{
return
(
err
!=
nil
)
?
err
->
Error
()
:
"nil"
;
return
(
err
!=
nil
)
?
err
->
Error
()
:
"nil"
;
}
}
static
string
h016
(
uint64_t
v
)
{
return
fmt
::
sprintf
(
"%016lx"
,
v
);
}
static
string
h016
(
uint64_t
v
)
{
return
fmt
::
sprintf
(
"%016lx"
,
v
);
}
template
<
>
string
v_
(
zodb
::
Tid
tid
)
{
return
h016
(
tid
);
}
template
<
>
string
v_
(
const
zodb
::
Tid
&
tid
)
{
return
h016
(
tid
);
}
//template<> string v_(zodb::Oid oid) { return h016(oid); }
//template<> string v_(zodb::Oid oid) { return h016(oid); }
// XXX Tid and Oid are typedefs for uint64_t and C++ reduces template
// XXX Tid and Oid are typedefs for uint64_t and C++ reduces template
// specializations to the underlying type. This providing specialization for
// specializations to the underlying type. This providing specialization for
...
...
wcfs/client/wcfs_misc.h
View file @
a36a24a0
...
@@ -190,23 +190,23 @@ const zodb::Tid TidHead = -1ULL;
...
@@ -190,23 +190,23 @@ const zodb::Tid TidHead = -1ULL;
// NOTE returned char* pointer is guaranteed to stay valid only till end of
// NOTE returned char* pointer is guaranteed to stay valid only till end of
// current expression. For example
// current expression. For example
//
//
//
printf("hello %s", v(obj))
//
printf("hello %s", v(obj))
//
//
// is valid, while
// is valid, while
//
//
//
x = v(obj);
//
x = v(obj);
//
use(x);
//
use(x);
//
//
// is not valid.
// is not valid.
#define v(obj)
(wcfs::v_(obj).c_str())
#define v(obj)
(wcfs::v_(obj).c_str())
template
<
typename
T
>
string
v_
(
T
obj
)
{
template
<
typename
T
>
string
v_
(
T
*
obj
)
{
return
obj
->
String
();
}
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
<
>
inline
string
v_
(
string
s
)
{
return
s
;
}
// XXX -> const string& ?
template
<
>
inline
string
v_
(
const
string
&
s
)
{
return
s
;
}
template
<
>
string
v_
(
error
);
template
<
>
string
v_
(
const
error
&
);
template
<
>
string
v_
(
zodb
::
Tid
);
template
<
>
string
v_
(
const
zodb
::
Tid
&
);
template
<
>
string
v_
(
zodb
::
Oid
);
template
<
>
string
v_
(
const
zodb
::
Oid
&
);
}
// wcfs::
}
// wcfs::
...
...
wcfs/client/wcfs_watchlink.cpp
View file @
a36a24a0
...
@@ -42,7 +42,7 @@ void _WatchLink::decref() {
...
@@ -42,7 +42,7 @@ void _WatchLink::decref() {
// _openwatch opens new watch link on wcfs.
// _openwatch opens new watch link on wcfs.
pair
<
WatchLink
,
error
>
WCFS
::
_openwatch
()
{
pair
<
WatchLink
,
error
>
WCFS
::
_openwatch
()
{
WCFS
*
wc
=
this
;
WCFS
*
wc
=
this
;
xerr
::
Contextf
E
(
"
wcfs %s: openwatch"
,
v
(
wc
->
mountpoint
));
xerr
::
Contextf
E
(
"
%s: openwatch"
,
v
(
wc
));
// head/watch handle.
// head/watch handle.
os
::
File
f
;
os
::
File
f
;
...
...
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