xref: /linux/io_uring/loop.h (revision 056e065a6b6e01ab54bb9770c0d5a15350e571e2)
1 // SPDX-License-Identifier: GPL-2.0
2 #ifndef IOU_LOOP_H
3 #define IOU_LOOP_H
4 
5 #include <linux/io_uring_types.h>
6 
7 struct iou_loop_params {
8 	/*
9 	 * The CQE index to wait for. Only serves as a hint and can still be
10 	 * woken up earlier.
11 	 */
12 	__u32			cq_wait_idx;
13 };
14 
15 enum {
16 	IOU_LOOP_CONTINUE = 0,
17 	IOU_LOOP_STOP,
18 };
19 
20 static inline bool io_has_loop_ops(struct io_ring_ctx *ctx)
21 {
22 	return data_race(ctx->loop_step);
23 }
24 
25 int io_run_loop(struct io_ring_ctx *ctx);
26 
27 static inline struct iou_ctx *io_loop_mangle_ctx(struct io_ring_ctx *ctx)
28 {
29 	return (struct iou_ctx *)ctx;
30 }
31 
32 static inline struct io_ring_ctx *io_loop_demangle_ctx(struct iou_ctx *ctx)
33 {
34 	return (struct io_ring_ctx *)ctx;
35 }
36 
37 #endif
38