blob: bee364ee5817530513b36846680553d7b05de122 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
|
#ifndef VM_MMAP_H
#define VM_MMAP_H
#include <debug.h>
#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
|