Initialised shared_files global hash table, w/ G

This commit is contained in:
sBubshait
2024-11-30 01:23:33 +00:00
parent ba72345f96
commit f4910bdefb
3 changed files with 17 additions and 6 deletions

View File

@@ -1,15 +1,15 @@
#include "page.h"
#include <string.h>
#include <stdio.h>
#include "filesys/file.h"
#include "threads/malloc.h"
#include "threads/palloc.h"
#include "userprog/process.h"
#include "vm/frame.h"
static struct hash shared_files;
static struct shared_file_entry *shared_file_get (struct file *file);
static unsigned shared_page_hash (const struct hash_elem *e, void *aux UNUSED);
static bool shared_page_less (const struct hash_elem *a_,
const struct hash_elem *b_, void *aux UNUSED);
/* Hashing function needed for the SPT table. Returns a hash for an entry,
based on its upage. */
@@ -135,14 +135,14 @@ shared_file_less (const struct hash_elem *a_, const struct hash_elem *b_,
/* Hashing function needed for the shared pages table. Returns a hash for an
entry based on its user virtual address (upage) pointer. */
unsigned
static unsigned
shared_page_hash (const struct hash_elem *e, void *aux UNUSED)
{
return hash_ptr (hash_entry (e, struct shared_page_entry, elem)->upage);
}
/* Less function needed for the shared pages table. */
bool
static bool
shared_page_less (const struct hash_elem *a_, const struct hash_elem *b_,
void *aux UNUSED)
{
@@ -238,5 +238,5 @@ page_set_swap (struct thread *owner, void *upage, size_t swap_slot)
size_t
page_get_swap (struct thread *owner, void *upage)
{
return 0;
}