mirror of
https://github.com/xemu-project/xemu.git
synced 2024-11-23 19:49:43 +00:00
b85ea5fa2f
The function qemu_madvise() and the QEMU_MADV_* constants associated with it are used in only 10 files. Move them out of osdep.h to a new qemu/madvise.h header that is included where it is needed. Signed-off-by: Peter Maydell <peter.maydell@linaro.org> Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org> Reviewed-by: Richard Henderson <richard.henderson@linaro.org> Message-id: 20220208200856.3558249-2-peter.maydell@linaro.org
96 lines
2.6 KiB
C
96 lines
2.6 KiB
C
/*
|
|
* QEMU madvise wrapper functions
|
|
*
|
|
* This work is licensed under the terms of the GNU GPL, version 2 or later.
|
|
* See the COPYING file in the top-level directory.
|
|
*/
|
|
|
|
#ifndef QEMU_MADVISE_H
|
|
#define QEMU_MADVISE_H
|
|
|
|
#define QEMU_MADV_INVALID -1
|
|
|
|
#if defined(CONFIG_MADVISE)
|
|
|
|
#define QEMU_MADV_WILLNEED MADV_WILLNEED
|
|
#define QEMU_MADV_DONTNEED MADV_DONTNEED
|
|
#ifdef MADV_DONTFORK
|
|
#define QEMU_MADV_DONTFORK MADV_DONTFORK
|
|
#else
|
|
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_MERGEABLE
|
|
#define QEMU_MADV_MERGEABLE MADV_MERGEABLE
|
|
#else
|
|
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_UNMERGEABLE
|
|
#define QEMU_MADV_UNMERGEABLE MADV_UNMERGEABLE
|
|
#else
|
|
#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_DODUMP
|
|
#define QEMU_MADV_DODUMP MADV_DODUMP
|
|
#else
|
|
#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_DONTDUMP
|
|
#define QEMU_MADV_DONTDUMP MADV_DONTDUMP
|
|
#else
|
|
#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_HUGEPAGE
|
|
#define QEMU_MADV_HUGEPAGE MADV_HUGEPAGE
|
|
#else
|
|
#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_NOHUGEPAGE
|
|
#define QEMU_MADV_NOHUGEPAGE MADV_NOHUGEPAGE
|
|
#else
|
|
#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
|
|
#endif
|
|
#ifdef MADV_REMOVE
|
|
#define QEMU_MADV_REMOVE MADV_REMOVE
|
|
#else
|
|
#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
|
|
#endif
|
|
#ifdef MADV_POPULATE_WRITE
|
|
#define QEMU_MADV_POPULATE_WRITE MADV_POPULATE_WRITE
|
|
#else
|
|
#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
|
|
#endif
|
|
|
|
#elif defined(CONFIG_POSIX_MADVISE)
|
|
|
|
#define QEMU_MADV_WILLNEED POSIX_MADV_WILLNEED
|
|
#define QEMU_MADV_DONTNEED POSIX_MADV_DONTNEED
|
|
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
|
|
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
|
|
#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
|
|
#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_REMOVE QEMU_MADV_DONTNEED
|
|
#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
|
|
|
|
#else /* no-op */
|
|
|
|
#define QEMU_MADV_WILLNEED QEMU_MADV_INVALID
|
|
#define QEMU_MADV_DONTNEED QEMU_MADV_INVALID
|
|
#define QEMU_MADV_DONTFORK QEMU_MADV_INVALID
|
|
#define QEMU_MADV_MERGEABLE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_UNMERGEABLE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_DODUMP QEMU_MADV_INVALID
|
|
#define QEMU_MADV_DONTDUMP QEMU_MADV_INVALID
|
|
#define QEMU_MADV_HUGEPAGE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_NOHUGEPAGE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_REMOVE QEMU_MADV_INVALID
|
|
#define QEMU_MADV_POPULATE_WRITE QEMU_MADV_INVALID
|
|
|
|
#endif
|
|
|
|
int qemu_madvise(void *addr, size_t len, int advice);
|
|
|
|
#endif
|