Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

io_uring/uring_cmd: add io_uring_cmd_tw_t type alias

Introduce a function pointer type alias io_uring_cmd_tw_t for the
uring_cmd task work callback. This avoids repeating the signature in
several places. Also name both arguments to the callback to clarify what
they represent.

Signed-off-by: Caleb Sander Mateos <csander@purestorage.com>
Reviewed-by: Keith Busch <kbusch@kernel.org>
Link: https://lore.kernel.org/r/20250902160657.1726828-1-csander@purestorage.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>

authored by

Caleb Sander Mateos and committed by
Jens Axboe
df3a7762 8b9c9a2e

+9 -6
+8 -5
include/linux/io_uring/cmd.h
··· 11 11 /* io_uring_cmd is being issued again */ 12 12 #define IORING_URING_CMD_REISSUE (1U << 31) 13 13 14 + typedef void (*io_uring_cmd_tw_t)(struct io_uring_cmd *cmd, 15 + unsigned issue_flags); 16 + 14 17 struct io_uring_cmd { 15 18 struct file *file; 16 19 const struct io_uring_sqe *sqe; 17 20 /* callback to defer completions to task context */ 18 - void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned); 21 + io_uring_cmd_tw_t task_work_cb; 19 22 u32 cmd_op; 20 23 u32 flags; 21 24 u8 pdu[32]; /* available inline for free use */ ··· 60 57 unsigned issue_flags); 61 58 62 59 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, 63 - void (*task_work_cb)(struct io_uring_cmd *, unsigned), 60 + io_uring_cmd_tw_t task_work_cb, 64 61 unsigned flags); 65 62 66 63 /* ··· 109 106 { 110 107 } 111 108 static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, 112 - void (*task_work_cb)(struct io_uring_cmd *, unsigned), 109 + io_uring_tw_t task_work_cb, 113 110 unsigned flags) 114 111 { 115 112 } ··· 146 143 147 144 /* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */ 148 145 static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd, 149 - void (*task_work_cb)(struct io_uring_cmd *, unsigned)) 146 + io_uring_cmd_tw_t task_work_cb) 150 147 { 151 148 __io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE); 152 149 } 153 150 154 151 static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd, 155 - void (*task_work_cb)(struct io_uring_cmd *, unsigned)) 152 + io_uring_cmd_tw_t task_work_cb) 156 153 { 157 154 __io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0); 158 155 }
+1 -1
io_uring/uring_cmd.c
··· 126 126 } 127 127 128 128 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd, 129 - void (*task_work_cb)(struct io_uring_cmd *, unsigned), 129 + io_uring_cmd_tw_t task_work_cb, 130 130 unsigned flags) 131 131 { 132 132 struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);