refactor: document shared_file_page

This commit is contained in:
2024-12-06 15:35:23 +00:00
parent 3d6e30119b
commit f64b92bbfa

View File

@@ -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);