xref: /linux/io_uring/opdef.h (revision a1ff5a7d78a036d6c2178ee5acd6ba4946243800)
1329061d3SJens Axboe // SPDX-License-Identifier: GPL-2.0
2329061d3SJens Axboe #ifndef IOU_OP_DEF_H
3329061d3SJens Axboe #define IOU_OP_DEF_H
4329061d3SJens Axboe 
5a7dd2782SBreno Leitao struct io_issue_def {
6329061d3SJens Axboe 	/* needs req->file assigned */
7329061d3SJens Axboe 	unsigned		needs_file : 1;
8329061d3SJens Axboe 	/* should block plug */
9329061d3SJens Axboe 	unsigned		plug : 1;
10329061d3SJens Axboe 	/* hash wq insertion if file is a regular file */
11329061d3SJens Axboe 	unsigned		hash_reg_file : 1;
12329061d3SJens Axboe 	/* unbound wq insertion if file is a non-regular file */
13329061d3SJens Axboe 	unsigned		unbound_nonreg_file : 1;
14329061d3SJens Axboe 	/* set if opcode supports polled "wait" */
15329061d3SJens Axboe 	unsigned		pollin : 1;
16329061d3SJens Axboe 	unsigned		pollout : 1;
17329061d3SJens Axboe 	unsigned		poll_exclusive : 1;
18329061d3SJens Axboe 	/* op supports buffer selection */
19329061d3SJens Axboe 	unsigned		buffer_select : 1;
20329061d3SJens Axboe 	/* skip auditing */
21329061d3SJens Axboe 	unsigned		audit_skip : 1;
22329061d3SJens Axboe 	/* supports ioprio */
23329061d3SJens Axboe 	unsigned		ioprio : 1;
24329061d3SJens Axboe 	/* supports iopoll */
25329061d3SJens Axboe 	unsigned		iopoll : 1;
26ef0ec1adSPavel Begunkov 	/* have to be put into the iopoll list */
27ef0ec1adSPavel Begunkov 	unsigned		iopoll_queue : 1;
28d2d778fbSJens Axboe 	/* vectored opcode, set if 1) vectored, and 2) handler needs to know */
29d2d778fbSJens Axboe 	unsigned		vectored : 1;
30f30bd4d0SBreno Leitao 
31e10677a8SJens Axboe 	/* size of async data needed, if any */
32e10677a8SJens Axboe 	unsigned short		async_size;
33e10677a8SJens Axboe 
34f30bd4d0SBreno Leitao 	int (*issue)(struct io_kiocb *, unsigned int);
35f30bd4d0SBreno Leitao 	int (*prep)(struct io_kiocb *, const struct io_uring_sqe *);
36f30bd4d0SBreno Leitao };
37f30bd4d0SBreno Leitao 
38f30bd4d0SBreno Leitao struct io_cold_def {
39329061d3SJens Axboe 	const char		*name;
40329061d3SJens Axboe 
41329061d3SJens Axboe 	void (*cleanup)(struct io_kiocb *);
42a47b255eSPavel Begunkov 	void (*fail)(struct io_kiocb *);
43329061d3SJens Axboe };
44329061d3SJens Axboe 
45a7dd2782SBreno Leitao extern const struct io_issue_def io_issue_defs[];
46f30bd4d0SBreno Leitao extern const struct io_cold_def io_cold_defs[];
47d9b57aa3SJens Axboe 
48*3e05b222SGabriel Krisman Bertazi bool io_uring_op_supported(u8 opcode);
49*3e05b222SGabriel Krisman Bertazi 
50d9b57aa3SJens Axboe void io_uring_optable_init(void);
51329061d3SJens Axboe #endif
52