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
1// SPDX-License-Identifier: GPL-2.0
2
3#include <linux/io_uring_types.h>
4
5#define IO_POLL_ALLOC_CACHE_MAX 32
6
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;
17 int retries;
18 struct wait_queue_entry wait;
19};
20
21struct async_poll {
22 struct io_poll poll;
23 struct io_poll *double_poll;
24};
25
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
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
41struct io_cancel_data;
42int io_poll_cancel(struct io_ring_ctx *ctx, struct io_cancel_data *cd,
43 unsigned issue_flags);
44int io_arm_poll_handler(struct io_kiocb *req, unsigned issue_flags);
45bool io_poll_remove_all(struct io_ring_ctx *ctx, struct io_uring_task *tctx,
46 bool cancel_all);
47
48void io_poll_task_func(struct io_kiocb *req, io_tw_token_t tw);