xref: /linux/io_uring/opdef.h (revision 69050f8d6d075dc01af7a5f2f550a8067510366f)
1 // SPDX-License-Identifier: GPL-2.0
2 #ifndef IOU_OP_DEF_H
3 #define IOU_OP_DEF_H
4 
5 struct io_uring_bpf_ctx;
6 
7 struct io_issue_def {
8 	/* needs req->file assigned */
9 	unsigned		needs_file : 1;
10 	/* should block plug */
11 	unsigned		plug : 1;
12 	/* supports ioprio */
13 	unsigned		ioprio : 1;
14 	/* supports iopoll */
15 	unsigned		iopoll : 1;
16 	/* op supports buffer selection */
17 	unsigned		buffer_select : 1;
18 	/* hash wq insertion if file is a regular file */
19 	unsigned		hash_reg_file : 1;
20 	/* unbound wq insertion if file is a non-regular file */
21 	unsigned		unbound_nonreg_file : 1;
22 	/* set if opcode supports polled "wait" */
23 	unsigned		pollin : 1;
24 	unsigned		pollout : 1;
25 	unsigned		poll_exclusive : 1;
26 	/* skip auditing */
27 	unsigned		audit_skip : 1;
28 	/* have to be put into the iopoll list */
29 	unsigned		iopoll_queue : 1;
30 	/* vectored opcode, set if 1) vectored, and 2) handler needs to know */
31 	unsigned		vectored : 1;
32 	/* set to 1 if this opcode uses 128b sqes in a mixed sq */
33 	unsigned		is_128 : 1;
34 
35 	/* size of async data needed, if any */
36 	unsigned short		async_size;
37 
38 	/* bpf filter pdu size, if any */
39 	unsigned short		filter_pdu_size;
40 
41 	int (*issue)(struct io_kiocb *, unsigned int);
42 	int (*prep)(struct io_kiocb *, const struct io_uring_sqe *);
43 	void (*filter_populate)(struct io_uring_bpf_ctx *, struct io_kiocb *);
44 };
45 
46 struct io_cold_def {
47 	const char		*name;
48 
49 	void (*sqe_copy)(struct io_kiocb *);
50 	void (*cleanup)(struct io_kiocb *);
51 	void (*fail)(struct io_kiocb *);
52 };
53 
54 extern const struct io_issue_def io_issue_defs[];
55 extern const struct io_cold_def io_cold_defs[];
56 
57 bool io_uring_op_supported(u8 opcode);
58 
59 void io_uring_optable_init(void);
60 #endif
61