Skip to content

Commit bca4846

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 f28da7e commit bca4846

3 files changed

Lines changed: 11 additions & 15 deletions

File tree

nvme-print.c

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -522,15 +522,15 @@ 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,
526+
int err)
527527
{
528528
if (!err)
529529
return;
530530
else if (err < 0)
531531
nvme_show_error("%s: %s", msg, nvme_strerror(-err));
532-
else if (cmd)
533-
nvme_show_opcode_status(err, false, cmd->opcode);
532+
else if (opcode)
533+
nvme_show_opcode_status(err, false, *opcode);
534534
else
535535
nvme_show_status(err);
536536
}
@@ -540,16 +540,14 @@ void nvme_show_err(const char *msg, int err)
540540
nvme_show_cmd_err(msg, false, NULL, err);
541541
}
542542

543-
void nvme_show_io_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
544-
int err)
543+
void nvme_show_io_cmd_err(const char *msg, __u8 opcode, int err)
545544
{
546-
nvme_show_cmd_err(msg, false, cmd, err);
545+
nvme_show_cmd_err(msg, false, &opcode, err);
547546
}
548547

549-
void nvme_show_admin_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
550-
int err)
548+
void nvme_show_admin_cmd_err(const char *msg, __u8 opcode, int err)
551549
{
552-
nvme_show_cmd_err(msg, true, cmd, err);
550+
nvme_show_cmd_err(msg, true, &opcode, err);
553551
}
554552

555553
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
@@ -161,10 +161,8 @@ struct print_ops *nvme_get_binary_print_ops(nvme_print_flags_t flags);
161161

162162
void nvme_show_status(int status);
163163
void nvme_show_err(const char *msg, int err);
164-
void nvme_show_io_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
165-
int err);
166-
void nvme_show_admin_cmd_err(const char *msg, struct nvme_passthru_cmd *cmd,
167-
int err);
164+
void nvme_show_io_cmd_err(const char *msg, __u8 opcode, int err);
165+
void nvme_show_admin_cmd_err(const char *msg, __u8 opcode, int err);
168166
void nvme_show_opcode_status(int status, bool admin, __u8 opcode);
169167
void nvme_show_lba_status_info(__u64 result);
170168
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)