osdep: include glib-compat.h before other QEMU headers
[qemu/ar7.git] / include / qemu / mmap-alloc.h
blob456ff87df16735dd009fd700147143dbc5feca5f
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 the specified file or device.
12 * Parameters:
13 * @fd: the file or the device to mmap
14 * @size: the number of bytes to be mmaped
15 * @align: if not zero, specify the alignment of the starting mapping address;
16 * otherwise, the alignment in use will be determined by QEMU.
17 * @readonly: true for a read-only mapping, false for read/write.
18 * @shared: map has RAM_SHARED flag.
19 * @is_pmem: map has RAM_PMEM flag.
20 * @map_offset: map starts at offset of map_offset from the start of fd
22 * Return:
23 * On success, return a pointer to the mapped area.
24 * On failure, return MAP_FAILED.
26 void *qemu_ram_mmap(int fd,
27 size_t size,
28 size_t align,
29 bool readonly,
30 bool shared,
31 bool is_pmem,
32 off_t map_offset);
34 void qemu_ram_munmap(int fd, void *ptr, size_t size);
36 #endif