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
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
Kirill Smelkov
wendelin.core
Commits
311f9ff6
Commit
311f9ff6
authored
Nov 01, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
71d54d36
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
3 deletions
+10
-3
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+10
-3
No files found.
wcfs/internal/wcfs_virtmem.cpp
View file @
311f9ff6
...
...
@@ -60,6 +60,7 @@ const Tid TidHead = -1ULL;
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
);
static
error
mmap_into_ro
(
void
*
addr
,
size_t
size
,
const
os
::
File
&
f
,
off_t
offset
);
// XXX ok?
struct
IContext
{
...
...
@@ -423,7 +424,7 @@ error Conn::resync(Tid at) {
mmap
->
mem_start
+
(
headfsize
-
mmap
->
blk_start
*
f
.
blksize
));
if
(
mem_unzero_stop
-
mem_unzero_start
>
0
)
{
err
=
mm
::
map_into
(
mem_unzero_start
,
mem_unzero_stop
-
mem_unzero_start
,
PROT_READ
,
MAP_SHARED
,
f
.
headf
,
f
.
headfsize
);
err
=
mm
ap_into_ro
(
mem_unzero_start
,
mem_unzero_stop
-
mem_unzero_start
,
f
.
headf
,
f
.
headfsize
);
if
(
err
!=
nil
)
return
err
;
}
...
...
@@ -494,7 +495,7 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
}
// block is inside file - mmap file data
else
{
err
=
mm
::
map_into
(
blkmem
,
1
*
f
->
blksize
,
PROT_READ
,
MAP_SHARED
,
fsfile
,
blk
*
f
->
blksize
);
err
=
mm
ap_into_ro
(
blkmem
,
1
*
f
->
blksize
,
fsfile
,
blk
*
f
->
blksize
);
if
(
err
!=
nil
)
return
err
;
}
...
...
@@ -899,7 +900,7 @@ static string h(uint64_t v) {
return
fmt
::
sprintf
(
"%016lx"
,
v
);
}
// map_zero_ro mmaps read-only zeros into [addr +size) so that region as all zeros.
// m
m
ap_zero_ro mmaps read-only zeros into [addr +size) so that region as all zeros.
// created mapping, even after it is accessed, does not consume memory.
static
error
_mmap_zero_into_ro
(
void
*
addr
,
size_t
size
);
static
error
mmap_zero_into_ro
(
void
*
addr
,
size_t
size
)
{
...
...
@@ -924,3 +925,9 @@ static error _mmap_zero_into_ro(void *addr, size_t size) {
return
err
;
return
nil
;
}
// mmap_into_ro mmaps read-only fd[offset +size) into [addr +size).
// The mapping is created with MAP_SHARED.
static
error
mmap_into_ro
(
void
*
addr
,
size_t
size
,
const
os
::
File
&
f
,
off_t
offset
)
{
return
mm
::
map_into
(
addr
,
size
,
PROT_READ
,
MAP_SHARED
,
f
,
offset
);
}
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