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
6249dcd1
Commit
6249dcd1
authored
Oct 23, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
160e1e90
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
5 deletions
+22
-5
wcfs/internal/wcfs_virtmem.cpp
wcfs/internal/wcfs_virtmem.cpp
+22
-5
No files found.
wcfs/internal/wcfs_virtmem.cpp
View file @
6249dcd1
...
@@ -239,7 +239,7 @@ void Conn::_pin1(SrvReq *req) {
...
@@ -239,7 +239,7 @@ void Conn::_pin1(SrvReq *req) {
// at=None means unpin to head/ . XXX -> C
// at=None means unpin to head/ . XXX -> C
// NOTE this does not check wrt virtmem already mapped blk as RW.
// NOTE this does not check wrt virtmem already mapped blk as RW.
error
_Mapping
::
_remmapblk
(
int64_t
blk
,
Tid
at
)
{
error
_Mapping
::
_remmapblk
(
int64_t
blk
,
Tid
at
)
{
// XXX err context?
// XXX err context?
blk #<blk> @<at>
_Mapping
*
mmap
=
this
;
_Mapping
*
mmap
=
this
;
ASSERT
(
mmap
->
blk_start
<=
blk
&&
blk
<
mmap
->
blk_stop
());
ASSERT
(
mmap
->
blk_start
<=
blk
&&
blk
<
mmap
->
blk_stop
());
...
@@ -271,16 +271,22 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
...
@@ -271,16 +271,22 @@ error _Mapping::_remmapblk(int64_t blk, Tid at) {
return
err
;
return
err
;
ASSERT
(
st
.
st_blksize
==
f
->
blksize
);
// FIXME assert
ASSERT
(
st
.
st_blksize
==
f
->
blksize
);
// FIXME assert
#if 0
// block is beyond file size - mmap with zeros - else access to memory
//
block is beyond file size - mmap with zeros
(assumes head/f size ↑=)
//
after file.size will raise SIGBUS.
(assumes head/f size ↑=)
if
((
blk
+
1
)
*
f
->
blksize
>
st
.
st_size
)
{
if
((
blk
+
1
)
*
f
->
blksize
>
st
.
st_size
)
{
mm
.
map_zero_into_ro
(
blkmem
);
// XXX err
mm
.
map_zero_into_ro
(
blkmem
);
// XXX err
}
}
// block is inside file - mmap file data
// block is inside file - mmap file data
else
{
else
{
mm.map_into_ro(blkmem, fsfile.fd, blk*f->blksize); // XXX err
mm
.
map_into_ro
(
blkmem
,
fsfile
.
fd
(),
blk
*
f
->
blksize
);
// XXX err
err
=
mmap_into_ro
(
blkmem
,
f
->
blksize
,
fsfile
,
blk
*
f
->
blksize
);
err
=
fsfile
.
mmapfix
(
blkmem
,
f
->
blksize
,
PROT_READ
,
MAP_SHARED
,
blk
*
f
->
blksize
);
mmap
(
blkmem
,
f
->
blksize
,
PROT_READ
,
MAP_FIXED
|
MAP_SHARED
,
fsfile
.
fd
(),
blk
*
f
->
blksize
);
}
}
#endif
return
nil
;
return
nil
;
}
}
...
@@ -308,3 +314,14 @@ tuple<os::File, error> WCFS::_open(const string &path, int flags) {
...
@@ -308,3 +314,14 @@ tuple<os::File, error> WCFS::_open(const string &path, int flags) {
string
h
(
uint64_t
v
)
{
string
h
(
uint64_t
v
)
{
return
fmt
::
sprintf
(
"%016x"
,
v
);
return
fmt
::
sprintf
(
"%016x"
,
v
);
}
}
// map_into_ro memory-maps f.fd[offset +size) as read-only into [addr +size).
// The mapping is created with MAP_SHARED.
error
mmap_into_ro
(
void
*
addr
,
size_t
size
,
const
File
&
f
.
off_t
offset
)
{
void
*
addr2
;
addr2
=
mmap
(
blkmem
,
size
,
PROT_READ
,
MAP_FIXED
|
MAP_SHARED
,
f
.
fd
(),
offset
);
// XXX -> err
// XXX assert addr2 == addr
}
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