From: Fam Zheng <famz@redhat.com>
To: qemu-devel@nongnu.org
Cc: Jeff Cody <jcody@redhat.com>, Kevin Wolf <kwolf@redhat.com>,
Max Reitz <mreitz@redhat.com>,
Stefan Hajnoczi <stefanha@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
Paolo Bonzini <pbonzini@redhat.com>,
qemu-block@nongnu.org
Subject: [Qemu-devel] [PATCH 1/4] virtio: Add typedef for handle_output
Date: Fri, 24 Jun 2016 13:12:24 +0800 [thread overview]
Message-ID: <20160624051227.8417-2-famz@redhat.com> (raw)
In-Reply-To: <20160624051227.8417-1-famz@redhat.com>
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>
---
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 7ed06ea..e1e93c7 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);
+ VirtQueueHandleOutput handle_output;
+ VirtQueueHandleOutput 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 *))
+ VirtQueueHandleOutput handle_output)
{
int i;
@@ -1794,8 +1794,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 *))
+ VirtQueueHandleOutput 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 96b581d..faec22a 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 (*VirtQueueHandleOutput)(VirtIODevice *, VirtQueue *);
+
VirtQueue *virtio_add_queue(VirtIODevice *vdev, int queue_size,
- void (*handle_output)(VirtIODevice *,
- VirtQueue *));
+ VirtQueueHandleOutput handle_output);
void virtio_del_queue(VirtIODevice *vdev, int n);
--
2.8.3
next prev parent reply other threads:[~2016-06-24 5:12 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-06-24 5:12 [Qemu-devel] [PATCH 0/4] virtio: Merge two host notifier handling paths Fam Zheng
2016-06-24 5:12 ` Fam Zheng [this message]
2016-06-24 5:12 ` [Qemu-devel] [PATCH 2/4] virtio: Always use aio path to set host handler Fam Zheng
2016-06-24 6:39 ` Paolo Bonzini
2016-06-24 7:25 ` Fam Zheng
2016-06-24 5:12 ` [Qemu-devel] [PATCH 3/4] virtio: Drop the unused virtio_queue_set_host_notifier_fd_handler code Fam Zheng
2016-06-24 5:12 ` [Qemu-devel] [PATCH 4/4] Revert "mirror: Workaround for unexpected iohandler events during completion" Fam Zheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160624051227.8417-2-famz@redhat.com \
--to=famz@redhat.com \
--cc=jcody@redhat.com \
--cc=kwolf@redhat.com \
--cc=mreitz@redhat.com \
--cc=mst@redhat.com \
--cc=pbonzini@redhat.com \
--cc=qemu-block@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=stefanha@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).