aboutsummaryrefslogtreecommitdiff
path: root/tests/libqos/libqos.h
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2018-11-29 12:37:04 +0100
committerPaolo Bonzini <pbonzini@redhat.com>2019-03-07 17:28:07 +0100
commiteb5937bad691ed18a401079a0604aa11fea0ecdd (patch)
treea26310ca140c15230c51cceeebc538f7f55b7888 /tests/libqos/libqos.h
parent143e6db6fa4ecd2a85de740cc3754aeb86d1e802 (diff)
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/libqos.h')
-rw-r--r--tests/libqos/libqos.h11
1 files changed, 5 insertions, 6 deletions
diff --git a/tests/libqos/libqos.h b/tests/libqos/libqos.h
index 1af6035db4..149b0be8bc 100644
--- a/tests/libqos/libqos.h
+++ b/tests/libqos/libqos.h
@@ -3,13 +3,12 @@
#include "libqtest.h"
#include "libqos/pci.h"
-#include "libqos/malloc-pc.h"
+#include "libqos/malloc.h"
typedef struct QOSState QOSState;
typedef struct QOSOps {
- QGuestAllocator *(*init_allocator)(QTestState *qts, QAllocOpts);
- void (*uninit_allocator)(QGuestAllocator *);
+ void (*alloc_init)(QGuestAllocator *, QTestState *, QAllocOpts);
QPCIBus *(*qpci_new)(QTestState *qts, QGuestAllocator *alloc);
void (*qpci_free)(QPCIBus *bus);
void (*shutdown)(QOSState *);
@@ -17,7 +16,7 @@ typedef struct QOSOps {
struct QOSState {
QTestState *qts;
- QGuestAllocator *alloc;
+ QGuestAllocator alloc;
QPCIBus *pcibus;
QOSOps *ops;
};
@@ -36,12 +35,12 @@ void generate_pattern(void *buffer, size_t len, size_t cycle_len);
static inline uint64_t qmalloc(QOSState *q, size_t bytes)
{
- return guest_alloc(q->alloc, bytes);
+ return guest_alloc(&q->alloc, bytes);
}
static inline void qfree(QOSState *q, uint64_t addr)
{
- guest_free(q->alloc, addr);
+ guest_free(&q->alloc, addr);
}
#endif