Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 13 additions & 2 deletions nvme-print.c
Original file line number Diff line number Diff line change
Expand Up @@ -534,9 +534,20 @@ static void nvme_show_cmd_err(const char *msg, bool admin, __u8 opcode, int err)
nvme_show_status(err);
}

void nvme_show_err(const char *msg, int err)
void nvme_show_err(int err, const char *fmt, ...)
{
nvme_show_cmd_err(msg, false, 0, err);
va_list ap;

_cleanup_free_ char *msg = NULL;

va_start(ap, fmt);

if (vasprintf(&msg, fmt, ap) < 0)
msg = NULL;

nvme_show_cmd_err(msg ? msg : alloc_error, false, 0, err);

va_end(ap);
}

void nvme_show_io_cmd_err(const char *msg, __u8 opcode, int err)
Expand Down
2 changes: 1 addition & 1 deletion nvme-print.h
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ struct print_ops *nvme_get_stdout_print_ops(nvme_print_flags_t flags);
struct print_ops *nvme_get_binary_print_ops(nvme_print_flags_t flags);

void nvme_show_status(int status);
void nvme_show_err(const char *msg, int err);
void nvme_show_err(int err, const char *fmt, ...);
void nvme_show_io_cmd_err(const char *msg, __u8 opcode, int err);
void nvme_show_admin_cmd_err(const char *msg, __u8 opcode, int err);
void nvme_show_opcode_status(int status, bool admin, __u8 opcode);
Expand Down
Loading
Loading