From 794e8f301a17953efa78ab7538019ec43c59e82a Mon Sep 17 00:00:00 2001 From: "Michael S. Tsirkin" Date: Thu, 24 Sep 2015 14:41:17 +0300 Subject: exec: factor out duplicate mmap code MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Anonymous and file-backed RAM allocation are now almost exactly the same. Reduce code duplication by moving RAM mmap code out of oslib-posix.c and exec.c. Reported-by: Marc-André Lureau Signed-off-by: Michael S. Tsirkin Reviewed-by: Paolo Bonzini Acked-by: Paolo Bonzini Tested-by: Thibaut Collet --- include/qemu/mmap-alloc.h | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 include/qemu/mmap-alloc.h (limited to 'include/qemu') diff --git a/include/qemu/mmap-alloc.h b/include/qemu/mmap-alloc.h new file mode 100644 index 0000000..56388e6 --- /dev/null +++ b/include/qemu/mmap-alloc.h @@ -0,0 +1,10 @@ +#ifndef QEMU_MMAP_ALLOC +#define QEMU_MMAP_ALLOC + +#include "qemu-common.h" + +void *qemu_ram_mmap(int fd, size_t size, size_t align, bool shared); + +void qemu_ram_munmap(void *ptr, size_t size); + +#endif -- cgit v1.1