aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/user/pager.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/kernel/user/pager.c')
-rw-r--r--src/kernel/user/pager.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/kernel/user/pager.c b/src/kernel/user/pager.c
index 79f293b..b9233b0 100644
--- a/src/kernel/user/pager.c
+++ b/src/kernel/user/pager.c
@@ -26,7 +26,7 @@ pager_ops_t swap_pager_ops = {
.resize = swap_pager_resize,
};
-pager_t *new_swap_pager(size_t size) {
+pager_t *new_swap_pager(size_t size, bool allow_resize) {
pager_t *p = (pager_t*)malloc(sizeof(pager_t));
if (p == 0) return 0;
@@ -38,6 +38,8 @@ pager_t *new_swap_pager(size_t size) {
p->lock = MUTEX_UNLOCKED;
p->maps = 0;
+ p->swap_pager.allow_resize = allow_resize;
+
return p;
error:
@@ -86,6 +88,8 @@ void swap_page_release(pager_t *p, size_t offset, size_t len) {
}
bool swap_pager_resize(pager_t *p, size_t new_size) {
+ if (!p->swap_pager.allow_resize) return false;
+
// later : remove unused pages in swap file
return true;