]> git.proxmox.com Git - mirror_qemu.git/blame - include/qemu/memfd.h
Merge tag 'misc-fixes-20231113' of https://github.com/philmd/qemu into staging
[mirror_qemu.git] / include / qemu / memfd.h
CommitLineData
f04cf923
MAL
1#ifndef QEMU_MEMFD_H
2#define QEMU_MEMFD_H
3
f04cf923
MAL
4
5#ifndef F_LINUX_SPECIFIC_BASE
6#define F_LINUX_SPECIFIC_BASE 1024
7#endif
8
9#ifndef F_ADD_SEALS
10#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
11#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
12
13#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
14#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
15#define F_SEAL_GROW 0x0004 /* prevent file from growing */
16#define F_SEAL_WRITE 0x0008 /* prevent writes */
17#endif
18
38296400
MAL
19#ifndef MFD_CLOEXEC
20#define MFD_CLOEXEC 0x0001U
21#endif
22
23#ifndef MFD_ALLOW_SEALING
24#define MFD_ALLOW_SEALING 0x0002U
25#endif
26
27#ifndef MFD_HUGETLB
28#define MFD_HUGETLB 0x0004U
29#endif
30
31#ifndef MFD_HUGE_SHIFT
32#define MFD_HUGE_SHIFT 26
33#endif
34
9bdfa4d2
SCW
35#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
36int memfd_create(const char *name, unsigned int flags);
37#endif
38
c5b2a9e0 39int qemu_memfd_create(const char *name, size_t size, bool hugetlb,
2ef8c0c9 40 uint64_t hugetlbsize, unsigned int seals, Error **errp);
648abbfb 41bool qemu_memfd_alloc_check(void);
d3592199 42void *qemu_memfd_alloc(const char *name, size_t size, unsigned int seals,
0f2956f9 43 int *fd, Error **errp);
d3592199 44void qemu_memfd_free(void *ptr, size_t size, int fd);
38296400 45bool qemu_memfd_check(unsigned int flags);
d3592199 46
f04cf923 47#endif /* QEMU_MEMFD_H */