Skip to content

Commit 4dae9ac

Browse files
committed
nvme-print: change nvme_show_cmd_err cmd parameter to opcode
Since only cmd parameter opcode value used by the print function. Signed-off-by: Tokunori Ikegami <[email protected]>
1 parent 728d91e commit 4dae9ac

3 files changed

Lines changed: 11 additions & 16 deletions

File tree

nvme-print.c

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -522,34 +522,31 @@ void nvme_show_status(int status)
522522
ops->show_status(status);
523523
}
524524

525-
static void nvme_show_cmd_err(const char *msg, bool admin,
526-
struct nvme_passthru_cmd *cmd, int err)
525+
static void nvme_show_cmd_err(const char *msg, bool admin, __u8 opcode, int err)
527526
{
528527
if (!err)
529528
return;
530529
else if (err < 0)
531530
nvme_show_error("%s: %s", msg, nvme_strerror(-err));
532-
else if (cmd)
533-
nvme_show_opcode_status(err, admin, cmd->opcode);
531+
else if (opcode)
532+
nvme_show_opcode_status(err, admin, opcode);
534533
else
535534
nvme_show_status(err);
536535
}
537536

538537
void nvme_show_err(const char *msg, int err)
539538
{
540-
nvme_show_cmd_err(msg, false, NULL, err);
539+
nvme_show_cmd_err(msg, false, 0, err);
541540
}
542541

543-
void nvme_show_io_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
544-
int err)
542+
void nvme_show_io_cmd_err(const char *msg, __u8 opcode, int err)
545543
{
546-
nvme_show_cmd_err(msg, false, cmd, err);
544+
nvme_show_cmd_err(msg, false, opcode, err);
547545
}
548546

549-
void nvme_show_admin_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
550-
int err)
547+
void nvme_show_admin_cmd_err(const char *msg, __u8 opcode, int err)
551548
{
552-
nvme_show_cmd_err(msg, true, cmd, err);
549+
nvme_show_cmd_err(msg, true, opcode, err);
553550
}
554551

555552
void nvme_show_opcode_status(int status, bool admin, __u8 opcode)

nvme-print.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -162,10 +162,8 @@ struct print_ops *nvme_get_binary_print_ops(nvme_print_flags_t flags);
162162

163163
void nvme_show_status(int status);
164164
void nvme_show_err(const char *msg, int err);
165-
void nvme_show_io_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
166-
int err);
167-
void nvme_show_admin_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
168-
int err);
165+
void nvme_show_io_cmd_err(const char *msg, __u8 opcode, int err);
166+
void nvme_show_admin_cmd_err(const char *msg, __u8 opcode, int err);
169167
void nvme_show_opcode_status(int status, bool admin, __u8 opcode);
170168
void nvme_show_lba_status_info(__u64 result);
171169
void nvme_show_relatives(struct nvme_global_ctx *ctx, const char *name, nvme_print_flags_t flags);

nvme.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5751,7 +5751,7 @@ static int sanitize_ns_cmd(int argc, char **argv, struct command *acmd,
57515751
}
57525752
err = nvme_submit_admin_passthru(hdl, &cmd);
57535753
if (err) {
5754-
nvme_show_admin_cmd_err("sanitize ns", &cmd, err);
5754+
nvme_show_admin_cmd_err("sanitize ns", cmd.opcode, err);
57555755
return err;
57565756
}
57575757

0 commit comments

Comments
 (0)