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
1f8ad317
Commit
1f8ad317
authored
Feb 19, 2020
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
a0062f59
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
14 additions
and
14 deletions
+14
-14
wcfs/client/wcfs.cpp
wcfs/client/wcfs.cpp
+8
-9
wcfs/client/wcfs_misc.cpp
wcfs/client/wcfs_misc.cpp
+1
-1
wcfs/client/wcfs_misc.h
wcfs/client/wcfs_misc.h
+5
-4
No files found.
wcfs/client/wcfs.cpp
View file @
1f8ad317
...
@@ -330,7 +330,7 @@ error _Conn::__pin1(PinReq *req) {
...
@@ -330,7 +330,7 @@ error _Conn::__pin1(PinReq *req) {
pair
<
FileH
,
error
>
_Conn
::
open
(
zodb
::
Oid
foid
)
{
pair
<
FileH
,
error
>
_Conn
::
open
(
zodb
::
Oid
foid
)
{
_Conn
&
wconn
=
*
this
;
_Conn
&
wconn
=
*
this
;
error
err
;
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 wconn._atMu.RLock()
// XXX defer wconn._atMu.RUnlock()
// XXX defer wconn._atMu.RUnlock()
...
@@ -429,7 +429,7 @@ error _FileH::_open() {
...
@@ -429,7 +429,7 @@ error _FileH::_open() {
error
_FileH
::
close
()
{
error
_FileH
::
close
()
{
_FileH
&
fileh
=
*
this
;
_FileH
&
fileh
=
*
this
;
Conn
wconn
=
fileh
.
wconn
;
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 change all fileh.mmaps to cause EFAULT on any access after fileh.close
// XXX "watch foid -" -> wconn.wlink (stop watchingthe file)
// XXX "watch foid -" -> wconn.wlink (stop watchingthe file)
...
@@ -452,8 +452,7 @@ error _FileH::close() {
...
@@ -452,8 +452,7 @@ error _FileH::close() {
// virtmem calls FileH::mmap under virtmem lock when virtmem fileh is mmapped into vma.
// 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
)
{
pair
<
Mapping
,
error
>
_FileH
::
mmap
(
int64_t
blk_start
,
int64_t
blk_len
,
VMA
*
vma
)
{
_FileH
&
f
=
*
this
;
_FileH
&
f
=
*
this
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: mmap f<%s> [blk%ld +blk%ld)"
,
xerr
::
Contextf
E
(
"%s: mmap f<%s> [blk%ld +blk%ld)"
,
v
(
f
.
wconn
),
v
(
f
.
foid
),
blk_start
,
blk_len
);
v
(
f
.
wconn
->
_wc
->
mountpoint
),
v
(
f
.
wconn
->
at
),
v
(
f
.
foid
),
blk_start
,
blk_len
);
error
err
;
error
err
;
...
@@ -541,8 +540,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
...
@@ -541,8 +540,7 @@ pair<Mapping, error> _FileH::mmap(int64_t blk_start, int64_t blk_len, VMA *vma)
error
_Mapping
::
unmap
()
{
error
_Mapping
::
unmap
()
{
Mapping
mmap
=
newref
(
this
);
// XXX newref for std::remove
Mapping
mmap
=
newref
(
this
);
// XXX newref for std::remove
FileH
f
=
mmap
->
fileh
;
FileH
f
=
mmap
->
fileh
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: f<%s>: unmap"
,
xerr
::
Contextf
E
(
"%s: f<%s>: unmap"
,
v
(
f
->
wconn
),
v
(
f
->
foid
));
v
(
f
->
wconn
->
_wc
->
mountpoint
),
v
(
f
->
wconn
->
at
),
v
(
f
->
foid
));
// NOTE virtmem lock is held by virtmem caller
// NOTE virtmem lock is held by virtmem caller
// XXX locking
// XXX locking
...
@@ -576,12 +574,13 @@ error _Mapping::unmap() {
...
@@ -576,12 +574,13 @@ error _Mapping::unmap() {
// resync resyncs connection and its mappings onto different database view.
// resync resyncs connection and its mappings onto different database view.
error
_Conn
::
resync
(
zodb
::
Tid
at
)
{
error
_Conn
::
resync
(
zodb
::
Tid
at
)
{
_Conn
&
wconn
=
*
this
;
_Conn
&
wconn
=
*
this
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: resync -> @%s"
,
v
(
wconn
.
_wc
->
mountpoint
),
v
(
wconn
.
at
),
v
(
at
));
// XXX locking
// XXX locking
// wconn.atMu.Lock()
// wconn.atMu.Lock()
// defer wconn.atMu.Unlock()
// defer wconn.atMu.Unlock()
xerr
::
Contextf
E
(
"%s: resync -> @%s"
,
v
(
wconn
),
v
(
at
));
error
err
;
error
err
;
// wconn._downMu.lock(); XXX
// wconn._downMu.lock(); XXX
...
@@ -660,8 +659,7 @@ error _Conn::resync(zodb::Tid at) {
...
@@ -660,8 +659,7 @@ error _Conn::resync(zodb::Tid at) {
error
_Mapping
::
_remmapblk
(
int64_t
blk
,
zodb
::
Tid
at
)
{
error
_Mapping
::
_remmapblk
(
int64_t
blk
,
zodb
::
Tid
at
)
{
_Mapping
*
mmap
=
this
;
_Mapping
*
mmap
=
this
;
FileH
f
=
mmap
->
fileh
;
FileH
f
=
mmap
->
fileh
;
xerr
::
Contextf
E
(
"wcfs %s: conn @%s: f<%s>: remmapblk #%ld @%s"
,
xerr
::
Contextf
E
(
"%s: f<%s>: remmapblk #%ld @%s"
,
v
(
f
->
wconn
),
v
(
f
->
foid
),
blk
,
v
(
at
));
v
(
f
->
wconn
->
_wc
->
mountpoint
),
v
(
f
->
wconn
->
at
),
v
(
f
->
foid
),
blk
,
v
(
at
));
ASSERT
(
mmap
->
blk_start
<=
blk
&&
blk
<
mmap
->
blk_stop
());
ASSERT
(
mmap
->
blk_start
<=
blk
&&
blk
<
mmap
->
blk_stop
());
error
err
;
error
err
;
...
@@ -819,6 +817,7 @@ string WCFS::String() const {
...
@@ -819,6 +817,7 @@ string WCFS::String() const {
return
fmt
::
sprintf
(
"wcfs %s"
,
v
(
wc
.
mountpoint
));
return
fmt
::
sprintf
(
"wcfs %s"
,
v
(
wc
.
mountpoint
));
}
}
// NOTE String must be called with Conn.atMu locked.
string
_Conn
::
String
()
const
{
string
_Conn
::
String
()
const
{
const
_Conn
&
wconn
=
*
this
;
const
_Conn
&
wconn
=
*
this
;
return
fmt
::
sprintf
(
"%s: conn%d @%s"
,
v
(
wconn
.
_wc
),
wconn
.
_wlink
->
fd
(),
v
(
wconn
.
at
));
return
fmt
::
sprintf
(
"%s: conn%d @%s"
,
v
(
wconn
.
_wc
),
wconn
.
_wlink
->
fd
(),
v
(
wconn
.
at
));
...
...
wcfs/client/wcfs_misc.cpp
View file @
1f8ad317
...
@@ -282,7 +282,7 @@ void __Logf(const char *file, int line, char level, const char *format, ...) {
...
@@ -282,7 +282,7 @@ void __Logf(const char *file, int line, char level, const char *format, ...) {
// wcfs::
// wcfs::
namespace
wcfs
{
namespace
wcfs
{
template
<
>
string
v_
(
const
error
&
err
)
{
template
<
>
string
v_
(
error
err
)
{
return
(
err
!=
nil
)
?
err
->
Error
()
:
"nil"
;
return
(
err
!=
nil
)
?
err
->
Error
()
:
"nil"
;
}
}
...
...
wcfs/client/wcfs_misc.h
View file @
1f8ad317
...
@@ -199,12 +199,13 @@ const zodb::Tid TidHead = -1ULL;
...
@@ -199,12 +199,13 @@ const zodb::Tid TidHead = -1ULL;
//
//
// 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
)
{
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_
(
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
<
>
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
::
Tid
&
);
template
<
>
string
v_
(
const
zodb
::
Oid
&
);
template
<
>
string
v_
(
const
zodb
::
Oid
&
);
...
...
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