virtio: Add typedef for handle_output

The function pointer signature has been repeated a few times, using a
typedef may make coding easier.

Signed-off-by: Fam Zheng <famz@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Acked-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Fam Zheng 2016-07-13 13:09:43 +08:00 committed by Michael S. Tsirkin
parent 4684a20410
commit bf1780b0d5
2 changed files with 7 additions and 7 deletions

View File

@ -95,8 +95,8 @@ struct VirtQueue
int inuse; int inuse;
uint16_t vector; uint16_t vector;
void (*handle_output)(VirtIODevice *vdev, VirtQueue *vq); VirtIOHandleOutput handle_output;
void (*handle_aio_output)(VirtIODevice *vdev, VirtQueue *vq); VirtIOHandleOutput handle_aio_output;
VirtIODevice *vdev; VirtIODevice *vdev;
EventNotifier guest_notifier; EventNotifier guest_notifier;
EventNotifier host_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, VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
void (*handle_output)(VirtIODevice *, VirtQueue *)) VirtIOHandleOutput handle_output)
{ {
int i; 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 virtio_queue_aio_set_host_notifier_handler(VirtQueue *vq, AioContext *ctx,
void (*handle_output)(VirtIODevice *, VirtIOHandleOutput handle_output)
VirtQueue *))
{ {
if (handle_output) { if (handle_output) {
vq->handle_aio_output = handle_output; vq->handle_aio_output = handle_output;

View File

@ -138,9 +138,10 @@ void virtio_cleanup(VirtIODevice *vdev);
/* Set the child bus name. */ /* Set the child bus name. */
void virtio_device_set_child_bus_name(VirtIODevice *vdev, char *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, VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
void (*handle_output)(VirtIODevice *, VirtIOHandleOutput handle_output);
VirtQueue *));
void virtio_del_queue(VirtIODevice *vdev, int n); void virtio_del_queue(VirtIODevice *vdev, int n);