Merge tag 'mm-hotfixes-stable-2025-07-11-16-16' of git://git.kernel.org/pub/scm/linux...
[linux-block.git] / io_uring / poll.h
CommitLineData
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
7enum {
8 IO_APOLL_OK,
9 IO_APOLL_ABORTED,
10 IO_APOLL_READY
11};
12
13struct 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
21struct 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 */
30static inline void io_poll_multishot_retry(struct io_kiocb *req)
31{
32 atomic_inc(&req->poll_refs);
33}
34
329061d3
JA
35int io_poll_add_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
36int io_poll_add(struct io_kiocb *req, unsigned int issue_flags);
37
38int io_poll_remove_prep(struct io_kiocb *req, const struct io_uring_sqe *sqe);
39int io_poll_remove(struct io_kiocb *req, unsigned int issue_flags);
40
ad163a7e 41struct io_cancel_data;
5d7943d9
PB
42int io_poll_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd,
43 unsigned issue_flags);
329061d3 44int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags);
f03baece 45bool io_poll_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,
329061d3 46 bool cancel_all);
9da7471e 47
bcf8a029 48void io_poll_task_func(struct io_kiocb *req, io_tw_token_t tw);