Skip to content

Commit 25aaa81

Browse files
calebsanderaxboe
authored andcommitted
selftests: ublk: specify io_cmd_buf pointer type
Matching the ublk driver, change the type of io_cmd_buf from char * to struct ublksrv_io_desc *. Signed-off-by: Caleb Sander Mateos <[email protected]> Reviewed-by: Ming Lei <[email protected]> Acked-by: Shuah Khan <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Jens Axboe <[email protected]>
1 parent 9a45714 commit 25aaa81

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

tools/testing/selftests/ublk/kublk.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -322,7 +322,7 @@ static int ublk_queue_init(struct ublk_queue *q)
322322

323323
cmd_buf_size = ublk_queue_cmd_buf_sz(q);
324324
off = UBLKSRV_CMD_BUF_OFFSET + q->q_id * ublk_queue_max_cmd_buf_sz();
325-
q->io_cmd_buf = (char *)mmap(0, cmd_buf_size, PROT_READ,
325+
q->io_cmd_buf = mmap(0, cmd_buf_size, PROT_READ,
326326
MAP_SHARED | MAP_POPULATE, dev->fds[0], off);
327327
if (q->io_cmd_buf == MAP_FAILED) {
328328
ublk_err("ublk dev %d queue %d map io_cmd_buf failed %m\n",

tools/testing/selftests/ublk/kublk.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -128,7 +128,7 @@ struct ublk_queue {
128128
unsigned int io_inflight;
129129
struct ublk_dev *dev;
130130
const struct ublk_tgt_ops *tgt_ops;
131-
char *io_cmd_buf;
131+
struct ublksrv_io_desc *io_cmd_buf;
132132
struct io_uring ring;
133133
struct ublk_io ios[UBLK_QUEUE_DEPTH];
134134
#define UBLKSRV_QUEUE_STOPPING (1U << 0)
@@ -302,7 +302,7 @@ static inline void ublk_mark_io_done(struct ublk_io *io, int res)
302302

303303
static inline const struct ublksrv_io_desc *ublk_get_iod(const struct ublk_queue *q, int tag)
304304
{
305-
return (struct ublksrv_io_desc *)&(q->io_cmd_buf[tag * sizeof(struct ublksrv_io_desc)]);
305+
return &q->io_cmd_buf[tag];
306306
}
307307

308308
static inline void ublk_set_sqe_cmd_op(struct io_uring_sqe *sqe, __u32 cmd_op)

0 commit comments

Comments
 (0)