]> git.proxmox.com Git - mirror_qemu.git/blame - block/raw-aio.h
virtio: revert host notifiers to old semantics
[mirror_qemu.git] / block / raw-aio.h
CommitLineData
9ef91a67 1/*
9f8540ec 2 * Declarations for AIO in the raw protocol
9ef91a67
CH
3 *
4 * Copyright IBM, Corp. 2008
5 *
6 * Authors:
7 * Anthony Liguori <aliguori@us.ibm.com>
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 *
6b620ca3
PB
12 * Contributions after 2012-01-13 are licensed under the terms of the
13 * GNU GPL, version 2 or (at your option) any later version.
9ef91a67 14 */
9f8540ec
PB
15#ifndef QEMU_RAW_AIO_H
16#define QEMU_RAW_AIO_H
9ef91a67 17
2174f12b 18#include "qemu/coroutine.h"
daf015ef
MA
19#include "qemu/iov.h"
20
9ef91a67
CH
21/* AIO request types */
22#define QEMU_AIO_READ 0x0001
23#define QEMU_AIO_WRITE 0x0002
24#define QEMU_AIO_IOCTL 0x0004
b2e12bc6 25#define QEMU_AIO_FLUSH 0x0008
8238010b 26#define QEMU_AIO_DISCARD 0x0010
97a2ae34 27#define QEMU_AIO_WRITE_ZEROES 0x0020
9ef91a67 28#define QEMU_AIO_TYPE_MASK \
8238010b 29 (QEMU_AIO_READ|QEMU_AIO_WRITE|QEMU_AIO_IOCTL|QEMU_AIO_FLUSH| \
97a2ae34 30 QEMU_AIO_DISCARD|QEMU_AIO_WRITE_ZEROES)
9ef91a67
CH
31
32/* AIO flags */
33#define QEMU_AIO_MISALIGNED 0x1000
8238010b 34#define QEMU_AIO_BLKDEV 0x2000
9ef91a67
CH
35
36
5c6c3a6c 37/* linux-aio.c - Linux native implementation */
9f8540ec 38#ifdef CONFIG_LINUX_AIO
dd7f7ed1
PB
39typedef struct LinuxAioState LinuxAioState;
40LinuxAioState *laio_init(void);
41void laio_cleanup(LinuxAioState *s);
2174f12b 42int coroutine_fn laio_co_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
9d52aa3c 43 uint64_t offset, QEMUIOVector *qiov, int type);
dd7f7ed1 44BlockAIOCB *laio_submit(BlockDriverState *bs, LinuxAioState *s, int fd,
5c6c3a6c 45 int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
097310b5 46 BlockCompletionFunc *cb, void *opaque, int type);
dd7f7ed1
PB
47void laio_detach_aio_context(LinuxAioState *s, AioContext *old_context);
48void laio_attach_aio_context(LinuxAioState *s, AioContext *new_context);
49void laio_io_plug(BlockDriverState *bs, LinuxAioState *s);
50void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s);
9f8540ec 51#endif
5c6c3a6c 52
a2736526
PB
53#ifdef _WIN32
54typedef struct QEMUWin32AIOState QEMUWin32AIOState;
55QEMUWin32AIOState *win32_aio_init(void);
99cc5989 56void win32_aio_cleanup(QEMUWin32AIOState *aio);
a2736526 57int win32_aio_attach(QEMUWin32AIOState *aio, HANDLE hfile);
7c84b1b8 58BlockAIOCB *win32_aio_submit(BlockDriverState *bs,
a2736526
PB
59 QEMUWin32AIOState *aio, HANDLE hfile,
60 int64_t sector_num, QEMUIOVector *qiov, int nb_sectors,
097310b5 61 BlockCompletionFunc *cb, void *opaque, int type);
85ebd381
SH
62void win32_aio_detach_aio_context(QEMUWin32AIOState *aio,
63 AioContext *old_context);
64void win32_aio_attach_aio_context(QEMUWin32AIOState *aio,
65 AioContext *new_context);
a2736526
PB
66#endif
67
9f8540ec 68#endif /* QEMU_RAW_AIO_H */