#ifndef VM_MMAP_H #define VM_MMAP_H #include #include "filesys/off_t.h" #include "lib/user/syscall.h" /* we use the same structure as fd_table thus the capacity is fixed to 1024 (PGSIZE/4) */ struct mmap_table { struct mmap_table_entry **ids; int id_free; /* lowest-index free */ int id_max; /* highest-index used */ int id_cap; /* mmap table capacity */ }; /* a single entry in the mmap table */ struct mmap_table_entry { void *addr; struct file *file; }; bool mmap_table_init (struct mmap_table *table); void mmap_table_free (struct mmap_table *table); mapid_t mmap_table_insert (struct mmap_table *table, void *addr, struct file *file, off_t len); bool mmap_table_remove (struct mmap_table *table, mapid_t mapping); #endif