]> git.ipfire.org Git - thirdparty/systemd.git/blob - src/journal/mmap-cache.h
Merge pull request #8417 from brauner/2018-03-09/add_bind_mount_fallback_to_private_d...
[thirdparty/systemd.git] / src / journal / mmap-cache.h
1 /* SPDX-License-Identifier: LGPL-2.1+ */
2 #pragma once
3
4 /***
5 This file is part of systemd.
6
7 Copyright 2012 Lennart Poettering
8 ***/
9
10 #include <stdbool.h>
11 #include <sys/stat.h>
12
13 /* One context per object type, plus one of the header, plus one "additional" one */
14 #define MMAP_CACHE_MAX_CONTEXTS 9
15
16 typedef struct MMapCache MMapCache;
17 typedef struct MMapFileDescriptor MMapFileDescriptor;
18
19 MMapCache* mmap_cache_new(void);
20 MMapCache* mmap_cache_ref(MMapCache *m);
21 MMapCache* mmap_cache_unref(MMapCache *m);
22
23 int mmap_cache_get(
24 MMapCache *m,
25 MMapFileDescriptor *f,
26 int prot,
27 unsigned context,
28 bool keep_always,
29 uint64_t offset,
30 size_t size,
31 struct stat *st,
32 void **ret,
33 size_t *ret_size);
34 MMapFileDescriptor * mmap_cache_add_fd(MMapCache *m, int fd);
35 void mmap_cache_free_fd(MMapCache *m, MMapFileDescriptor *f);
36
37 unsigned mmap_cache_get_hit(MMapCache *m);
38 unsigned mmap_cache_get_missed(MMapCache *m);
39
40 bool mmap_cache_got_sigbus(MMapCache *m, MMapFileDescriptor *f);