opdef.h 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. // SPDX-License-Identifier: GPL-2.0
  2. #ifndef IOU_OP_DEF_H
  3. #define IOU_OP_DEF_H
  4. struct io_issue_def {
  5. /* needs req->file assigned */
  6. unsigned needs_file : 1;
  7. /* should block plug */
  8. unsigned plug : 1;
  9. /* hash wq insertion if file is a regular file */
  10. unsigned hash_reg_file : 1;
  11. /* unbound wq insertion if file is a non-regular file */
  12. unsigned unbound_nonreg_file : 1;
  13. /* set if opcode supports polled "wait" */
  14. unsigned pollin : 1;
  15. unsigned pollout : 1;
  16. unsigned poll_exclusive : 1;
  17. /* op supports buffer selection */
  18. unsigned buffer_select : 1;
  19. /* skip auditing */
  20. unsigned audit_skip : 1;
  21. /* supports ioprio */
  22. unsigned ioprio : 1;
  23. /* supports iopoll */
  24. unsigned iopoll : 1;
  25. /* have to be put into the iopoll list */
  26. unsigned iopoll_queue : 1;
  27. /* vectored opcode, set if 1) vectored, and 2) handler needs to know */
  28. unsigned vectored : 1;
  29. /* size of async data needed, if any */
  30. unsigned short async_size;
  31. int (*issue)(struct io_kiocb *, unsigned int);
  32. int (*prep)(struct io_kiocb *, const struct io_uring_sqe *);
  33. };
  34. struct io_cold_def {
  35. const char *name;
  36. void (*cleanup)(struct io_kiocb *);
  37. void (*fail)(struct io_kiocb *);
  38. };
  39. extern const struct io_issue_def io_issue_defs[];
  40. extern const struct io_cold_def io_cold_defs[];
  41. bool io_uring_op_supported(u8 opcode);
  42. void io_uring_optable_init(void);
  43. #endif