diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-08-15 12:32:15 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2022-08-15 12:32:15 +0000 |
commit | fd268d35cbddff04fc0b27a8af2c97185c8a97ba (patch) | |
tree | 9c180a60597c0c8cb9eebc7c1c6841787c856f42 /nvme.c | |
parent | Releasing debian version 2.1~rc0-1. (diff) | |
download | nvme-cli-fd268d35cbddff04fc0b27a8af2c97185c8a97ba.tar.xz nvme-cli-fd268d35cbddff04fc0b27a8af2c97185c8a97ba.zip |
Merging upstream version 2.1.2.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to '')
-rw-r--r-- | nvme.c | 49 |
1 files changed, 22 insertions, 27 deletions
@@ -351,7 +351,7 @@ static int get_smart_log(int argc, char **argv, struct command *cmd, struct plug if (cfg.human_readable) flags |= VERBOSE; - err = nvme_get_log_smart(fd, cfg.namespace_id, true, &smart_log); + err = nvme_get_log_smart(fd, cfg.namespace_id, false, &smart_log); if (!err) nvme_show_smart_log(&smart_log, cfg.namespace_id, devicename, flags); @@ -600,17 +600,12 @@ static int collect_effects_log(int fd, enum nvme_csi csi, node->csi = csi; err = nvme_get_log_cmd_effects(fd, csi, &node->effects); - if (!err) { - list_add(list, &node->node); + if (err) { + free(node); return err; } - else if (err > 0) - nvme_show_status(err); - else - fprintf(stderr, "effects log page: %s\n", nvme_strerror(errno)); - - free(node); - return err; + list_add(list, &node->node); + return 0; } static int get_effects_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) @@ -824,7 +819,7 @@ static int get_error_log(int argc, char **argv, struct command *cmd, struct plug goto close_fd; } - err = nvme_get_log_error(fd, cfg.log_entries, true, err_log); + err = nvme_get_log_error(fd, cfg.log_entries, false, err_log); if (!err) nvme_show_error_log(err_log, cfg.log_entries, devicename, flags); else if (err > 0) @@ -873,7 +868,7 @@ static int get_fw_log(int argc, char **argv, struct command *cmd, struct plugin if (cfg.raw_binary) flags = BINARY; - err = nvme_get_log_fw_slot(fd, true, &fw_log); + err = nvme_get_log_fw_slot(fd, false, &fw_log); if (!err) nvme_show_fw_log(&fw_log, devicename, flags); else if (err > 0) @@ -1406,7 +1401,7 @@ static int get_resv_notif_log(int argc, char **argv, if (flags < 0) goto close_fd; - err = nvme_get_log_reservation(fd, true, &resv); + err = nvme_get_log_reservation(fd, false, &resv); if (!err) nvme_show_resv_notif_log(&resv, devicename, flags); else if (err > 0) @@ -2049,23 +2044,24 @@ static int list_ns(int argc, char **argv, struct command *cmd, struct plugin *pl goto close_fd; } + struct nvme_identify_args args = { + .args_size = sizeof(args), + .fd = fd, + .timeout = NVME_DEFAULT_IOCTL_TIMEOUT, + .data = &ns_list, + .nsid = cfg.namespace_id - 1. + }; if (cfg.csi < 0) { - if (cfg.all) - err = nvme_identify_allocated_ns_list(fd, - cfg.namespace_id - 1, &ns_list); - else - err = nvme_identify_active_ns_list(fd, - cfg.namespace_id - 1, &ns_list); - + args.cns = cfg.all ? NVME_IDENTIFY_CNS_ALLOCATED_NS_LIST : + NVME_IDENTIFY_CNS_NS_ACTIVE_LIST; } else { - if (cfg.all) - err = nvme_identify_allocated_ns_list_csi(fd, - cfg.namespace_id - 1, cfg.csi, &ns_list); - else - err = nvme_identify_active_ns_list_csi(fd, - cfg.namespace_id - 1, cfg.csi, &ns_list); + args.cns = cfg.all ? NVME_IDENTIFY_CNS_CSI_ALLOCATED_NS_LIST : + NVME_IDENTIFY_CNS_CSI_NS_ACTIVE_LIST; + args.csi = cfg.csi; } + err = nvme_identify(&args); + if (!err) nvme_show_list_ns(&ns_list, flags); else if (err > 0) @@ -5851,7 +5847,6 @@ static int copy(int argc, char **argv, struct command *cmd, struct plugin *plugi .format = cfg.format, .lr = cfg.lr, .fua = cfg.fua, - .prinfow = cfg.prinfow, .ilbrt_u64 = cfg.ilbrt, .lbatm = cfg.lbatm, .lbat = cfg.lbat, |