aboutsummaryrefslogtreecommitdiff
path: root/include/block
diff options
context:
space:
mode:
authorStefan Hajnoczi <stefanha@redhat.com>2016-12-01 19:26:49 +0000
committerStefan Hajnoczi <stefanha@redhat.com>2017-01-03 16:38:50 +0000
commit684e508c23d28af8d6ed2c62738a0f60447c8274 (patch)
treeacf9dd6f848c5419b756d30124f9727dafb3553d /include/block
parentaff8fd18f1786fc5af259a9bc0077727222f51ca (diff)
downloadqemu-684e508c23d28af8d6ed2c62738a0f60447c8274.zip
qemu-684e508c23d28af8d6ed2c62738a0f60447c8274.tar.gz
qemu-684e508c23d28af8d6ed2c62738a0f60447c8274.tar.bz2
aio: add .io_poll_begin/end() callbacks
The begin and end callbacks can be used to prepare for the polling loop and clean up when polling stops. Note that they may only be called once for multiple aio_poll() calls if polling continues to succeed. Once polling fails the end callback is invoked before aio_poll() resumes file descriptor monitoring. Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com> Reviewed-by: Paolo Bonzini <pbonzini@redhat.com> Message-id: 20161201192652.9509-11-stefanha@redhat.com Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Diffstat (limited to 'include/block')
-rw-r--r--include/block/aio.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/include/block/aio.h b/include/block/aio.h
index 349143f..3817d17 100644
--- a/include/block/aio.h
+++ b/include/block/aio.h
@@ -137,6 +137,9 @@ struct AioContext {
/* Maximum polling time in nanoseconds */
int64_t poll_max_ns;
+ /* Are we in polling mode or monitoring file descriptors? */
+ bool poll_started;
+
/* epoll(7) state used when built with CONFIG_EPOLL */
int epollfd;
bool epoll_enabled;
@@ -339,6 +342,14 @@ void aio_set_fd_handler(AioContext *ctx,
AioPollFn *io_poll,
void *opaque);
+/* Set polling begin/end callbacks for a file descriptor that has already been
+ * registered with aio_set_fd_handler. Do nothing if the file descriptor is
+ * not registered.
+ */
+void aio_set_fd_poll(AioContext *ctx, int fd,
+ IOHandler *io_poll_begin,
+ IOHandler *io_poll_end);
+
/* Register an event notifier and associated callbacks. Behaves very similarly
* to event_notifier_set_handler. Unlike event_notifier_set_handler, these callbacks
* will be invoked when using aio_poll().
@@ -352,6 +363,15 @@ void aio_set_event_notifier(AioContext *ctx,
EventNotifierHandler *io_read,
AioPollFn *io_poll);
+/* Set polling begin/end callbacks for an event notifier that has already been
+ * registered with aio_set_event_notifier. Do nothing if the event notifier is
+ * not registered.
+ */
+void aio_set_event_notifier_poll(AioContext *ctx,
+ EventNotifier *notifier,
+ EventNotifierHandler *io_poll_begin,
+ EventNotifierHandler *io_poll_end);
+
/* Return a GSource that lets the main loop poll the file descriptors attached
* to this AioContext.
*/