]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
io_uring/uring_cmd: add io_uring_cmd_tw_t type alias
authorCaleb Sander Mateos <csander@purestorage.com>
Tue, 2 Sep 2025 16:06:56 +0000 (10:06 -0600)
committerJens Axboe <axboe@kernel.dk>
Wed, 3 Sep 2025 01:21:12 +0000 (19:21 -0600)
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>
include/linux/io_uring/cmd.h
io_uring/uring_cmd.c

index 4bd3a7339243d88378fd6f5e9e3e0718b43c5de1..7211157edfe9e60bfaadf3072d3b277a5006b73a 100644 (file)
 /* io_uring_cmd is being issued again */
 #define IORING_URING_CMD_REISSUE       (1U << 31)
 
+typedef void (*io_uring_cmd_tw_t)(struct io_uring_cmd *cmd,
+                                 unsigned issue_flags);
+
 struct io_uring_cmd {
        struct file     *file;
        const struct io_uring_sqe *sqe;
        /* callback to defer completions to task context */
-       void (*task_work_cb)(struct io_uring_cmd *cmd, unsigned);
+       io_uring_cmd_tw_t task_work_cb;
        u32             cmd_op;
        u32             flags;
        u8              pdu[32]; /* available inline for free use */
@@ -57,7 +60,7 @@ void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret, u64 res2,
                        unsigned issue_flags);
 
 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
-                           void (*task_work_cb)(struct io_uring_cmd *, unsigned),
+                           io_uring_cmd_tw_t task_work_cb,
                            unsigned flags);
 
 /*
@@ -106,7 +109,7 @@ static inline void io_uring_cmd_done(struct io_uring_cmd *cmd, ssize_t ret,
 {
 }
 static inline void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
-                           void (*task_work_cb)(struct io_uring_cmd *, unsigned),
+                           io_uring_tw_t task_work_cb,
                            unsigned flags)
 {
 }
@@ -143,13 +146,13 @@ static inline void io_uring_cmd_iopoll_done(struct io_uring_cmd *ioucmd,
 
 /* users must follow the IOU_F_TWQ_LAZY_WAKE semantics */
 static inline void io_uring_cmd_do_in_task_lazy(struct io_uring_cmd *ioucmd,
-                       void (*task_work_cb)(struct io_uring_cmd *, unsigned))
+                       io_uring_cmd_tw_t task_work_cb)
 {
        __io_uring_cmd_do_in_task(ioucmd, task_work_cb, IOU_F_TWQ_LAZY_WAKE);
 }
 
 static inline void io_uring_cmd_complete_in_task(struct io_uring_cmd *ioucmd,
-                       void (*task_work_cb)(struct io_uring_cmd *, unsigned))
+                       io_uring_cmd_tw_t task_work_cb)
 {
        __io_uring_cmd_do_in_task(ioucmd, task_work_cb, 0);
 }
index f5a2642bb407365db5307e128c48a08808e4088e..d76d6d27765c356c564bd1a9aa46724ddebe8344 100644 (file)
@@ -126,7 +126,7 @@ static void io_uring_cmd_work(struct io_kiocb *req, io_tw_token_t tw)
 }
 
 void __io_uring_cmd_do_in_task(struct io_uring_cmd *ioucmd,
-                       void (*task_work_cb)(struct io_uring_cmd *, unsigned),
+                       io_uring_cmd_tw_t task_work_cb,
                        unsigned flags)
 {
        struct io_kiocb *req = cmd_to_io_kiocb(ioucmd);