From patchwork Thu Feb 21 12:54:48 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: [4/9] event poll: pass event type to event callback From: pingfan liu X-Patchwork-Id: 222278 Message-Id: <1361451293-5181-5-git-send-email-qemulist@gmail.com> To: qemu-devel@nongnu.org Cc: Stefan Hajnoczi , Anthony Liguori Date: Thu, 21 Feb 2013 20:54:48 +0800 From: Liu Ping Fan With this extra arg -- event type, we can support the standard events dispatched by epoll_wait() Signed-off-by: Liu Ping Fan --- hw/dataplane/event-poll.c | 4 ++-- hw/dataplane/event-poll.h | 2 +- hw/dataplane/virtio-blk.c | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/hw/dataplane/event-poll.c b/hw/dataplane/event-poll.c index b7dea53..e19f3f3 100644 --- a/hw/dataplane/event-poll.c +++ b/hw/dataplane/event-poll.c @@ -69,7 +69,7 @@ void event_poll_modify_fd(EventPoll *poll, int fd, uint32_t type, } /* Event callback for stopping event_poll() */ -static void handle_stop(EventHandler *handler) +static void handle_stop(EventHandler *handler, uint32_t events) { /* Do nothing */ } @@ -123,7 +123,7 @@ void event_poll(EventPoll *poll) event_notifier_test_and_clear(handler->notifier); /* Handle the event */ - handler->callback(handler); + handler->callback(handler, event.events); } /* Stop event_poll() diff --git a/hw/dataplane/event-poll.h b/hw/dataplane/event-poll.h index 606138c..ff9712b 100644 --- a/hw/dataplane/event-poll.h +++ b/hw/dataplane/event-poll.h @@ -18,7 +18,7 @@ #include "qemu/event_notifier.h" typedef struct EventHandler EventHandler; -typedef void EventCallback(EventHandler *handler); +typedef void EventCallback(EventHandler *handler, uint32_t events); struct EventHandler { EventNotifier *notifier; /* eventfd */ EventCallback *callback; /* callback function */ diff --git a/hw/dataplane/virtio-blk.c b/hw/dataplane/virtio-blk.c index 4c4ad84..b60211a 100644 --- a/hw/dataplane/virtio-blk.c +++ b/hw/dataplane/virtio-blk.c @@ -206,7 +206,7 @@ static int process_request(IOQueue *ioq, struct iovec iov[], return 0; } -static void handle_notify(EventHandler *handler) +static void handle_notify(EventHandler *handler, uint32_t type) { VirtIOBlockDataPlane *s = container_of(handler, VirtIOBlockDataPlane, notify_handler); @@ -284,7 +284,7 @@ static void handle_notify(EventHandler *handler) } } -static void handle_io(EventHandler *handler) +static void handle_io(EventHandler *handler, uint32_t type) { VirtIOBlockDataPlane *s = container_of(handler, VirtIOBlockDataPlane, io_handler); @@ -298,7 +298,7 @@ static void handle_io(EventHandler *handler) * requests. */ if (unlikely(vring_more_avail(&s->vring))) { - handle_notify(&s->notify_handler); + handle_notify(&s->notify_handler, type); } }