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
e7b77669
Commit
e7b77669
authored
Jul 12, 2019
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
9836eede
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
3 deletions
+27
-3
bigfile/tests/test_virtmem.c
bigfile/tests/test_virtmem.c
+15
-1
bigfile/virtmem.c
bigfile/virtmem.c
+5
-2
include/wendelin/bigfile/file.h
include/wendelin/bigfile/file.h
+7
-0
No files found.
bigfile/tests/test_virtmem.c
View file @
e7b77669
...
...
@@ -1125,6 +1125,7 @@ struct BigFileMMap {
BigFile
;
int
fd
;
/* fd of file to mmap */
int
nstoreblk
;
/* number of times storeblk called */
int
nmunmap
;
/* ----//---- munmap called */
};
typedef
struct
BigFileMMap
BigFileMMap
;
...
...
@@ -1184,11 +1185,20 @@ int mmapfile_remmap_blk_read(BigFile *file, blk_t blk, VMA *vma) {
return
0
;
}
void
mmapfile_munmap
(
BigFile
*
file
,
VMA
*
vma
)
{
BigFileMMap
*
f
=
upcast
(
BigFileMMap
*
,
file
);
size_t
len
=
vma
->
addr_stop
-
vma
->
addr_start
;
f
->
nmunmap
++
;
xmunmap
((
void
*
)
vma
->
addr_start
,
len
);
}
static
const
struct
bigfile_ops
mmapfile_ops
=
{
.
loadblk
=
NULL
,
.
storeblk
=
mmapfile_storeblk
,
.
mmap_setup_read
=
mmapfile_mmap_setup_read
,
.
remmap_blk_read
=
mmapfile_remmap_blk_read
,
.
storeblk
=
mmapfile_storeblk
,
.
munmap
=
mmapfile_munmap
,
.
release
=
mmapfile_release
,
};
...
...
@@ -1233,6 +1243,7 @@ void test_file_access_mmapbase(void)
.
file_ops
=
&
mmapfile_ops
,
.
fd
=
fd
,
.
nstoreblk
=
0
,
.
nmunmap
=
0
,
};
/* fstore stores data into file[blk] */
...
...
@@ -1609,7 +1620,10 @@ void test_file_access_mmapbase(void)
/* free resources */
file
.
nmunmap
=
0
;
vma_unmap
(
vma
);
ok1
(
file
.
nmunmap
==
1
);
fileh_close
(
fh
);
ram_close
(
ram
);
free
(
ram
);
...
...
bigfile/virtmem.c
View file @
e7b77669
...
...
@@ -322,8 +322,11 @@ void vma_unmap(VMA *vma)
/* unmap whole vma at once - the kernel unmaps each mapping in turn.
* NOTE error here would mean something is broken */
// XXX overlay: -> notify_unmap
xmunmap
((
void
*
)
vma
->
addr_start
,
len
);
if
(
fileh
->
mmap_overlay
)
{
fileh
->
file
->
file_ops
->
munmap
(
fileh
->
file
,
vma
);
}
else
{
xmunmap
((
void
*
)
vma
->
addr_start
,
len
);
}
/* scan through mapped-to-this-vma pages and release them */
for
(
i
=
0
;
i
<
pglen
;
++
i
)
{
...
...
include/wendelin/bigfile/file.h
View file @
e7b77669
...
...
@@ -102,6 +102,13 @@ struct bigfile_ops {
// XXX error -> bug (must not fail)
int
(
*
remmap_blk_read
)
(
BigFile
*
file
,
blk_t
,
VMA
*
vma
);
/* munmap is called when vma set up via mmap_setup_read is going to be unmapped.
*
* XXX called under virtmem lock?
* Must not fail.
*/
void
(
*
munmap
)
(
BigFile
*
file
,
VMA
*
vma
);
...
...
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