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