root / qemu-aio.h @ fc9902d9
History | View | Annotate | Download (1.4 kB)
1 | a76bab49 | aliguori | /*
|
---|---|---|---|
2 | a76bab49 | aliguori | * QEMU aio implementation
|
3 | a76bab49 | aliguori | *
|
4 | a76bab49 | aliguori | * Copyright IBM, Corp. 2008
|
5 | a76bab49 | aliguori | *
|
6 | a76bab49 | aliguori | * Authors:
|
7 | a76bab49 | aliguori | * Anthony Liguori <aliguori@us.ibm.com>
|
8 | a76bab49 | aliguori | *
|
9 | a76bab49 | aliguori | * This work is licensed under the terms of the GNU GPL, version 2. See
|
10 | a76bab49 | aliguori | * the COPYING file in the top-level directory.
|
11 | a76bab49 | aliguori | *
|
12 | a76bab49 | aliguori | */
|
13 | a76bab49 | aliguori | |
14 | a76bab49 | aliguori | #ifndef QEMU_AIO_H
|
15 | a76bab49 | aliguori | #define QEMU_AIO_H
|
16 | a76bab49 | aliguori | |
17 | a76bab49 | aliguori | #include "qemu-common.h" |
18 | a76bab49 | aliguori | #include "qemu-char.h" |
19 | a76bab49 | aliguori | |
20 | a76bab49 | aliguori | /* Returns 1 if there are still outstanding AIO requests; 0 otherwise */
|
21 | a76bab49 | aliguori | typedef int (AioFlushHandler)(void *opaque); |
22 | a76bab49 | aliguori | |
23 | a76bab49 | aliguori | /* Flush any pending AIO operation. This function will block until all
|
24 | a76bab49 | aliguori | * outstanding AIO operations have been completed or cancelled. */
|
25 | a76bab49 | aliguori | void qemu_aio_flush(void); |
26 | a76bab49 | aliguori | |
27 | a76bab49 | aliguori | /* Wait for a single AIO completion to occur. This function will until a
|
28 | a76bab49 | aliguori | * single AIO opeartion has completed. It is intended to be used as a looping
|
29 | a76bab49 | aliguori | * primative when simulating synchronous IO based on asynchronous IO. */
|
30 | a76bab49 | aliguori | void qemu_aio_wait(void); |
31 | a76bab49 | aliguori | |
32 | a76bab49 | aliguori | /* Register a file descriptor and associated callbacks. Behaves very similarly
|
33 | a76bab49 | aliguori | * to qemu_set_fd_handler2. Unlike qemu_set_fd_handler2, these callbacks will
|
34 | a76bab49 | aliguori | * be invoked when using either qemu_aio_wait() or qemu_aio_flush().
|
35 | a76bab49 | aliguori | *
|
36 | a76bab49 | aliguori | * Code that invokes AIO completion functions should rely on this function
|
37 | a76bab49 | aliguori | * instead of qemu_set_fd_handler[2].
|
38 | a76bab49 | aliguori | */
|
39 | a76bab49 | aliguori | int qemu_aio_set_fd_handler(int fd, |
40 | a76bab49 | aliguori | IOHandler *io_read, |
41 | a76bab49 | aliguori | IOHandler *io_write, |
42 | a76bab49 | aliguori | AioFlushHandler *io_flush, |
43 | a76bab49 | aliguori | void *opaque);
|
44 | a76bab49 | aliguori | |
45 | a76bab49 | aliguori | #endif |