summaryrefslogtreecommitdiffstats
path: root/tests/libqos/malloc-pc.c
diff options
context:
space:
mode:
authorPaolo Bonzini2018-11-29 12:37:04 +0100
committerPaolo Bonzini2019-03-07 17:28:07 +0100
commiteb5937bad691ed18a401079a0604aa11fea0ecdd (patch)
treea26310ca140c15230c51cceeebc538f7f55b7888 /tests/libqos/malloc-pc.c
parenttests/libqos: rename qpci_init_pc and qpci_init_spapr functions (diff)
downloadqemu-eb5937bad691ed18a401079a0604aa11fea0ecdd.tar.gz
qemu-eb5937bad691ed18a401079a0604aa11fea0ecdd.tar.xz
qemu-eb5937bad691ed18a401079a0604aa11fea0ecdd.zip
tests/libqos: embed allocators instead of malloc-ing them separately
qgraph will embed these objects instead of allocating them in a separate object. Expose a new API "generic_alloc_init" and "generic_alloc_destroy" for that, and rename the existing API with s/init/new/ and s/uninit/free/. Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'tests/libqos/malloc-pc.c')
-rw-r--r--tests/libqos/malloc-pc.c22
1 files changed, 2 insertions, 20 deletions
diff --git a/tests/libqos/malloc-pc.c b/tests/libqos/malloc-pc.c
index b83cb8f0af..949a99361d 100644
--- a/tests/libqos/malloc-pc.c
+++ b/tests/libqos/malloc-pc.c
@@ -20,32 +20,14 @@
#define PAGE_SIZE (4096)
-/*
- * Mostly for valgrind happiness, but it does offer
- * a chokepoint for debugging guest memory leaks, too.
- */
-void pc_alloc_uninit(QGuestAllocator *allocator)
-{
- alloc_uninit(allocator);
-}
-
-QGuestAllocator *pc_alloc_init_flags(QTestState *qts, QAllocOpts flags)
+void pc_alloc_init(QGuestAllocator *s, QTestState *qts, QAllocOpts flags)
{
- QGuestAllocator *s;
uint64_t ram_size;
QFWCFG *fw_cfg = pc_fw_cfg_init(qts);
ram_size = qfw_cfg_get_u64(fw_cfg, FW_CFG_RAM_SIZE);
- s = alloc_init_flags(flags, 1 << 20, MIN(ram_size, 0xE0000000));
- alloc_set_page_size(s, PAGE_SIZE);
+ alloc_init(s, flags, 1 << 20, MIN(ram_size, 0xE0000000), PAGE_SIZE);
/* clean-up */
g_free(fw_cfg);
-
- return s;
-}
-
-inline QGuestAllocator *pc_alloc_init(QTestState *qts)
-{
- return pc_alloc_init_flags(qts, ALLOC_NO_FLAGS);
}