162306a36Sopenharmony_ci// SPDX-License-Identifier: GPL-2.0
262306a36Sopenharmony_ci#ifndef IOU_OP_DEF_H
362306a36Sopenharmony_ci#define IOU_OP_DEF_H
462306a36Sopenharmony_ci
562306a36Sopenharmony_cistruct io_issue_def {
662306a36Sopenharmony_ci	/* needs req->file assigned */
762306a36Sopenharmony_ci	unsigned		needs_file : 1;
862306a36Sopenharmony_ci	/* should block plug */
962306a36Sopenharmony_ci	unsigned		plug : 1;
1062306a36Sopenharmony_ci	/* hash wq insertion if file is a regular file */
1162306a36Sopenharmony_ci	unsigned		hash_reg_file : 1;
1262306a36Sopenharmony_ci	/* unbound wq insertion if file is a non-regular file */
1362306a36Sopenharmony_ci	unsigned		unbound_nonreg_file : 1;
1462306a36Sopenharmony_ci	/* set if opcode supports polled "wait" */
1562306a36Sopenharmony_ci	unsigned		pollin : 1;
1662306a36Sopenharmony_ci	unsigned		pollout : 1;
1762306a36Sopenharmony_ci	unsigned		poll_exclusive : 1;
1862306a36Sopenharmony_ci	/* op supports buffer selection */
1962306a36Sopenharmony_ci	unsigned		buffer_select : 1;
2062306a36Sopenharmony_ci	/* opcode is not supported by this kernel */
2162306a36Sopenharmony_ci	unsigned		not_supported : 1;
2262306a36Sopenharmony_ci	/* skip auditing */
2362306a36Sopenharmony_ci	unsigned		audit_skip : 1;
2462306a36Sopenharmony_ci	/* supports ioprio */
2562306a36Sopenharmony_ci	unsigned		ioprio : 1;
2662306a36Sopenharmony_ci	/* supports iopoll */
2762306a36Sopenharmony_ci	unsigned		iopoll : 1;
2862306a36Sopenharmony_ci	/* have to be put into the iopoll list */
2962306a36Sopenharmony_ci	unsigned		iopoll_queue : 1;
3062306a36Sopenharmony_ci	/* opcode specific path will handle ->async_data allocation if needed */
3162306a36Sopenharmony_ci	unsigned		manual_alloc : 1;
3262306a36Sopenharmony_ci
3362306a36Sopenharmony_ci	int (*issue)(struct io_kiocb *, unsigned int);
3462306a36Sopenharmony_ci	int (*prep)(struct io_kiocb *, const struct io_uring_sqe *);
3562306a36Sopenharmony_ci};
3662306a36Sopenharmony_ci
3762306a36Sopenharmony_cistruct io_cold_def {
3862306a36Sopenharmony_ci	/* size of async data needed, if any */
3962306a36Sopenharmony_ci	unsigned short		async_size;
4062306a36Sopenharmony_ci
4162306a36Sopenharmony_ci	const char		*name;
4262306a36Sopenharmony_ci
4362306a36Sopenharmony_ci	int (*prep_async)(struct io_kiocb *);
4462306a36Sopenharmony_ci	void (*cleanup)(struct io_kiocb *);
4562306a36Sopenharmony_ci	void (*fail)(struct io_kiocb *);
4662306a36Sopenharmony_ci};
4762306a36Sopenharmony_ci
4862306a36Sopenharmony_ciextern const struct io_issue_def io_issue_defs[];
4962306a36Sopenharmony_ciextern const struct io_cold_def io_cold_defs[];
5062306a36Sopenharmony_ci
5162306a36Sopenharmony_civoid io_uring_optable_init(void);
5262306a36Sopenharmony_ci#endif
53