show_smart_log(&smart_log, cfg.namespace_id, devicename);
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("smart log");
else
show_ana_log(ana_log, devicename);
} else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("ana-log");
free(ana_log);
err = nvme_get_telemetry_log(fd, hdr, cfg.host_gen, cfg.ctrl_init, bs, 0);
if (err) {
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
fprintf(stderr, "Failed to acquire telemetry header %d!\n", err);
goto close_output;
}
err = nvme_get_telemetry_log(fd, page_log, 0, cfg.ctrl_init, bs, offset);
if (err) {
fprintf(stderr, "Failed to acquire full telemetry log!\n");
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
break;
}
else
show_endurance_log(&endurance_log, cfg.group_id, devicename);
} else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("endurance log");
show_effects_log(&effects, flags);
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("effects log page");
show_error_log(err_log, cfg.log_entries, devicename);
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("error log");
free(err_log);
show_fw_log(&fw_log, devicename);
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("fw log");
else
show_changed_ns_list_log(&changed_ns_list_log, devicename);
} else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("changed ns list log");
} else
d_raw((unsigned char *)log, cfg.log_len);
} else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("log page");
free(log);
show_sanitize_log(&sanitize_log, flags, devicename);
}
else if (ret > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret);
+ show_nvme_status(ret);
else
perror("sanitize status log");
printf("[%4u]:%#x\n", i, le16_to_cpu(cntlist->identifier[i]));
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x) cntid:%d\n",
- nvme_status_to_string(err), err, cfg.cntid);
+ show_nvme_status(err);
else
perror("id controller list");
printf("[%4u]:%#x\n", i, le32_to_cpu(ns_list[i]));
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x) NSID:%d\n",
- nvme_status_to_string(err), err, cfg.namespace_id);
+ show_nvme_status(err);
else
perror("id namespace list");
printf("%s: Success, deleted nsid:%d\n", cmd->name,
cfg.namespace_id);
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("delete namespace");
if (!err)
printf("%s: Success, nsid:%d\n", cmd->name, cfg.namespace_id);
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror(attach ? "attach namespace" : "detach namespace");
if (err) {
if (err < 0)
perror("identify-namespace");
- else
- fprintf(stderr,
- "NVME Admin command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ else {
+ fprintf(stderr, "identify failed\n");
+ show_nvme_status(err);
+ }
return err;
}
for (i = 0; i < 16; ++i) {
if (!err)
printf("%s: Success, created nsid:%d\n", cmd->name, nsid);
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("create namespace");
list_cnt++;
}
else if (ret > 0) {
- fprintf(stderr, "%s: failed to obtain nvme info: %s\n",
- path, nvme_status_to_string(ret));
+ fprintf(stderr, "identify failed\n");
+ show_nvme_status(ret);
}
else {
fprintf(stderr, "%s: failed to obtain nvme info: %s\n",
}
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
perror("identify controller");
}
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x) NSID:%d\n",
- nvme_status_to_string(err), err, cfg.namespace_id);
+ show_nvme_status(err);
else
perror("identify namespace");
}
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x) NSID:%d\n",
- nvme_status_to_string(err), err, cfg.namespace_id);
+ show_nvme_status(err);
else
perror("identify namespace");
}
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x) NVMSETID:%d\n",
- nvme_status_to_string(err), err, cfg.nvmset_id);
+ show_nvme_status(err);
else
perror("identify nvm set list");
printf("success, Number of Resources allocated:%#x\n", result);
}
else if (err > 0) {
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
} else
perror("virt-mgmt");
else
printf("Device self-test started\n");
} else if (err > 0) {
- fprintf(stderr, "NVMe Status:%s(%x) NSID:%d\n",
- nvme_status_to_string(err), err, cfg.namespace_id);
+ show_nvme_status(err);
} else
perror("Device self-test");
self_test_log.crnt_dev_selftest_compln);
}
} else if (err > 0) {
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
} else {
perror("self_test_log");
}
} else if (buf)
d_raw(buf, cfg.data_len);
} else if (err > 0) {
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
} else
perror("get-feature");
perror("fw-download");
break;
} else if (err != 0) {
- fprintf(stderr, "NVME Admin command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
break;
}
fw_buf += cfg.xfer;
printf(", but firmware requires %s reset\n", nvme_fw_status_reset_type(err));
break;
default:
- fprintf(stderr, "NVME Admin command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
break;
}
else {
ret = nvme_sanitize(fd, cfg.sanact, cfg.ause, cfg.owpass, cfg.oipbp,
cfg.no_dealloc, cfg.ovrpat);
if (ret)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(ret), ret);
+ show_nvme_status(ret);
close_fd:
close(fd);
} else if (!err) {
show_single_property(cfg.offset, value, cfg.human_readable);
} else if (err > 0) {
- fprintf(stderr, "NVMe Status: %s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
}
close_fd:
printf("set-property: %02x (%s), value: %#08x\n", cfg.offset,
nvme_register_to_string(cfg.offset), cfg.value);
} else if (err > 0) {
- fprintf(stderr, "NVMe Status: %s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
}
close_fd:
if (err) {
if (err < 0)
perror("identify-namespace");
- else
- fprintf(stderr,
- "NVME Admin command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ else {
+ fprintf(stderr, "identify failed\n");
+ show_nvme_status(err);
+ }
return err;
}
prev_lbaf = ns.flbas & 0xf;
if (err < 0)
perror("format");
else if (err != 0)
- fprintf(stderr, "NVME Admin command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else {
printf("Success formatting namespace:%x\n", cfg.namespace_id);
ioctl(fd, BLKRRPART);
d(buf, cfg.data_len, 16, 1);
}
} else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
close_ffd:
close(ffd);
}
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
close_ffd:
close(ffd);
if (err < 0)
perror("write uncorrectable");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVME Write Uncorrectable Success\n");
if (err < 0)
perror("write-zeroes");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVME Write Zeroes Success\n");
if (err < 0)
perror("data-set management");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVMe DSM: success\n");
if (err < 0)
perror("flush");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVMe Flush: success\n");
close_fd:
if (err < 0)
perror("reservation acquire");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n", nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVME Reservation Acquire success\n");
if (err < 0)
perror("reservation register");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n", nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVME Reservation success\n");
if (err < 0)
perror("reservation release");
else if (err != 0)
- fprintf(stderr, "NVME IO command error:%s(%x)\n", nvme_status_to_string(err), err);
+ show_nvme_status(err);
else
printf("NVME Reservation Release success\n");
if (err < 0)
perror("submit-io");
else if (err)
- fprintf(stderr, "%s:%s(%04x)\n", command, nvme_status_to_string(err), err);
+ show_nvme_status(err);
else {
if (!(opcode & 1) && write(dfd, (void *)buffer, cfg.data_size) < 0) {
fprintf(stderr, "write: %s: failed to write buffer to output file\n",
}
}
else if (err > 0)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
free:
if (cfg.data_len)
free(buf);
if (err < 0)
perror("passthru");
else if (err)
- fprintf(stderr, "NVMe Status:%s(%x)\n",
- nvme_status_to_string(err), err);
+ show_nvme_status(err);
else {
if (!cfg.raw_binary) {
fprintf(stderr, "NVMe command result:%08x\n", result);