osdep: Move memalign-related functions to their own header

Move the various memalign-related functions out of osdep.h and into
their own header, which we include only where they are used.
While we're doing this, add some brief documentation comments.

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-id: 20220226180723.1706285-10-peter.maydell@linaro.org
This commit is contained in:
Peter Maydell 2022-02-26 18:07:23 +00:00
parent 1a11265d7e
commit 5df022cf2e
53 changed files with 112 additions and 20 deletions

View File

@ -16,6 +16,7 @@
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/memalign.h"
typedef struct { typedef struct {
BdrvChild *test_file; BdrvChild *test_file;

View File

@ -22,6 +22,7 @@
#include "qemu/coroutine.h" #include "qemu/coroutine.h"
#include "block/aio_task.h" #include "block/aio_task.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/memalign.h"
#define BLOCK_COPY_MAX_COPY_RANGE (16 * MiB) #define BLOCK_COPY_MAX_COPY_RANGE (16 * MiB)
#define BLOCK_COPY_MAX_BUFFER (1 * MiB) #define BLOCK_COPY_MAX_BUFFER (1 * MiB)

View File

@ -20,6 +20,7 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h" #include "qemu/ratelimit.h"
#include "qemu/memalign.h"
#include "sysemu/block-backend.h" #include "sysemu/block-backend.h"
enum { enum {

View File

@ -31,6 +31,7 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#include "crypto.h" #include "crypto.h"
typedef struct BlockCrypto BlockCrypto; typedef struct BlockCrypto BlockCrypto;

View File

@ -27,6 +27,7 @@
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/memalign.h"
#include "dmg.h" #include "dmg.h"
int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in, int (*dmg_uncompress_bz2)(char *next_in, unsigned int avail_in,

View File

@ -19,6 +19,7 @@
#define FUSE_USE_VERSION 31 #define FUSE_USE_VERSION 31
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/memalign.h"
#include "block/aio.h" #include "block/aio.h"
#include "block/block.h" #include "block/block.h"
#include "block/export.h" #include "block/export.h"

View File

@ -31,6 +31,7 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/memalign.h"
#include "trace.h" #include "trace.h"
#include "block/thread-pool.h" #include "block/thread-pool.h"
#include "qemu/iov.h" #include "qemu/iov.h"

View File

@ -32,6 +32,7 @@
#include "block/coroutines.h" #include "block/coroutines.h"
#include "block/write-threshold.h" #include "block/write-threshold.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"

View File

@ -23,6 +23,7 @@
#include "qapi/qmp/qerror.h" #include "qapi/qmp/qerror.h"
#include "qemu/ratelimit.h" #include "qemu/ratelimit.h"
#include "qemu/bitmap.h" #include "qemu/bitmap.h"
#include "qemu/memalign.h"
#define MAX_IN_FLIGHT 16 #define MAX_IN_FLIGHT 16
#define MAX_IO_BYTES (1 << 20) /* 1 Mb */ #define MAX_IO_BYTES (1 << 20) /* 1 Mb */

View File

@ -21,6 +21,7 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/memalign.h"
#include "qemu/vfio-helpers.h" #include "qemu/vfio-helpers.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "sysemu/replay.h" #include "sysemu/replay.h"

View File

@ -29,6 +29,7 @@
#include "parallels.h" #include "parallels.h"
#include "crypto/hash.h" #include "crypto/hash.h"
#include "qemu/uuid.h" #include "qemu/uuid.h"
#include "qemu/memalign.h"
#define PARALLELS_FORMAT_EXTENSION_MAGIC 0xAB234CEF23DCEA87ULL #define PARALLELS_FORMAT_EXTENSION_MAGIC 0xAB234CEF23DCEA87ULL

View File

@ -41,6 +41,7 @@
#include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-core.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/bitmap.h" #include "qemu/bitmap.h"
#include "qemu/memalign.h"
#include "migration/blocker.h" #include "migration/blocker.h"
#include "parallels.h" #include "parallels.h"

View File

@ -32,6 +32,7 @@
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#include <zlib.h> #include <zlib.h>
#include "qapi/qmp/qdict.h" #include "qapi/qmp/qdict.h"
#include "qapi/qmp/qstring.h" #include "qapi/qmp/qstring.h"

View File

@ -23,6 +23,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/memalign.h"
#include "qcow2.h" #include "qcow2.h"
#include "trace.h" #include "trace.h"

View File

@ -28,6 +28,7 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qcow2.h" #include "qcow2.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/memalign.h"
#include "trace.h" #include "trace.h"
int qcow2_shrink_l1_table(BlockDriverState *bs, uint64_t exact_size) int qcow2_shrink_l1_table(BlockDriverState *bs, uint64_t exact_size)

View File

@ -28,6 +28,7 @@
#include "qemu/range.h" #include "qemu/range.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#include "trace.h" #include "trace.h"
static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size, static int64_t alloc_clusters_noref(BlockDriverState *bs, uint64_t size,

View File

@ -29,6 +29,7 @@
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
static void qcow2_free_single_snapshot(BlockDriverState *bs, int i) static void qcow2_free_single_snapshot(BlockDriverState *bs, int i)
{ {

View File

@ -38,6 +38,7 @@
#include "qemu/option_int.h" #include "qemu/option_int.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/memalign.h"
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-core.h"
#include "crypto.h" #include "crypto.h"

View File

@ -51,6 +51,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/memalign.h"
#include "trace.h" #include "trace.h"
#include "qed.h" #include "qed.h"

View File

@ -17,6 +17,7 @@
#include "qemu/sockets.h" /* for EINPROGRESS on Windows */ #include "qemu/sockets.h" /* for EINPROGRESS on Windows */
#include "qed.h" #include "qed.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/memalign.h"
/* Called with table_lock held. */ /* Called with table_lock held. */
static int coroutine_fn qed_read_table(BDRVQEDState *s, uint64_t offset, static int coroutine_fn qed_read_table(BDRVQEDState *s, uint64_t offset,

View File

@ -20,6 +20,7 @@
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/memalign.h"
#include "trace.h" #include "trace.h"
#include "qed.h" #include "qed.h"
#include "sysemu/block-backend.h" #include "sysemu/block-backend.h"

View File

@ -17,6 +17,7 @@
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/memalign.h"
#include "block/block_int.h" #include "block/block_int.h"
#include "block/coroutines.h" #include "block/coroutines.h"
#include "block/qdict.h" #include "block/qdict.h"

View File

@ -31,6 +31,7 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/memalign.h"
typedef struct BDRVRawState { typedef struct BDRVRawState {
uint64_t offset; uint64_t offset;

View File

@ -64,6 +64,7 @@
#include "qemu/coroutine.h" #include "qemu/coroutine.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/uuid.h" #include "qemu/uuid.h"
#include "qemu/memalign.h"
/* Code configuration options. */ /* Code configuration options. */

View File

@ -23,6 +23,7 @@
#include "block/block_int.h" #include "block/block_int.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/memalign.h"
#include "vhdx.h" #include "vhdx.h"

View File

@ -25,6 +25,7 @@
#include "qemu/crc32c.h" #include "qemu/crc32c.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/memalign.h"
#include "vhdx.h" #include "vhdx.h"
#include "migration/blocker.h" #include "migration/blocker.h"
#include "qemu/uuid.h" #include "qemu/uuid.h"

View File

@ -33,6 +33,7 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/memalign.h"
#include "migration/blocker.h" #include "migration/blocker.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include <zlib.h> #include <zlib.h>

View File

@ -33,6 +33,7 @@
#include "migration/blocker.h" #include "migration/blocker.h"
#include "qemu/bswap.h" #include "qemu/bswap.h"
#include "qemu/uuid.h" #include "qemu/uuid.h"
#include "qemu/memalign.h"
#include "qapi/qmp/qdict.h" #include "qapi/qmp/qdict.h"
#include "qapi/qobject-input-visitor.h" #include "qapi/qobject-input-visitor.h"
#include "qapi/qapi-visit-block-core.h" #include "qapi/qapi-visit-block-core.h"

View File

@ -29,6 +29,7 @@
#include "block/raw-aio.h" #include "block/raw-aio.h"
#include "qemu/event_notifier.h" #include "qemu/event_notifier.h"
#include "qemu/iov.h" #include "qemu/iov.h"
#include "qemu/memalign.h"
#include <windows.h> #include <windows.h>
#include <winioctl.h> #include <winioctl.h>

View File

@ -21,6 +21,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/memalign.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "hw/xen/xen_common.h" #include "hw/xen/xen_common.h"
#include "hw/block/xen_blkif.h" #include "hw/block/xen_blkif.h"

View File

@ -32,6 +32,7 @@
#include "qapi/error.h" #include "qapi/error.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "qemu/memalign.h"
#include "hw/irq.h" #include "hw/irq.h"
#include "hw/isa/isa.h" #include "hw/isa/isa.h"
#include "hw/qdev-properties.h" #include "hw/qdev-properties.h"

View File

@ -30,6 +30,7 @@
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "qemu/hw-version.h" #include "qemu/hw-version.h"
#include "qemu/memalign.h"
#include "sysemu/sysemu.h" #include "sysemu/sysemu.h"
#include "sysemu/blockdev.h" #include "sysemu/blockdev.h"
#include "sysemu/dma.h" #include "sysemu/dma.h"

View File

@ -27,6 +27,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "qemu/datadir.h" #include "qemu/datadir.h"
#include "qemu/memalign.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "qapi/qapi-events-machine.h" #include "qapi/qapi-events-machine.h"
#include "qapi/qapi-events-qdev.h" #include "qapi/qapi-events-qdev.h"

View File

@ -1,5 +1,6 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#include "cpu.h" #include "cpu.h"
#include "helper_regs.h" #include "helper_regs.h"
#include "hw/ppc/spapr.h" #include "hw/ppc/spapr.h"

View File

@ -26,6 +26,7 @@
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/hw-version.h" #include "qemu/hw-version.h"
#include "qemu/memalign.h"
#include "hw/scsi/scsi.h" #include "hw/scsi/scsi.h"
#include "migration/qemu-file-types.h" #include "migration/qemu-file-types.h"
#include "migration/vmstate.h" #include "migration/vmstate.h"

View File

@ -12,7 +12,7 @@
*/ */
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/memalign.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "sysemu/memory_mapping.h" #include "sysemu/memory_mapping.h"
#include "migration/vmstate.h" #include "migration/vmstate.h"

61
include/qemu/memalign.h Normal file
View File

@ -0,0 +1,61 @@
/*
* Allocation and free functions for aligned memory
*
* 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_MEMALIGN_H
#define QEMU_MEMALIGN_H
/**
* qemu_try_memalign: Allocate aligned memory
* @alignment: required alignment, in bytes
* @size: size of allocation, in bytes
*
* Allocate memory on an aligned boundary (i.e. the returned
* address will be an exact multiple of @alignment).
* @alignment must be a power of 2, or the function will assert().
* On success, returns allocated memory; on failure, returns NULL.
*
* The memory allocated through this function must be freed via
* qemu_vfree() (and not via free()).
*/
void *qemu_try_memalign(size_t alignment, size_t size);
/**
* qemu_memalign: Allocate aligned memory, without failing
* @alignment: required alignment, in bytes
* @size: size of allocation, in bytes
*
* Allocate memory in the same way as qemu_try_memalign(), but
* abort() with an error message if the memory allocation fails.
*
* The memory allocated through this function must be freed via
* qemu_vfree() (and not via free()).
*/
void *qemu_memalign(size_t alignment, size_t size);
/**
* qemu_vfree: Free memory allocated through qemu_memalign
* @ptr: memory to free
*
* This function must be used to free memory allocated via qemu_memalign()
* or qemu_try_memalign(). (Using the wrong free function will cause
* subtle bugs on Windows hosts.)
*/
void qemu_vfree(void *ptr);
/*
* It's an analog of GLIB's g_autoptr_cleanup_generic_gfree(), used to define
* g_autofree macro.
*/
static inline void qemu_cleanup_generic_vfree(void *p)
{
void **pp = (void **)p;
qemu_vfree(*pp);
}
/*
* Analog of g_autofree, but qemu_vfree is called on cleanup instead of g_free.
*/
#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)))
#endif

View File

@ -379,28 +379,10 @@ extern "C" {
#endif #endif
int qemu_daemon(int nochdir, int noclose); int qemu_daemon(int nochdir, int noclose);
void *qemu_try_memalign(size_t alignment, size_t size);
void *qemu_memalign(size_t alignment, size_t size);
void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared, void *qemu_anon_ram_alloc(size_t size, uint64_t *align, bool shared,
bool noreserve); bool noreserve);
void qemu_vfree(void *ptr);
void qemu_anon_ram_free(void *ptr, size_t size); void qemu_anon_ram_free(void *ptr, size_t size);
/*
* It's an analog of GLIB's g_autoptr_cleanup_generic_gfree(), used to define
* g_autofree macro.
*/
static inline void qemu_cleanup_generic_vfree(void *p)
{
void **pp = (void **)p;
qemu_vfree(*pp);
}
/*
* Analog of g_autofree, but qemu_vfree is called on cleanup instead of g_free.
*/
#define QEMU_AUTO_VFREE __attribute__((cleanup(qemu_cleanup_generic_vfree)))
#ifdef _WIN32 #ifdef _WIN32
#define HAVE_CHARDEV_SERIAL 1 #define HAVE_CHARDEV_SERIAL 1
#elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \ #elif defined(__linux__) || defined(__sun__) || defined(__FreeBSD__) \

View File

@ -25,6 +25,7 @@
#include "trace.h" #include "trace.h"
#include "nbd-internal.h" #include "nbd-internal.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/memalign.h"
#define NBD_META_ID_BASE_ALLOCATION 0 #define NBD_META_ID_BASE_ALLOCATION 0
#define NBD_META_ID_ALLOCATION_DEPTH 1 #define NBD_META_ID_ALLOCATION_DEPTH 1

View File

@ -34,7 +34,7 @@
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "qemu/iov.h" #include "qemu/iov.h"
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/memalign.h"
/* The buffer size needs to be investigated for optimum numbers and /* The buffer size needs to be investigated for optimum numbers and
* optimum means of paging in on different systems. This size is * optimum means of paging in on different systems. This size is

View File

@ -27,6 +27,7 @@
#include "qemu/cacheinfo.h" #include "qemu/cacheinfo.h"
#include "qemu/xxhash.h" #include "qemu/xxhash.h"
#include "qemu/plugin.h" #include "qemu/plugin.h"
#include "qemu/memalign.h"
#include "hw/core/cpu.h" #include "hw/core/cpu.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"
#ifndef CONFIG_USER_ONLY #ifndef CONFIG_USER_ONLY

View File

@ -42,6 +42,7 @@
#include "qemu/module.h" #include "qemu/module.h"
#include "qemu/sockets.h" #include "qemu/sockets.h"
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/memalign.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "sysemu/block-backend.h" #include "sysemu/block-backend.h"
#include "block/block_int.h" #include "block/block_int.h"

View File

@ -21,6 +21,7 @@
#include "qemu/option.h" #include "qemu/option.h"
#include "qemu/timer.h" #include "qemu/timer.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#define CMD_NOFILE_OK 0x01 #define CMD_NOFILE_OK 0x01

View File

@ -16,6 +16,7 @@
#include "qom/object.h" #include "qom/object.h"
#include "qom/object_interfaces.h" #include "qom/object_interfaces.h"
#include "qemu/cutils.h" #include "qemu/cutils.h"
#include "qemu/memalign.h"
#include "qapi/visitor.h" #include "qapi/visitor.h"
#include "qapi/string-input-visitor.h" #include "qapi/string-input-visitor.h"
#include "qapi/string-output-visitor.h" #include "qapi/string-output-visitor.h"

View File

@ -42,6 +42,7 @@
#include "qemu/config-file.h" #include "qemu/config-file.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/qemu-print.h" #include "qemu/qemu-print.h"
#include "qemu/memalign.h"
#include "exec/memory.h" #include "exec/memory.h"
#include "exec/ioport.h" #include "exec/ioport.h"
#include "sysemu/dma.h" #include "sysemu/dma.h"

View File

@ -49,6 +49,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu-common.h" #include "qemu-common.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/memalign.h"
#include "sysemu/hvf.h" #include "sysemu/hvf.h"
#include "sysemu/hvf_int.h" #include "sysemu/hvf_int.h"

View File

@ -37,6 +37,7 @@
#include "qemu/main-loop.h" #include "qemu/main-loop.h"
#include "qemu/config-file.h" #include "qemu/config-file.h"
#include "qemu/error-report.h" #include "qemu/error-report.h"
#include "qemu/memalign.h"
#include "hw/i386/x86.h" #include "hw/i386/x86.h"
#include "hw/i386/apic.h" #include "hw/i386/apic.h"
#include "hw/i386/apic_internal.h" #include "hw/i386/apic_internal.h"

View File

@ -26,6 +26,7 @@
#include "qemu/units.h" #include "qemu/units.h"
#include "qemu/madvise.h" #include "qemu/madvise.h"
#include "qemu/mprotect.h" #include "qemu/mprotect.h"
#include "qemu/memalign.h"
#include "qemu/cacheinfo.h" #include "qemu/cacheinfo.h"
#include "qapi/error.h" #include "qapi/error.h"
#include "exec/exec-all.h" #include "exec/exec-all.h"

View File

@ -2,6 +2,7 @@
#include "qemu/thread.h" #include "qemu/thread.h"
#include "qemu/host-utils.h" #include "qemu/host-utils.h"
#include "qemu/processor.h" #include "qemu/processor.h"
#include "qemu/memalign.h"
struct thread_info { struct thread_info {
uint64_t r; uint64_t r;

View File

@ -10,6 +10,7 @@
#include "qemu/qht.h" #include "qemu/qht.h"
#include "qemu/rcu.h" #include "qemu/rcu.h"
#include "qemu/xxhash.h" #include "qemu/xxhash.h"
#include "qemu/memalign.h"
struct thread_stats { struct thread_stats {
size_t rd; size_t rd;

View File

@ -8,6 +8,7 @@
#include "qemu/atomic.h" #include "qemu/atomic.h"
#include "qemu/thread.h" #include "qemu/thread.h"
#include "qemu/cacheinfo.h" #include "qemu/cacheinfo.h"
#include "qemu/memalign.h"
#ifdef CONFIG_ATOMIC64 #ifdef CONFIG_ATOMIC64
#error This file must only be compiled if !CONFIG_ATOMIC64 #error This file must only be compiled if !CONFIG_ATOMIC64

View File

@ -26,6 +26,7 @@
#include "qemu/osdep.h" #include "qemu/osdep.h"
#include "qemu/host-utils.h" #include "qemu/host-utils.h"
#include "qemu/memalign.h"
#include "trace.h" #include "trace.h"
void *qemu_try_memalign(size_t alignment, size_t size) void *qemu_try_memalign(size_t alignment, size_t size)

View File

@ -69,6 +69,7 @@
#include "qemu/qht.h" #include "qemu/qht.h"
#include "qemu/atomic.h" #include "qemu/atomic.h"
#include "qemu/rcu.h" #include "qemu/rcu.h"
#include "qemu/memalign.h"
//#define QHT_DEBUG //#define QHT_DEBUG