#include #include #include "linked_list.h" typedef struct PageInfo { int key; void *data; } PageInfo; typedef struct MMap { void *memory; int size; int count; PageInfo *support; linkedList *free_list; linkedList *alloc_list; FILE *swap; } MMap; MMap* mmap_init(); void mmap_clean(MMap *mmap); PageInfo* page_alloc(MMap *mmap); PageInfo* page_free(MMap *mmap); int check_page_free_list(MMap *mmap); int check_page_alloc(MMap *mmap); int move_to_swap(MMap *mmap, PageInfo *page); PageInfo* read_from_swap(MMap* mmap, PageInfo *page); PageInfo *page_lookup(MMap *mmap, int key); void page_remove(MMap *mmap, int key); PageInfo *page_create(MMap *mmap, bool *moved_to_swap);