From f64b92bbfaafa1b3341aaec732d24df1137dc1d5 Mon Sep 17 00:00:00 2001 From: Gleb Koval Date: Fri, 6 Dec 2024 15:35:23 +0000 Subject: [PATCH] refactor: document shared_file_page --- src/vm/page.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src/vm/page.h b/src/vm/page.h index 7b45d9d..9aa98fb 100644 --- a/src/vm/page.h +++ b/src/vm/page.h @@ -9,7 +9,6 @@ enum page_type { PAGE_FILE, PAGE_MMAP, - PAGE_EMPTY, PAGE_SHARED }; @@ -35,13 +34,18 @@ struct page_entry struct shared_file_page { - struct file *file; - void *upage; - void *frame; - size_t swap_slot; - int ref_count; + struct file *file; /* The shared file page's source file, used for indexing + the table. */ + void *upage; /* The shared page's upage which is the same across all process + using it. Used for indexing the table. */ + void *frame; /* Set to the frame address of the page when it is in memory. + Set to NULL when the page is in swap. */ + size_t swap_slot; /* Set to the swap_slot of the shared paged if it is + currently in swap. Should not be used when frame is not + NULL.*/ + int ref_count; /* Number of processes that are using this shared page. */ - struct hash_elem elem; + struct hash_elem elem; /* AN elem for the hash table. */ }; bool init_pages (struct hash *pages);