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 /* vectored opcode, set if 1) vectored, and 2) handler needs to know */ 29 unsigned vectored : 1; 30 /* set to 1 if this opcode uses 128b sqes in a mixed sq */ 31 unsigned is_128 : 1; 32 33 /* size of async data needed, if any */ 34 unsigned short async_size; 35 36 /* bpf filter pdu size, if any */ 37 unsigned short filter_pdu_size; 38 39 int (*issue)(struct io_kiocb *, unsigned int); 40 int (*prep)(struct io_kiocb *, const struct io_uring_sqe *); 41 void (*filter_populate)(struct io_uring_bpf_ctx *, struct io_kiocb *); 42 }; 43 44 struct io_cold_def { 45 const char *name; 46 47 void (*sqe_copy)(struct io_kiocb *); 48 void (*cleanup)(struct io_kiocb *); 49 void (*fail)(struct io_kiocb *); 50 }; 51 52 extern const struct io_issue_def io_issue_defs[]; 53 extern const struct io_cold_def io_cold_defs[]; 54 55 bool io_uring_op_supported(u8 opcode); 56 57 void io_uring_optable_init(void); 58 #endif 59