summaryrefslogtreecommitdiffstats
path: root/vm/mmap.h
diff options
context:
space:
mode:
Diffstat (limited to 'vm/mmap.h')
-rw-r--r--vm/mmap.h31
1 files changed, 31 insertions, 0 deletions
diff --git a/vm/mmap.h b/vm/mmap.h
new file mode 100644
index 0000000..bee364e
--- /dev/null
+++ b/vm/mmap.h
@@ -0,0 +1,31 @@
1#ifndef VM_MMAP_H
2#define VM_MMAP_H
3
4#include <debug.h>
5#include "filesys/off_t.h"
6#include "lib/user/syscall.h"
7
8/* we use the same structure as fd_table thus the capacity is fixed to
9 1024 (PGSIZE/4) */
10struct mmap_table
11{
12 struct mmap_table_entry **ids;
13 int id_free; /* lowest-index free */
14 int id_max; /* highest-index used */
15 int id_cap; /* mmap table capacity */
16};
17
18/* a single entry in the mmap table */
19struct mmap_table_entry
20{
21 void *addr;
22 struct file *file;
23};
24
25bool mmap_table_init (struct mmap_table *table);
26void mmap_table_free (struct mmap_table *table);
27mapid_t mmap_table_insert (struct mmap_table *table, void *addr,
28 struct file *file, off_t len);
29bool mmap_table_remove (struct mmap_table *table, mapid_t mapping);
30
31#endif