From eb5937bad691ed18a401079a0604aa11fea0ecdd Mon Sep 17 00:00:00 2001 From: Paolo Bonzini Date: Thu, 29 Nov 2018 12:37:04 +0100 Subject: 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 --- tests/vhost-user-test.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'tests/vhost-user-test.c') diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 611d3a79d8..b1414e2b44 100644 --- a/tests/vhost-user-test.c +++ b/tests/vhost-user-test.c @@ -158,7 +158,7 @@ typedef struct TestServer { bool test_fail; int test_flags; int queues; - QGuestAllocator *alloc; + QGuestAllocator alloc; } TestServer; static TestServer *test_server_new(const gchar *name); @@ -206,10 +206,10 @@ static void init_virtio_dev(QTestState *qts, TestServer *s, uint32_t features_ma qvirtio_pci_device_enable(s->dev); qvirtio_start_device(&s->dev->vdev); - s->alloc = pc_alloc_init(qts); + pc_alloc_init(&s->alloc, qts, 0); for (i = 0; i < s->queues * 2; i++) { - s->vq[i] = qvirtqueue_setup(&s->dev->vdev, s->alloc, i); + s->vq[i] = qvirtqueue_setup(&s->dev->vdev, &s->alloc, i); } features = qvirtio_get_features(&s->dev->vdev); @@ -224,9 +224,9 @@ static void uninit_virtio_dev(TestServer *s) int i; for (i = 0; i < s->queues * 2; i++) { - qvirtqueue_cleanup(s->dev->vdev.bus, s->vq[i], s->alloc); + qvirtqueue_cleanup(s->dev->vdev.bus, s->vq[i], &s->alloc); } - pc_alloc_uninit(s->alloc); + alloc_destroy(&s->alloc); qvirtio_pci_device_free(s->dev); } -- cgit v1.2.3