]>
Commit | Line | Data |
---|---|---|
3c529d93 AL |
1 | /* |
2 | * QEMU posix-aio emulation | |
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_POSIX_AIO_COMPAT_H | |
15 | #define QEMU_POSIX_AIO_COMPAT_H | |
16 | ||
17 | #include <sys/types.h> | |
18 | #include <unistd.h> | |
19 | #include <signal.h> | |
20 | ||
21 | #include "sys-queue.h" | |
22 | ||
23 | #define QEMU_PAIO_CANCELED 0x01 | |
24 | #define QEMU_PAIO_NOTCANCELED 0x02 | |
25 | #define QEMU_PAIO_ALLDONE 0x03 | |
26 | ||
27 | struct qemu_paiocb | |
28 | { | |
29 | int aio_fildes; | |
f141eafe AL |
30 | union { |
31 | struct iovec *aio_iov; | |
32 | void *aio_ioctl_buf; | |
33 | }; | |
34 | int aio_niov; | |
3c529d93 | 35 | size_t aio_nbytes; |
221f715d | 36 | #define aio_ioctl_cmd aio_nbytes /* for QEMU_PAIO_IOCTL */ |
55f11ca3 | 37 | int ev_signo; |
3c529d93 | 38 | off_t aio_offset; |
f141eafe AL |
39 | unsigned aio_flags; |
40 | /* 512 byte alignment required for buffer, offset and length */ | |
41 | #define QEMU_AIO_SECTOR_ALIGNED 0x01 | |
3c529d93 AL |
42 | |
43 | /* private */ | |
44 | TAILQ_ENTRY(qemu_paiocb) node; | |
221f715d AL |
45 | int aio_type; |
46 | #define QEMU_PAIO_READ 0x01 | |
47 | #define QEMU_PAIO_WRITE 0x02 | |
48 | #define QEMU_PAIO_IOCTL 0x03 | |
3c529d93 AL |
49 | ssize_t ret; |
50 | int active; | |
51 | }; | |
52 | ||
53 | struct qemu_paioinit | |
54 | { | |
55 | unsigned int aio_threads; | |
56 | unsigned int aio_num; | |
57 | unsigned int aio_idle_time; | |
58 | }; | |
59 | ||
60 | int qemu_paio_init(struct qemu_paioinit *aioinit); | |
61 | int qemu_paio_read(struct qemu_paiocb *aiocb); | |
62 | int qemu_paio_write(struct qemu_paiocb *aiocb); | |
221f715d | 63 | int qemu_paio_ioctl(struct qemu_paiocb *aiocb); |
3c529d93 AL |
64 | int qemu_paio_error(struct qemu_paiocb *aiocb); |
65 | ssize_t qemu_paio_return(struct qemu_paiocb *aiocb); | |
66 | int qemu_paio_cancel(int fd, struct qemu_paiocb *aiocb); | |
67 | ||
68 | #endif |