2015-10-09 17:17:19 +02:00
|
|
|
#ifndef QEMU_MEMFD_H
|
|
|
|
#define QEMU_MEMFD_H
|
|
|
|
|
|
|
|
|
|
|
|
#ifndef F_LINUX_SPECIFIC_BASE
|
|
|
|
#define F_LINUX_SPECIFIC_BASE 1024
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef F_ADD_SEALS
|
|
|
|
#define F_ADD_SEALS (F_LINUX_SPECIFIC_BASE + 9)
|
|
|
|
#define F_GET_SEALS (F_LINUX_SPECIFIC_BASE + 10)
|
|
|
|
|
|
|
|
#define F_SEAL_SEAL 0x0001 /* prevent further seals from being set */
|
|
|
|
#define F_SEAL_SHRINK 0x0002 /* prevent file from shrinking */
|
|
|
|
#define F_SEAL_GROW 0x0004 /* prevent file from growing */
|
|
|
|
#define F_SEAL_WRITE 0x0008 /* prevent writes */
|
|
|
|
#endif
|
|
|
|
|
2018-09-06 18:14:15 +02:00
|
|
|
#ifndef MFD_CLOEXEC
|
|
|
|
#define MFD_CLOEXEC 0x0001U
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MFD_ALLOW_SEALING
|
|
|
|
#define MFD_ALLOW_SEALING 0x0002U
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MFD_HUGETLB
|
|
|
|
#define MFD_HUGETLB 0x0004U
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#ifndef MFD_HUGE_SHIFT
|
|
|
|
#define MFD_HUGE_SHIFT 26
|
|
|
|
#endif
|
|
|
|
|
2019-08-19 20:09:47 +02:00
|
|
|
#if defined CONFIG_LINUX && !defined CONFIG_MEMFD
|
|
|
|
int memfd_create(const char *name, unsigned int flags);
|
|
|
|
#endif
|
|
|
|
|
2018-02-01 14:27:52 +01:00
|
|
|
int qemu_memfd_create(const char *name, size_t size, bool hugetlb,
|
2018-02-01 14:27:53 +01:00
|
|
|
uint64_t hugetlbsize, unsigned int seals, Error **errp);
|
2018-03-28 14:18:04 +02:00
|
|
|
bool qemu_memfd_alloc_check(void);
|
2015-10-09 17:17:20 +02:00
|
|
|
void *qemu_memfd_alloc(const char *name, size_t size, unsigned int seals,
|
2018-02-01 14:27:51 +01:00
|
|
|
int *fd, Error **errp);
|
2015-10-09 17:17:20 +02:00
|
|
|
void qemu_memfd_free(void *ptr, size_t size, int fd);
|
2018-09-06 18:14:15 +02:00
|
|
|
bool qemu_memfd_check(unsigned int flags);
|
2015-10-09 17:17:20 +02:00
|
|
|
|
2015-10-09 17:17:19 +02:00
|
|
|
#endif /* QEMU_MEMFD_H */
|