]>
Commit | Line | Data |
---|---|---|
53e1b683 | 1 | /* SPDX-License-Identifier: LGPL-2.1+ */ |
16e9f408 LP |
2 | #pragma once |
3 | ||
f8019684 LP |
4 | #include <stdbool.h> |
5 | #include <sys/stat.h> | |
16e9f408 | 6 | |
fa6ac760 LP |
7 | /* One context per object type, plus one of the header, plus one "additional" one */ |
8 | #define MMAP_CACHE_MAX_CONTEXTS 9 | |
69adae51 | 9 | |
16e9f408 | 10 | typedef struct MMapCache MMapCache; |
be7cdd8e | 11 | typedef struct MMapFileDescriptor MMapFileDescriptor; |
16e9f408 | 12 | |
84168d80 | 13 | MMapCache* mmap_cache_new(void); |
16e9f408 LP |
14 | MMapCache* mmap_cache_ref(MMapCache *m); |
15 | MMapCache* mmap_cache_unref(MMapCache *m); | |
16 | ||
ae97089d ZJS |
17 | int mmap_cache_get( |
18 | MMapCache *m, | |
be7cdd8e | 19 | MMapFileDescriptor *f, |
ae97089d ZJS |
20 | int prot, |
21 | unsigned context, | |
22 | bool keep_always, | |
23 | uint64_t offset, | |
24 | size_t size, | |
25 | struct stat *st, | |
b42549ad VC |
26 | void **ret, |
27 | size_t *ret_size); | |
be7cdd8e VC |
28 | MMapFileDescriptor * mmap_cache_add_fd(MMapCache *m, int fd); |
29 | void mmap_cache_free_fd(MMapCache *m, MMapFileDescriptor *f); | |
bf807d4d LP |
30 | |
31 | unsigned mmap_cache_get_hit(MMapCache *m); | |
32 | unsigned mmap_cache_get_missed(MMapCache *m); | |
fa6ac760 | 33 | |
be7cdd8e | 34 | bool mmap_cache_got_sigbus(MMapCache *m, MMapFileDescriptor *f); |