renamed and cleaned up export header files to match linux convention
[lunaix-os.git] / lunaix-os / includes / lunaix / mm / mmap.h
1 #ifndef __LUNAIX_MMAP_H
2 #define __LUNAIX_MMAP_H
3
4 #include <lunaix/fs.h>
5 #include <lunaix/mm/region.h>
6 #include <lunaix/types.h>
7
8 struct mmap_param
9 {
10     ptr_t vms_mnt;        // vm mount point
11     struct proc_mm* pvms; // process vm
12     off_t offset;         // mapped file offset
13     size_t mlen;          // mapped memory length
14     size_t flen;          // mapped file length
15     u32_t proct;          // protections
16     u32_t flags;          // other options
17     u32_t type;           // region type
18     ptr_t range_start;
19     ptr_t range_end;
20 };
21
22 int
23 mem_adjust_inplace(vm_regions_t* regions,
24                    struct mm_region* region,
25                    ptr_t newend);
26
27 int 
28 mmap_user(void** addr_out,
29         struct mm_region** created,
30         ptr_t addr,
31         struct v_file* file,
32         struct mmap_param* param);
33
34 int
35 mem_map(void** addr_out,
36         struct mm_region** created,
37         ptr_t addr,
38         struct v_file* file,
39         struct mmap_param* param);
40
41 int
42 mem_unmap(ptr_t mnt, vm_regions_t* regions, ptr_t addr, size_t length);
43
44 void
45 mem_unmap_region(ptr_t mnt, struct mm_region* region);
46
47 void
48 mem_sync_pages(ptr_t mnt,
49                struct mm_region* region,
50                ptr_t start,
51                ptr_t length,
52                int options);
53
54 int
55 mem_msync(ptr_t mnt,
56           vm_regions_t* regions,
57           ptr_t addr,
58           size_t length,
59           int options);
60
61 #endif /* __LUNAIX_MMAP_H */