xref: /openbmc/linux/io_uring/opdef.h (revision f30bd4d0)
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 	/* opcode is not supported by this kernel */
21329061d3SJens Axboe 	unsigned		not_supported : 1;
22329061d3SJens Axboe 	/* skip auditing */
23329061d3SJens Axboe 	unsigned		audit_skip : 1;
24329061d3SJens Axboe 	/* supports ioprio */
25329061d3SJens Axboe 	unsigned		ioprio : 1;
26329061d3SJens Axboe 	/* supports iopoll */
27329061d3SJens Axboe 	unsigned		iopoll : 1;
28ef0ec1adSPavel Begunkov 	/* have to be put into the iopoll list */
29ef0ec1adSPavel Begunkov 	unsigned		iopoll_queue : 1;
3059169439SPavel Begunkov 	/* opcode specific path will handle ->async_data allocation if needed */
3159169439SPavel Begunkov 	unsigned		manual_alloc : 1;
32*f30bd4d0SBreno Leitao 
33*f30bd4d0SBreno Leitao 	int (*issue)(struct io_kiocb *, unsigned int);
34*f30bd4d0SBreno Leitao 	int (*prep)(struct io_kiocb *, const struct io_uring_sqe *);
35*f30bd4d0SBreno Leitao };
36*f30bd4d0SBreno Leitao 
37*f30bd4d0SBreno Leitao struct io_cold_def {
38329061d3SJens Axboe 	/* size of async data needed, if any */
39329061d3SJens Axboe 	unsigned short		async_size;
40329061d3SJens Axboe 
41329061d3SJens Axboe 	const char		*name;
42329061d3SJens Axboe 
43329061d3SJens Axboe 	int (*prep_async)(struct io_kiocb *);
44329061d3SJens Axboe 	void (*cleanup)(struct io_kiocb *);
45a47b255eSPavel Begunkov 	void (*fail)(struct io_kiocb *);
46329061d3SJens Axboe };
47329061d3SJens Axboe 
48a7dd2782SBreno Leitao extern const struct io_issue_def io_issue_defs[];
49*f30bd4d0SBreno Leitao extern const struct io_cold_def io_cold_defs[];
50d9b57aa3SJens Axboe 
51d9b57aa3SJens Axboe void io_uring_optable_init(void);
52329061d3SJens Axboe #endif
53