acpi: validate hotplug selector on access
[qemu.git] / include / qemu / mmap-alloc.h
blob90d0eee705351853ab7f7435e1e7a74dc305e4a0
1 #ifndef QEMU_MMAP_ALLOC_H
2 #define QEMU_MMAP_ALLOC_H
5 size_t qemu_fd_getpagesize(int fd);
7 size_t qemu_mempath_getpagesize(const char *mem_path);
9 /**
10 * qemu_ram_mmap: mmap anonymous memory, the specified file or device.
12 * mmap() abstraction to map guest RAM, simplifying flag handling, taking
13 * care of alignment requirements and installing guard pages.
15 * Parameters:
16 * @fd: the file or the device to mmap
17 * @size: the number of bytes to be mmaped
18 * @align: if not zero, specify the alignment of the starting mapping address;
19 * otherwise, the alignment in use will be determined by QEMU.
20 * @qemu_map_flags: QEMU_MAP_* flags
21 * @map_offset: map starts at offset of map_offset from the start of fd
23 * Internally, MAP_PRIVATE, MAP_ANONYMOUS and MAP_SHARED_VALIDATE are set
24 * implicitly based on other parameters.
26 * Return:
27 * On success, return a pointer to the mapped area.
28 * On failure, return MAP_FAILED.
30 void *qemu_ram_mmap(int fd,
31 size_t size,
32 size_t align,
33 uint32_t qemu_map_flags,
34 off_t map_offset);
36 void qemu_ram_munmap(int fd, void *ptr, size_t size);
38 #endif