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
fc4ab83b
Commit
fc4ab83b
authored
Oct 22, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
1264e9fa
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
28 additions
and
15 deletions
+28
-15
wcfs/internal/wcfs_misc.cpp
wcfs/internal/wcfs_misc.cpp
+8
-5
wcfs/internal/wcfs_misc.h
wcfs/internal/wcfs_misc.h
+8
-2
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+12
-8
No files found.
wcfs/internal/wcfs_misc.cpp
View file @
fc4ab83b
...
...
@@ -19,16 +19,18 @@
#include "wcfs_misc.h"
error
osfile
::
close
()
{
osfile
*
f
=
this
;
namespace
os
{
error
File
::
close
()
{
File
*
f
=
this
;
int
err
=
close
(
f
->
fd
);
if
(
err
!=
0
)
return
f
->
_errno
(
"close"
);
}
error
osf
ile
::
stat
(
struct
stat
*
st
)
{
osf
ile
*
f
=
this
;
error
F
ile
::
stat
(
struct
stat
*
st
)
{
F
ile
*
f
=
this
;
int
err
=
fstat
(
f
->
fd
,
st
);
if
(
err
!=
0
)
...
...
@@ -38,7 +40,8 @@ error osfile::stat(struct stat *st) {
// _errno returns error corresponding to op and errno.
error
osf
ile
::
_err
(
const
char
*
op
)
{
error
F
ile
::
_err
(
const
char
*
op
)
{
return
errorf
(
"%s %s: %s"
,
op
,
f
->
path
,
strerror_r
(
errno
));
}
}
// os::
wcfs/internal/wcfs_misc.h
View file @
fc4ab83b
...
...
@@ -39,9 +39,11 @@ struct error {
}
};
// osfile mimics os.File from Go.
namespace
os
{
// os::File mimics os.File from Go.
// its operations return error with full file context.
struct
osf
ile
{
struct
F
ile
{
int
fd
;
string
path
;
...
...
@@ -49,4 +51,8 @@ struct osfile {
error
stat
(
struct
stat
*
st
);
};
// XXX tuple<File, error> open(const string &path)
}
// os::
#endif
wcfs/internal/wcfs_virtmem.cpp
View file @
fc4ab83b
...
...
@@ -36,6 +36,10 @@ using namespace golang;
#include <unordered_map>
#include <vector>
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <stdint.h>
...
...
@@ -96,7 +100,7 @@ struct _File {
Conn
*
wconn
;
Oid
foid
;
// hex of ZBigFile root object ID
size_t
blksize
;
// block size of this file
// .headf
file object of head/file
os
::
File
headf
;
//
file object of head/file
// .headfsize head/file size is known to be at least headfsize (size ↑=)
dict
<
int64_t
,
Tid
>
pinned
;
// {} blk -> rev that wcfs already sent us for this file
vector
<
_Mapping
*>
mmaps
;
// []_Mapping ↑blk_start mappings of this file
...
...
@@ -235,18 +239,18 @@ void _Mapping::_remmapblk(int64_t blk, Tid at) {
_File
*
f
=
mmap
->
file
;
uint8_t
*
blkmem
=
mmap
->
mem_start
+
(
blk
-
mmap
->
blk_start
)
*
f
->
blksize
;
os
f
ile
fsfile
;
os
::
F
ile
fsfile
;
if
(
at
==
TidHead
)
{
fsfile
=
f
->
headf
;
}
else
{
// TODO share @rev fd until wconn is resynced?
fsfile
=
f
->
wconn
->
_wc
.
_open
(
"@%s/bigfile/%s"
%
(
h
(
at
),
h
(
f
->
foid
)),
"rb"
)
fsfile
=
f
->
wconn
->
_wc
->
_open
(
"@%s/bigfile/%s"
%
(
h
(
at
),
h
(
f
->
foid
)),
"rb"
)
defer
(
fsfile
.
close
)
}
struct
stat
st
;
err
=
fsfile
.
stat
(
&
st
);
auto
err
=
fsfile
.
stat
(
&
st
);
if
(
err
!=
nil
)
return
err
;
ASSERT
(
st
.
st_blksize
==
f
->
blksize
);
// FIXME assert
...
...
@@ -257,6 +261,6 @@ void _Mapping::_remmapblk(int64_t blk, Tid at) {
}
// block is inside file - mmap file data
else
{
mm
.
map_into_ro
(
blkmem
,
fsfile
.
f
ileno
()
,
blk
*
f
->
blksize
);
mm
.
map_into_ro
(
blkmem
,
fsfile
.
f
d
,
blk
*
f
->
blksize
);
}
}
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