2 * QEMU aio implementation
4 * Copyright IBM, Corp. 2008
7 * Anthony Liguori <aliguori@us.ibm.com>
9 * This work is licensed under the terms of the GNU GPL, version 2. See
10 * the COPYING file in the top-level directory.
17 #include "qemu-common.h"
18 #include "qemu-char.h"
20 /* Returns 1 if there are still outstanding AIO requests; 0 otherwise */
21 typedef int (AioFlushHandler
)(void *opaque
);
23 /* Flush any pending AIO operation. This function will block until all
24 * outstanding AIO operations have been completed or cancelled. */
25 void qemu_aio_flush(void);
27 /* Wait for a single AIO completion to occur. This function will wait
28 * until a single AIO event has completed and it will ensure something
29 * has moved before returning. This can issue new pending aio as
30 * result of executing I/O completion or bh callbacks. */
31 void qemu_aio_wait(void);
33 /* Register a file descriptor and associated callbacks. Behaves very similarly
34 * to qemu_set_fd_handler2. Unlike qemu_set_fd_handler2, these callbacks will
35 * be invoked when using either qemu_aio_wait() or qemu_aio_flush().
37 * Code that invokes AIO completion functions should rely on this function
38 * instead of qemu_set_fd_handler[2].
40 int qemu_aio_set_fd_handler(int fd
,
43 AioFlushHandler
*io_flush
,