qemu/include/qemu/mmap-alloc.h
<<
>>
Prefs
   1#ifndef QEMU_MMAP_ALLOC_H
   2#define QEMU_MMAP_ALLOC_H
   3
   4
   5size_t qemu_fd_getpagesize(int fd);
   6
   7size_t qemu_mempath_getpagesize(const char *mem_path);
   8
   9/**
  10 * qemu_ram_mmap: mmap anonymous memory, the specified file or device.
  11 *
  12 * mmap() abstraction to map guest RAM, simplifying flag handling, taking
  13 * care of alignment requirements and installing guard pages.
  14 *
  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
  22 *
  23 * Internally, MAP_PRIVATE, MAP_ANONYMOUS and MAP_SHARED_VALIDATE are set
  24 * implicitly based on other parameters.
  25 *
  26 * Return:
  27 *  On success, return a pointer to the mapped area.
  28 *  On failure, return MAP_FAILED.
  29 */
  30void *qemu_ram_mmap(int fd,
  31                    size_t size,
  32                    size_t align,
  33                    uint32_t qemu_map_flags,
  34                    off_t map_offset);
  35
  36void qemu_ram_munmap(int fd, void *ptr, size_t size);
  37
  38#endif
  39