diff options
author | Paolo Bonzini <pbonzini@redhat.com> | 2018-11-29 12:37:04 +0100 |
---|---|---|
committer | Paolo Bonzini <pbonzini@redhat.com> | 2019-03-07 17:28:07 +0100 |
commit | eb5937bad691ed18a401079a0604aa11fea0ecdd (patch) | |
tree | a26310ca140c15230c51cceeebc538f7f55b7888 /tests/vhost-user-test.c | |
parent | 143e6db6fa4ecd2a85de740cc3754aeb86d1e802 (diff) | |
download | qemu-eb5937bad691ed18a401079a0604aa11fea0ecdd.zip qemu-eb5937bad691ed18a401079a0604aa11fea0ecdd.tar.gz qemu-eb5937bad691ed18a401079a0604aa11fea0ecdd.tar.bz2 |
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/vhost-user-test.c')
-rw-r--r-- | tests/vhost-user-test.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tests/vhost-user-test.c b/tests/vhost-user-test.c index 611d3a7..b1414e2 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); } |