Skip to contentSkip to conversation

test: remove t_sqe_prep_cmd()

PATCH Applied Caleb Sander Mateos 2 participants 2 messages Oct 24, 2025 io_uring

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 test: remove t_sqe_prep_cmd()

t_sqe_prep_cmd() does the same thing as the recently added liburing function io_uring_prep_uring_cmd(). Switch to io_uring_prep_uring_cmd() to provide coverage of the real library function.

---
 test/helpers.h   | 7 -------
 test/mock_file.c | 6 +++---
 2 files changed, 3 insertions(+), 10 deletions(-)
test/helpers.h +0 -7
index cfada945..6317dcf2 100644
@@ -127,17 +127,10 @@ int t_submit_and_wait_single(struct io_uring *ring, struct io_uring_cqe **cqe);
 size_t t_iovec_data_length(struct iovec *iov, unsigned iov_len);
 
 unsigned long t_compare_data_iovec(struct iovec *iov_src, unsigned nr_src,
 				   struct iovec *iov_dst, unsigned nr_dst);
 
-static inline void t_sqe_prep_cmd(struct io_uring_sqe *sqe,
-				  int fd, unsigned cmd_op)
-{
-	io_uring_prep_rw(IORING_OP_URING_CMD, sqe, fd, NULL, 0, 0);
-	sqe->cmd_op = cmd_op;
-}
-
 #ifdef __cplusplus
 }
 #endif
 
 #endif
test/mock_file.c +3 -3
index 0614c09b..0f6460fc 100644
@@ -44,11 +44,11 @@ static int setup_mgr(void)
 		return T_EXIT_FAIL;
 	}
 
 	memset(&mp, 0, sizeof(mp));
 	sqe = io_uring_get_sqe(&mgr_ring);
-	t_sqe_prep_cmd(sqe, mgr_fd, IORING_MOCK_MGR_CMD_PROBE);
+	io_uring_prep_uring_cmd(sqe, IORING_MOCK_MGR_CMD_PROBE, mgr_fd);
 	sqe->addr  = (__u64)(unsigned long)∓
 	sqe->len = sizeof(mp);
 
 	ret = t_submit_and_wait_single(&mgr_ring, &cqe);
 	if (ret || cqe->res) {
@@ -66,11 +66,11 @@ static int create_mock_file(struct io_uring_mock_create *mc)
 	struct io_uring_cqe *cqe;
 	struct io_uring_sqe *sqe;
 	int ret;
 
 	sqe = io_uring_get_sqe(&mgr_ring);
-	t_sqe_prep_cmd(sqe, mgr_fd, IORING_MOCK_MGR_CMD_CREATE);
+	io_uring_prep_uring_cmd(sqe, IORING_MOCK_MGR_CMD_CREATE, mgr_fd);
 	sqe->addr  = (__u64)(unsigned long)mc;
 	sqe->len = sizeof(*mc);
 
 	ret = t_submit_and_wait_single(&mgr_ring, &cqe);
 	if (ret || cqe->res) {
@@ -88,11 +88,11 @@ static int t_copy_regvec(struct io_uring *ring, int mock_fd,
 	struct io_uring_cqe *cqe;
 	struct io_uring_sqe *sqe;
 	int ret;
 
 	sqe = io_uring_get_sqe(ring);
-	t_sqe_prep_cmd(sqe, mock_fd, IORING_MOCK_CMD_COPY_REGBUF);
+	io_uring_prep_uring_cmd(sqe, IORING_MOCK_CMD_COPY_REGBUF, mock_fd);
 	sqe->addr3 = (__u64)(unsigned long)buf;
 	sqe->addr = (__u64)(unsigned long)iov;
 	sqe->len = iov_len;
 	if (from_iov)
 		sqe->file_index = IORING_MOCK_COPY_FROM;
Signature · 1 line
2.45.2
maintainer Applied
#1 lore raw
Quoted 5 lines · Caleb Sander Mateos

t_sqe_prep_cmd() does the same thing as the recently added liburing function io_uring_prep_uring_cmd(). Switch to io_uring_prep_uring_cmd() to provide coverage of the real library function.

Applied, thanks!

[1/1] test: remove t_sqe_prep_cmd()

      commit: 4235cf5db414884887e4b5599311c59c31d71085

Best regards,

Signature · 1 line
Jens Axboe