Commit | Line | Data |
---|---|---|
329061d3 JA |
1 | // SPDX-License-Identifier: GPL-2.0 |
2 | ||
bcf8a029 CSM |
3 | #include <linux/io_uring_types.h> |
4 | ||
da22bdf3 JA |
5 | #define IO_POLL_ALLOC_CACHE_MAX 32 |
6 | ||
329061d3 JA |
7 | enum { |
8 | IO_APOLL_OK, | |
9 | IO_APOLL_ABORTED, | |
10 | IO_APOLL_READY | |
11 | }; | |
12 | ||
13 | struct io_poll { | |
14 | struct file *file; | |
15 | struct wait_queue_head *head; | |
16 | __poll_t events; | |
c16bda37 | 17 | int retries; |
329061d3 JA |
18 | struct wait_queue_entry wait; |
19 | }; | |
20 | ||
21 | struct async_poll { | |
414d0f45 | 22 | struct io_poll poll; |
329061d3 JA |
23 | struct io_poll *double_poll; |
24 | }; | |
25 | ||
c79f52f0 JA |
26 | /* |
27 | * Must only be called inside issue_flags & IO_URING_F_MULTISHOT, or | |
28 | * potentially other cases where we already "own" this poll request. | |
29 | */ | |
30 | static inline void io_poll_multishot_retry(struct io_kiocb *req) | |
31 | { | |
32 | atomic_inc(&req->poll_refs); | |
33 | } | |
34 | ||
329061d3 JA |
35 | int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); |
36 | int io_poll_add(struct io_kiocb *req, unsigned int issue_flags); | |
37 | ||
38 | int io_poll_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe); | |
39 | int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags); | |
40 | ||
ad163a7e | 41 | struct io_cancel_data; |
5d7943d9 PB |
42 | int io_poll_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd, |
43 | unsigned issue_flags); | |
329061d3 | 44 | int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags); |
f03baece | 45 | bool io_poll_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx, |
329061d3 | 46 | bool cancel_all); |
9da7471e | 47 | |
bcf8a029 | 48 | void io_poll_task_func(struct io_kiocb *req, io_tw_token_t tw); |