]> git.proxmox.com Git - mirror_qemu.git/blame - util/aio-posix.h
aio-posix: simplify FDMonOps->update() prototype
[mirror_qemu.git] / util / aio-posix.h
CommitLineData
1f050a46
SH
1/*
2 * AioContext POSIX event loop implementation internal APIs
3 *
4 * Copyright IBM, Corp. 2008
5 * Copyright Red Hat, Inc. 2020
6 *
7 * Authors:
8 * Anthony Liguori <aliguori@us.ibm.com>
9 *
10 * This work is licensed under the terms of the GNU GPL, version 2. See
11 * the COPYING file in the top-level directory.
12 *
13 * Contributions after 2012-01-13 are licensed under the terms of the
14 * GNU GPL, version 2 or (at your option) any later version.
15 */
16
17#ifndef AIO_POSIX_H
18#define AIO_POSIX_H
19
20#include "block/aio.h"
21
22struct AioHandler {
23 GPollFD pfd;
24 IOHandler *io_read;
25 IOHandler *io_write;
26 AioPollFn *io_poll;
27 IOHandler *io_poll_begin;
28 IOHandler *io_poll_end;
29 void *opaque;
30 bool is_external;
31 QLIST_ENTRY(AioHandler) node;
32 QLIST_ENTRY(AioHandler) node_ready; /* only used during aio_poll() */
33 QLIST_ENTRY(AioHandler) node_deleted;
34};
35
36/* Add a handler to a ready list */
37void aio_add_ready_handler(AioHandlerList *ready_list, AioHandler *node,
38 int revents);
39
40extern const FDMonOps fdmon_poll_ops;
41
42#ifdef CONFIG_EPOLL_CREATE1
43bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd);
44void fdmon_epoll_setup(AioContext *ctx);
45void fdmon_epoll_disable(AioContext *ctx);
46#else
47static inline bool fdmon_epoll_try_upgrade(AioContext *ctx, unsigned npfd)
48{
49 return false;
50}
51
52static inline void fdmon_epoll_setup(AioContext *ctx)
53{
54}
55
56static inline void fdmon_epoll_disable(AioContext *ctx)
57{
58}
59#endif /* !CONFIG_EPOLL_CREATE1 */
60
61#endif /* AIO_POSIX_H */