[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH v4 1/6] virtio: Add typedef for handle_output
From: |
Fam Zheng |
Subject: |
[Qemu-devel] [PATCH v4 1/6] virtio: Add typedef for handle_output |
Date: |
Wed, 13 Jul 2016 13:09:43 +0800 |
The function pointer signature has been repeated a few times, using a
typedef may make coding easier.
Signed-off-by: Fam Zheng <address@hidden>
Reviewed-by: Stefan Hajnoczi <address@hidden>
---
hw/virtio/virtio.c | 9 ++++-----
include/hw/virtio/virtio.h | 5 +++--
2 files changed, 7 insertions(+), 7 deletions(-)
diff --git a/hw/virtio/virtio.c b/hw/virtio/virtio.c
index 18153d5..2cc68d24 100644
--- a/hw/virtio/virtio.c
+++ b/hw/virtio/virtio.c
@@ -95,8 +95,8 @@ struct VirtQueue
int inuse;
uint16_t vector;
- void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq);
- void (*handle_aio_output)(VirtIODevice *vdev, VirtQueue *vq);
+ VirtIOHandleOutput handle_output;
+ VirtIOHandleOutput handle_aio_output;
VirtIODevice *vdev;
EventNotifier guest_notifier;
EventNotifier host_notifier;
@@ -1131,7 +1131,7 @@ void virtio_queue_set_vector(VirtIODevice *vdev, int n,
uint16_t vector)
}
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
- void (*handle_output)(VirtIODevice *, VirtQueue *))
+ VirtIOHandleOutput handle_output)
{
int i;
@@ -1804,8 +1804,7 @@ static void
virtio_queue_host_notifier_aio_read(EventNotifier *n)
}
void virtio_queue_aio_set_host_notifier_handler(VirtQueue *vq, AioContext *ctx,
- void
(*handle_output)(VirtIODevice *,
-
VirtQueue *))
+ VirtIOHandleOutput
handle_output)
{
if (handle_output) {
vq->handle_aio_output = handle_output;
diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h
index 8a681f5..3670829 100644
--- a/include/hw/virtio/virtio.h
+++ b/include/hw/virtio/virtio.h
@@ -138,9 +138,10 @@ void virtio_cleanup(VirtIODevice *vdev);
/* Set the child bus name. */
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *bus_name);
+typedef void (*VirtIOHandleOutput)(VirtIODevice *, VirtQueue *);
+
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
- void (*handle_output)(VirtIODevice *,
- VirtQueue *));
+ VirtIOHandleOutput handle_output);
void virtio_del_queue(VirtIODevice *vdev, int n);
--
2.7.4
- [Qemu-devel] [PATCH v4 0/6] virtio: Merge virtio-{blk, scsi} host notifier handling paths, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 2/6] virtio: Introduce virtio_add_queue_aio, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 4/6] virtio-scsi: Call virtio_add_queue_aio, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 1/6] virtio: Add typedef for handle_output,
Fam Zheng <=
- [Qemu-devel] [PATCH v4 3/6] virtio-blk: Call virtio_add_queue_aio, Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 5/6] Revert "mirror: Workaround for unexpected iohandler events during completion", Fam Zheng, 2016/07/13
- [Qemu-devel] [PATCH v4 6/6] virtio-scsi: Replace HandleOutput typedef, Fam Zheng, 2016/07/13
- Re: [Qemu-devel] [PATCH v4 0/6] virtio: Merge virtio-{blk, scsi} host notifier handling paths, Cornelia Huck, 2016/07/13
- Re: [Qemu-devel] [PATCH v4 0/6] virtio: Merge virtio-{blk, scsi} host notifier handling paths, Paolo Bonzini, 2016/07/13