putchar(*(buf+i));
}
-void nvme_show_status(__u16 status)
-{
- fprintf(stderr, "NVMe status: %s(%#x)\n",
- nvme_status_to_string(status, false), status);
+void nvme_show_status(int status)
+{
+ int val = nvme_status_get_value(status);
+ int type = nvme_status_get_type(status);
+
+ /* Callers should be checking for negative values first, but provide a
+ * sensible fallback anyway
+ */
+ if (status < 0) {
+ fprintf(stderr, "Error: %s\n", nvme_strerror(errno));
+ return;
+ }
+
+ switch (type) {
+ case NVME_STATUS_TYPE_NVME:
+ fprintf(stderr, "NVMe status: %s(%#x)\n",
+ nvme_status_to_string(val, false), val);
+ break;
+ default:
+ fprintf(stderr, "Unknown status type %d, value %#x\n",
+ type, val);
+ }
}
static void nvme_show_id_ctrl_cmic(__u8 cmic)
void d(unsigned char *buf, int len, int width, int group);
void d_raw(unsigned char *buf, unsigned len);
-void nvme_show_status(__u16 status);
+void nvme_show_status(int status);
void nvme_show_lba_status_info(__u32 result);
void nvme_show_relatives(const char *name);