[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PATCH 4/9] event poll: pass event type to event callback
From: |
Liu Ping Fan |
Subject: |
[Qemu-devel] [PATCH 4/9] event poll: pass event type to event callback |
Date: |
Thu, 21 Feb 2013 20:54:48 +0800 |
From: Liu Ping Fan <address@hidden>
With this extra arg -- event type, we can support the standard
events dispatched by epoll_wait()
Signed-off-by: Liu Ping Fan <address@hidden>
---
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);
}
}
--
1.7.4.4
- [Qemu-devel] [PATCH 0/9] introduce virtio net dataplane, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 2/9] vring: introduce vring_restore() to restore from img, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 3/9] event poll: make epoll work for normal fd, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 4/9] event poll: pass event type to event callback,
Liu Ping Fan <=
- [Qemu-devel] [PATCH 5/9] event poll: enable event poll handle more than one event each time, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 6/9] virtio net: introduce dataplane for virtio net, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 7/9] tap: make tap peer work on dedicated data-plane thread, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 8/9] virtio net: enable dataplane for virtio net, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 9/9] configure: make virtio net dataplane configurable, Liu Ping Fan, 2013/02/21
- [Qemu-devel] [PATCH 1/9] vring: split the modification and publish of used ring, Liu Ping Fan, 2013/02/21