~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/io_uring/cmd.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-or-later */
  2 #ifndef _LINUX_IO_URING_CMD_H
  3 #define _LINUX_IO_URING_CMD_H
  4 
  5 #include <uapi/linux/io_uring.h>
  6 #include <linux/io_uring_types.h>
  7 
  8 /* only top 8 bits of sqe->uring_cmd_flags for kernel internal use */
  9 #define IORING_URING_CMD_CANCELABLE     (1U << 30)
 10 
 11 struct io_uring_cmd {
 12         struct file     *file;
 13         const struct io_uring_sqe *sqe;
 14         /* callback to defer completions to task context */
 15         void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned);
 16         u32             cmd_op;
 17         u32             flags;
 18         u8              pdu[32]; /* available inline for free use */
 19 };
 20 
 21 static inline const void *io_uring_sqe_cmd(const struct io_uring_sqe *sqe)
 22 {
 23         return sqe->cmd;
 24 }
 25 
 26 #if defined(CONFIG_IO_URING)
 27 int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
 28                               struct iov_iter *iter, void *ioucmd);
 29 
 30 /*
 31  * Completes the request, i.e. posts an io_uring CQE and deallocates @ioucmd
 32  * and the corresponding io_uring request.
 33  *
 34  * Note: the caller should never hard code @issue_flags and is only allowed
 35  * to pass the mask provided by the core io_uring code.
 36  */
 37 void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, ssize_t res2,
 38                         unsigned issue_flags);
 39 
 40 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
 41                             void (*task_work_cb)(struct io_uring_cmd *, unsigned),
 42                             unsigned flags);
 43 
 44 /*
 45  * Note: the caller should never hard code @issue_flags and only use the
 46  * mask provided by the core io_uring code.
 47  */
 48 void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
 49                 unsigned int issue_flags);
 50 
 51 #else
 52 static inline int io_uring_cmd_import_fixed(u64 ubuf, unsigned long len, int rw,
 53                               struct iov_iter *iter, void *ioucmd)
 54 {
 55         return -EOPNOTSUPP;
 56 }
 57 static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
 58                 ssize_t ret2, unsigned issue_flags)
 59 {
 60 }
 61 static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
 62                             void (*task_work_cb)(struct io_uring_cmd *, unsigned),
 63                             unsigned flags)
 64 {
 65 }
 66 static inline void io_uring_cmd_mark_cancelable(struct io_uring_cmd *cmd,
 67                 unsigned int issue_flags)
 68 {
 69 }
 70 #endif
 71 
 72 /*
 73  * Polled completions must ensure they are coming from a poll queue, and
 74  * hence are completed inside the usual poll handling loops.
 75  */
 76 static inline void io_uring_cmd_iopoll_done(struct io_uring_cmd *ioucmd,
 77                                             ssize_t ret, ssize_t res2)
 78 {
 79         lockdep_assert(in_task());
 80         io_uring_cmd_done(ioucmd, ret, res2, 0);
 81 }
 82 
 83 /* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */
 84 static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
 85                         void (*task_work_cb)(struct io_uring_cmd *, unsigned))
 86 {
 87         __io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE);
 88 }
 89 
 90 static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
 91                         void (*task_work_cb)(struct io_uring_cmd *, unsigned))
 92 {
 93         __io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0);
 94 }
 95 
 96 static inline struct task_struct *io_uring_cmd_get_task(struct io_uring_cmd *cmd)
 97 {
 98         return cmd_to_io_kiocb(cmd)->task;
 99 }
100 
101 #endif /* _LINUX_IO_URING_CMD_H */
102 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php