28 lines
802 B
C
28 lines
802 B
C
#ifndef VM_MMAP_H
|
|
#define VM_MMAP_H
|
|
|
|
#include <hash.h>
|
|
#include "threads/thread.h"
|
|
#include "filesys/file.h"
|
|
|
|
/* A mapping identifier type. */
|
|
typedef unsigned mapid_t;
|
|
|
|
/* A structure to represent a memory mapped file. */
|
|
struct mmap_entry {
|
|
mapid_t mapping; /* The mapping identifier of the mapped file. */
|
|
struct file *file; /* A pointer to the file that is being mapped. */
|
|
void *upage; /* The start address of the file data in the user VM. */
|
|
|
|
struct hash_elem elem; /* An elem for the hash table. */
|
|
};
|
|
|
|
bool mmap_init (struct thread *t);
|
|
struct mmap_entry *mmap_get (mapid_t mapping);
|
|
struct mmap_entry *mmap_insert (struct file *file, void *upage);
|
|
void mmap_unmap (struct mmap_entry *mmap);
|
|
void mmap_umap_all (void);
|
|
void mmap_destroy (void);
|
|
|
|
#endif /* vm/mmap.h */
|