diff options
Diffstat (limited to 'plugins/virtium')
-rw-r--r-- | plugins/virtium/virtium-nvme.c | 29 |
1 files changed, 14 insertions, 15 deletions
diff --git a/plugins/virtium/virtium-nvme.c b/plugins/virtium/virtium-nvme.c index a194a5f..7c2ebec 100644 --- a/plugins/virtium/virtium-nvme.c +++ b/plugins/virtium/virtium-nvme.c @@ -9,13 +9,10 @@ #include <time.h> #include <locale.h> -#include "linux/nvme_ioctl.h" +#include "common.h" #include "nvme.h" -#include "nvme-print.h" -#include "nvme-ioctl.h" +#include "libnvme.h" #include "plugin.h" -#include "argconfig.h" -#include "suffix.h" #define CREATE_CMD #include "virtium-nvme.h" @@ -35,7 +32,7 @@ struct vtview_log_header { char test_name[256]; long int time_stamp; struct nvme_id_ctrl raw_ctrl; - struct nvme_firmware_log_page raw_fw; + struct nvme_firmware_slot raw_fw; }; struct vtview_smart_log_entry { @@ -124,6 +121,8 @@ static void vt_convert_smart_data_to_human_readable_format(struct vtview_smart_l double capacity; char *curlocale; char *templocale; + __u8 lba_index; + nvme_id_ns_flbas_to_lbaf_inuse(smart->raw_ns.flbas, &lba_index); curlocale = setlocale(LC_ALL, NULL); templocale = strdup(curlocale); @@ -133,7 +132,7 @@ static void vt_convert_smart_data_to_human_readable_format(struct vtview_smart_l setlocale(LC_ALL, "C"); - long long int lba = 1 << smart->raw_ns.lbaf[(smart->raw_ns.flbas & 0x0f)].ds; + long long int lba = 1 << smart->raw_ns.lbaf[lba_index].ds; capacity = le64_to_cpu(smart->raw_ns.nsze) * lba; snprintf(tempbuff, sizeof(tempbuff), "log;%s;%lu;%s;%s;%-.*s;", smart->raw_ctrl.sn, smart->time_stamp, smart->path, @@ -273,7 +272,7 @@ static int vt_add_entry_to_log(const int fd, const char *path, const struct vtvi struct vtview_smart_log_entry smart; char filename[256] = ""; int ret = 0; - int nsid = 0; + unsigned nsid = 0; memset(smart.path, 0, sizeof(smart.path)); strcpy(smart.path, path); @@ -283,14 +282,14 @@ static int vt_add_entry_to_log(const int fd, const char *path, const struct vtvi strcpy(filename, cfg->output_file); smart.time_stamp = time(NULL); - nsid = nvme_get_nsid(fd); + ret = nvme_get_nsid(fd, &nsid); - if (nsid <= 0) { + if (ret < 0) { printf("Cannot read namespace-id\n"); return -1; } - ret = nvme_identify_ns(fd, nsid, 0, &smart.raw_ns); + ret = nvme_identify_ns(fd, nsid, &smart.raw_ns); if (ret) { printf("Cannot read namespace identify\n"); return -1; @@ -302,7 +301,7 @@ static int vt_add_entry_to_log(const int fd, const char *path, const struct vtvi return -1; } - ret = nvme_smart_log(fd, NVME_NSID_ALL, &smart.raw_smart); + ret = nvme_get_log_smart(fd, NVME_NSID_ALL, true, &smart.raw_smart); if (ret) { printf("Cannot read device SMART log\n"); return -1; @@ -343,7 +342,7 @@ static int vt_update_vtview_log_header(const int fd, const char *path, const str return -1; } - ret = nvme_fw_log(fd, &header.raw_fw); + ret = nvme_get_log_fw_slot(fd, true, &header.raw_fw); if (ret) { printf("Cannot read device firmware log\n"); return -1; @@ -445,7 +444,7 @@ static void vt_build_power_state_descriptor(const struct nvme_id_ctrl *ctrl) vt_convert_data_buffer_to_hex_string(&buf[16], 4, true, s); printf("%9sh", s); - temp = ctrl->psd[i].idle_scale; + temp = ctrl->psd[i].ips; snprintf(s, sizeof(s), "%u%u", (((unsigned char)temp >> 6) & 0x01), (((unsigned char)temp >> 7) & 0x01)); printf("%3sb", s); @@ -454,7 +453,7 @@ static void vt_build_power_state_descriptor(const struct nvme_id_ctrl *ctrl) vt_convert_data_buffer_to_hex_string(&buf[20], 4, true, s); printf("%9sh", s); - temp = ctrl->psd[i].active_work_scale; + temp = ctrl->psd[i].apws; snprintf(s, sizeof(s), "%u%u", (((unsigned char)temp >> 6) & 0x01), (((unsigned char)temp >> 7) & 0x01)); printf("%3sb", s); snprintf(s, sizeof(s), "%u%u%u", (((unsigned char)temp) & 0x01), (((unsigned char)temp >> 1) & 0x01), (((unsigned char)temp >> 2) & 0x01)); |