From 5d64e8a26388e2abbf6a6585d17392d6e944ae7b Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 1 Jul 2023 00:38:51 +0200 Subject: Merging upstream version 2.5. Signed-off-by: Daniel Baumann --- plugins/virtium/virtium-nvme.c | 388 +++++++++++++++++++++-------------------- 1 file changed, 195 insertions(+), 193 deletions(-) (limited to 'plugins/virtium/virtium-nvme.c') diff --git a/plugins/virtium/virtium-nvme.c b/plugins/virtium/virtium-nvme.c index c8df126..0ba4b15 100644 --- a/plugins/virtium/virtium-nvme.c +++ b/plugins/virtium/virtium-nvme.c @@ -19,7 +19,7 @@ #define CREATE_CMD #include "virtium-nvme.h" -#define MIN2(a, b) ( ((a) < (b))? (a) : (b)) +#define MIN2(a, b) (((a) < (b)) ? (a) : (b)) #define HOUR_IN_SECONDS 3600 @@ -30,26 +30,26 @@ static char vt_default_log_file_name[256]; struct vtview_log_header { - char path[256]; - char test_name[256]; - long int time_stamp; - struct nvme_id_ctrl raw_ctrl; - struct nvme_firmware_slot raw_fw; + char path[256]; + char test_name[256]; + long time_stamp; + struct nvme_id_ctrl raw_ctrl; + struct nvme_firmware_slot raw_fw; }; struct vtview_smart_log_entry { - char path[256]; - long int time_stamp; + char path[256]; + long time_stamp; struct nvme_id_ns raw_ns; struct nvme_id_ctrl raw_ctrl; struct nvme_smart_log raw_smart; }; struct vtview_save_log_settings { - double run_time_hrs; - double log_record_frequency_hrs; - const char* output_file; - const char* test_name; + double run_time_hrs; + double log_record_frequency_hrs; + const char *output_file; + const char *test_name; }; static void vt_initialize_header_buffer(struct vtview_log_header *pbuff) @@ -72,7 +72,7 @@ static void vt_convert_data_buffer_to_hex_string(const unsigned char *bufPtr, memset(output, 0, (size * 2) + 1); for (i = 0; i < size; i++) { - if(isReverted) + if (isReverted) pos = size - 1 - i; else pos = i; @@ -86,7 +86,7 @@ static void vt_convert_data_buffer_to_hex_string(const unsigned char *bufPtr, * Log file name will be generated automatically if user leave log file option blank. * Log file name will be generated as vtView-Smart-log-date-time.txt */ -static void vt_generate_vtview_log_file_name(char* fname) +static void vt_generate_vtview_log_file_name(char *fname) { time_t current; struct tm tstamp; @@ -112,17 +112,19 @@ static void vt_convert_smart_data_to_human_readable_format(struct vtview_smart_l 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); - if (NULL == templocale) + if (!templocale) printf("Cannot malloc buffer\n"); setlocale(LC_ALL, "C"); - unsigned long long int lba = 1ULL << smart->raw_ns.lbaf[lba_index].ds; + unsigned long long lba = 1ULL << 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, @@ -167,7 +169,8 @@ static void vt_convert_smart_data_to_human_readable_format(struct vtview_smart_l for (i = 0; i < 8; i++) { __s32 temp = le16_to_cpu(smart->raw_smart.temp_sensor[i]); - if (0 == temp) { + + if (!temp) { snprintf(tempbuff, sizeof(tempbuff), "Temperature_Sensor_%d;NC;", i); strcat(text, tempbuff); continue; @@ -217,7 +220,7 @@ static int vt_append_text_file(const char *text, const char *filename) FILE *f; f = fopen(filename, "a"); - if(NULL == f) { + if (!f) { printf("Cannot open %s\n", filename); return -1; } @@ -247,11 +250,11 @@ static void vt_process_string(char *str, const size_t size) { size_t i; - if (size == 0) + if (!size) return; i = size - 1; - while ((0 != i) && (' ' == str[i])) { + while (i && (' ' == str[i])) { str[i] = 0; i--; } @@ -262,11 +265,11 @@ static int vt_add_entry_to_log(const int fd, const char *path, const struct vtvi struct vtview_smart_log_entry smart; const char *filename; int ret = 0; - unsigned nsid = 0; + unsigned int nsid = 0; memset(smart.path, 0, sizeof(smart.path)); strncpy(smart.path, path, sizeof(smart.path) - 1); - if(NULL == cfg->output_file) + if (!cfg->output_file) filename = vt_default_log_file_name; else filename = cfg->output_file; @@ -301,7 +304,7 @@ static int vt_add_entry_to_log(const int fd, const char *path, const struct vtvi vt_process_string(smart.raw_ctrl.mn, sizeof(smart.raw_ctrl.mn)); ret = vt_append_log(&smart, filename); - return (ret); + return ret; } static int vt_update_vtview_log_header(const int fd, const char *path, const struct vtview_save_log_settings *cfg) @@ -318,9 +321,9 @@ static int vt_update_vtview_log_header(const int fd, const char *path, const str } strcpy(header.path, path); - if (NULL == cfg->test_name) + if (!cfg->test_name) { strcpy(header.test_name, DEFAULT_TEST_NAME); - else { + } else { if (strlen(cfg->test_name) > sizeof(header.test_name)) { printf("test name too long\n"); errno = EINVAL; @@ -329,7 +332,7 @@ static int vt_update_vtview_log_header(const int fd, const char *path, const str strcpy(header.test_name, cfg->test_name); } - if(NULL == cfg->output_file) + if (!cfg->output_file) filename = vt_default_log_file_name; else filename = cfg->output_file; @@ -353,7 +356,7 @@ static int vt_update_vtview_log_header(const int fd, const char *path, const str vt_process_string(header.raw_ctrl.mn, sizeof(header.raw_ctrl.mn)); ret = vt_append_header(&header, filename); - return (ret); + return ret; } static void vt_build_identify_lv2(unsigned int data, unsigned int start, @@ -371,13 +374,13 @@ static void vt_build_identify_lv2(unsigned int data, unsigned int start, printf(" \"bit %u\":\"%ub %s\"\n", i, temp, table[pos]); printf(" %s", table[pos + 1]); - if((end - 1) != i || !isEnd) + if ((end - 1) != i || !isEnd) printf(",\n"); else printf("\n"); } - if(isEnd) + if (isEnd) printf(" },\n"); } @@ -418,7 +421,7 @@ static void vt_build_power_state_descriptor(const struct nvme_id_ctrl *ctrl) unsigned int temp; printf("%6d", i); - buf = (unsigned char*) (&ctrl->psd[i]); + buf = (unsigned char *) (&ctrl->psd[i]); vt_convert_data_buffer_to_hex_string(&buf[0], 4, true, s); printf("%9sh", s); @@ -469,36 +472,35 @@ static void vt_build_power_state_descriptor(const struct nvme_id_ctrl *ctrl) } -static void vt_dump_hex_data(const unsigned char *pbuff, size_t pbuffsize) { - +static void vt_dump_hex_data(const unsigned char *pbuff, size_t pbuffsize) +{ char textbuf[33]; - unsigned long int i, j; + unsigned long i, j; textbuf[32] = '\0'; printf("[%08X] ", 0); for (i = 0; i < pbuffsize; i++) { printf("%02X ", pbuff[i]); - if (pbuff[i] >= ' ' && pbuff[i] <= '~') + if (pbuff[i] >= ' ' && pbuff[i] <= '~') textbuf[i % 32] = pbuff[i]; - else + else textbuf[i % 32] = '.'; - if ((((i + 1) % 8) == 0) || ((i + 1) == pbuffsize)) { + if (!(((i + 1) % 8)) || ((i + 1) == pbuffsize)) { printf(" "); - if ((i + 1) % 32 == 0) { + if (!((i + 1) % 32)) { printf(" %s\n", textbuf); - if((i + 1) != pbuffsize) - printf("[%08lX] ", (i + 1)); - } - else if (i + 1 == pbuffsize) { + if ((i + 1) != pbuffsize) + printf("[%08lX] ", (i + 1)); + } else if (i + 1 == pbuffsize) { textbuf[(i + 1) % 32] = '\0'; - if(((i + 1) % 8) == 0) + if (!((i + 1) % 8)) printf(" "); for (j = ((i + 1) % 32); j < 32; j++) { printf(" "); - if(((j + 1) % 8) == 0) + if (!((j + 1) % 8)) printf(" "); } @@ -515,174 +517,174 @@ static void vt_parse_detail_identify(const struct nvme_id_ctrl *ctrl) char s[1024] = ""; const char *CMICtable[6] = {"0 = the NVM subsystem contains only a single NVM subsystem port", - "1 = the NVM subsystem may contain more than one subsystem ports", - "0 = the NVM subsystem contains only a single controller", - "1 = the NVM subsystem may contain two or more controllers (see section 1.4.1)", - "0 = the controller is associated with a PCI Function or a Fabrics connection", - "1 = the controller is associated with an SR-IOV Virtual Function"}; + "1 = the NVM subsystem may contain more than one subsystem ports", + "0 = the NVM subsystem contains only a single controller", + "1 = the NVM subsystem may contain two or more controllers (see section 1.4.1)", + "0 = the controller is associated with a PCI Function or a Fabrics connection", + "1 = the controller is associated with an SR-IOV Virtual Function"}; const char *OAEStable[20] = {"Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "0 = does not support sending the Namespace Attribute Notices event nor the associated Changed Namespace List log page", - "1 = supports sending the Namespace Attribute Notices & the associated Changed Namespace List log page", - "0 = does not support sending Firmware Activation Notices event", - "1 = supports sending Firmware Activation Notices"}; + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "0 = does not support sending the Namespace Attribute Notices event nor the associated Changed Namespace List log page", + "1 = supports sending the Namespace Attribute Notices & the associated Changed Namespace List log page", + "0 = does not support sending Firmware Activation Notices event", + "1 = supports sending Firmware Activation Notices"}; const char *CTRATTtable[4] = {"0 = does not support a 128-bit Host Identifier", - "1 = supports a 128-bit Host Identifier", - "0 = does not support Non-Operational Power State Permissive Mode", - "1 = supports Non-Operational Power State Permissive Mode"}; + "1 = supports a 128-bit Host Identifier", + "0 = does not support Non-Operational Power State Permissive Mode", + "1 = supports Non-Operational Power State Permissive Mode"}; const char *OACStable[18] = {"0 = does not support the Security Send and Security Receive commands", - "1 = supports the Security Send and Security Receive commands", - "0 = does not support the Format NVM command", - "1 = supports the Format NVM command", - "0 = does not support the Firmware Commit and Firmware Image Download commands", - "1 = supports the Firmware Commit and Firmware Image Download commands", - "0 = does not support the Namespace Management capability", - "1 = supports the Namespace Management capability", - "0 = does not support the Device Self-test command", - "1 = supports the Device Self-test command", - "0 = does not support Directives", - "1 = supports Directive Send & Directive Receive commands", - "0 = does not support the NVMe-MI Send and NVMe-MI Receive commands", - "1 = supports the NVMe-MI Send and NVMe-MI Receive commands", - "0 = does not support the Virtualization Management command", - "1 = supports the Virtualization Management command", - "0 = does not support the Doorbell Buffer Config command", - "1 = supports the Doorbell Buffer Config command"}; + "1 = supports the Security Send and Security Receive commands", + "0 = does not support the Format NVM command", + "1 = supports the Format NVM command", + "0 = does not support the Firmware Commit and Firmware Image Download commands", + "1 = supports the Firmware Commit and Firmware Image Download commands", + "0 = does not support the Namespace Management capability", + "1 = supports the Namespace Management capability", + "0 = does not support the Device Self-test command", + "1 = supports the Device Self-test command", + "0 = does not support Directives", + "1 = supports Directive Send & Directive Receive commands", + "0 = does not support the NVMe-MI Send and NVMe-MI Receive commands", + "1 = supports the NVMe-MI Send and NVMe-MI Receive commands", + "0 = does not support the Virtualization Management command", + "1 = supports the Virtualization Management command", + "0 = does not support the Doorbell Buffer Config command", + "1 = supports the Doorbell Buffer Config command"}; const char *FRMWtable[10] = {"0 = the 1st firmware slot (slot 1) is read/write", - "1 = the 1st firmware slot (slot 1) is read only", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "0 = requires a reset for firmware to be activated", - "1 = supports firmware activation without a reset"}; + "1 = the 1st firmware slot (slot 1) is read only", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "0 = requires a reset for firmware to be activated", + "1 = supports firmware activation without a reset"}; const char *LPAtable[8] = {"0 = does not support the SMART / Health information log page on a per namespace basis", - "1 = supports the SMART / Health information log page on a per namespace basis", - "0 = does not support the Commands Supported & Effects log page", - "1 = supports the Commands Supported Effects log page", - "0 = does not support extended data for Get Log Page", - "1 = supports extended data for Get Log Page (including extended Number of Dwords and Log Page Offset fields)", - "0 = does not support the Telemetry Host-Initiated and Telemetry Controller-Initiated log pages and Telemetry Log Notices events", - "1 = supports the Telemetry Host-Initiated and Telemetry Controller-Initiated log pages and sending Telemetry Log Notices" }; + "1 = supports the SMART / Health information log page on a per namespace basis", + "0 = does not support the Commands Supported & Effects log page", + "1 = supports the Commands Supported Effects log page", + "0 = does not support extended data for Get Log Page", + "1 = supports extended data for Get Log Page (including extended Number of Dwords and Log Page Offset fields)", + "0 = does not support the Telemetry Host-Initiated and Telemetry Controller-Initiated log pages and Telemetry Log Notices events", + "1 = supports the Telemetry Host-Initiated and Telemetry Controller-Initiated log pages and sending Telemetry Log Notices"}; const char *AVSCCtable[2] = {"0 = the format of all Admin Vendor Specific Commands are vendor specific", - "1 = all Admin Vendor Specific Commands use the format defined in NVM Express specification"}; + "1 = all Admin Vendor Specific Commands use the format defined in NVM Express specification"}; const char *APSTAtable[2] = {"0 = does not support autonomous power state transitions", - "1 = supports autonomous power state transitions"}; + "1 = supports autonomous power state transitions"}; const char *DSTOtable[2] = {"0 = the NVM subsystem supports one device self-test operation per controller at a time", - "1 = the NVM subsystem supports only one device self-test operation in progress at a time"}; + "1 = the NVM subsystem supports only one device self-test operation in progress at a time"}; const char *HCTMAtable[2] = {"0 = does not support host controlled thermal management", - "1 = supports host controlled thermal management. Supports Set Features & Get Features commands with the Feature Identifier field set to 10h"}; + "1 = supports host controlled thermal management. Supports Set Features & Get Features commands with the Feature Identifier field set to 10h"}; const char *SANICAPtable[6] = {"0 = does not support the Crypto Erase sanitize operation", - "1 = supports the Crypto Erase sanitize operation", - "0 = does not support the Block Erase sanitize operation", - "1 = supports the Block Erase sanitize operation", - "0 = does not support the Overwrite sanitize operation", - "1 = supports the Overwrite sanitize operation"}; + "1 = supports the Crypto Erase sanitize operation", + "0 = does not support the Block Erase sanitize operation", + "1 = supports the Block Erase sanitize operation", + "0 = does not support the Overwrite sanitize operation", + "1 = supports the Overwrite sanitize operation"}; const char *ONCStable[14] = {"0 = does not support the Compare command", - "1 = supports the Compare command", - "0 = does not support the Write Uncorrectable command", - "1 = supports the Write Uncorrectable command", - "0 = does not support the Dataset Management command", - "1 = supports the Dataset Management command", - "0 = does not support the Write Zeroes command", - "1 = supports the Write Zeroes command", - "0 = does not support the Save field set to a non-zero value in the Set Features and the Get Features commands", - "1 = supports the Save field set to a non-zero value in the Set Features and the Get Features commands", \ - "0 = does not support reservations", - "1 = supports reservations", - "0 = does not support the Timestamp feature (refer to section 5.21.1.14)", - "1 = supports the Timestamp feature"}; + "1 = supports the Compare command", + "0 = does not support the Write Uncorrectable command", + "1 = supports the Write Uncorrectable command", + "0 = does not support the Dataset Management command", + "1 = supports the Dataset Management command", + "0 = does not support the Write Zeroes command", + "1 = supports the Write Zeroes command", + "0 = does not support the Save field set to a non-zero value in the Set Features and the Get Features commands", + "1 = supports the Save field set to a non-zero value in the Set Features and the Get Features commands", + "0 = does not support reservations", + "1 = supports reservations", + "0 = does not support the Timestamp feature (refer to section 5.21.1.14)", + "1 = supports the Timestamp feature"}; const char *FUSEStable[2] = {"0 = does not support the Compare and Write fused operation", - "1 = supports the Compare and Write fused operation"}; + "1 = supports the Compare and Write fused operation"}; const char *FNAtable[6] = {"0 = supports format on a per namespace basis", - "1 = all namespaces shall be configured with the same attributes and a format (excluding secure erase) of any namespace results in a format of all namespaces in an NVM subsystem", - "0 = any secure erase performed as part of a format results in a secure erase of a particular namespace specified", - "1 = any secure erase performed as part of a format operation results in a secure erase of all namespaces in the NVM subsystem", - "0 = cryptographic erase is not supported", - "1 = cryptographic erase is supported as part of the secure erase functionality"}; + "1 = all namespaces shall be configured with the same attributes and a format (excluding secure erase) of any namespace results in a format of all namespaces in an NVM subsystem", + "0 = any secure erase performed as part of a format results in a secure erase of a particular namespace specified", + "1 = any secure erase performed as part of a format operation results in a secure erase of all namespaces in the NVM subsystem", + "0 = cryptographic erase is not supported", + "1 = cryptographic erase is supported as part of the secure erase functionality"}; const char *VWCtable[2] = {"0 = a volatile write cache is not present", - "1 = a volatile write cache is present"}; + "1 = a volatile write cache is present"}; const char *ICSVSCCtable[2] = {"0 = the format of all NVM Vendor Specific Commands are vendor specific", - "1 = all NVM Vendor Specific Commands use the format defined in NVM Express specification"}; + "1 = all NVM Vendor Specific Commands use the format defined in NVM Express specification"}; const char *SGLSSubtable[4] = {"00b = SGLs are not supported", - "01b = SGLs are supported. There is no alignment nor granularity requirement for Data Blocks", - "10b = SGLs are supported. There is a Dword alignment and granularity requirement for Data Blocks", - "11b = Reserved"}; + "01b = SGLs are supported. There is no alignment nor granularity requirement for Data Blocks", + "10b = SGLs are supported. There is a Dword alignment and granularity requirement for Data Blocks", + "11b = Reserved"}; const char *SGLStable[42] = {"Used", - "Used", - "Used", - "Used", - "0 = does not support the Keyed SGL Data Block descriptor", - "1 = supports the Keyed SGL Data Block descriptor", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "Reserved", - "0 = the SGL Bit Bucket descriptor is not supported", - "1 = the SGL Bit Bucket descriptor is supported", - "0 = use of a byte aligned contiguous physical buffer of metadata is not supported", - "1 = use of a byte aligned contiguous physical buffer of metadata is supported", - "0 = the SGL length shall be equal to the amount of data to be transferred", - "1 = supports commands that contain a data or metadata SGL of a length larger than the amount of data to be transferred", - "0 = use of Metadata Pointer (MPTR) that contains an address of an SGL segment containing exactly one SGL Descriptor that is Qword aligned is not supported", - "1 = use of Metadata Pointer (MPTR) that contains an address of an SGL segment containing exactly one SGL Descriptor that is Qword aligned is supported", - "0 = the Address field specifying an offset is not supported", - "1 = supports the Address field in SGL Data Block, SGL Segment, and SGL Last Segment descriptor types specifying an offset"}; + "Used", + "Used", + "Used", + "0 = does not support the Keyed SGL Data Block descriptor", + "1 = supports the Keyed SGL Data Block descriptor", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "Reserved", + "0 = the SGL Bit Bucket descriptor is not supported", + "1 = the SGL Bit Bucket descriptor is supported", + "0 = use of a byte aligned contiguous physical buffer of metadata is not supported", + "1 = use of a byte aligned contiguous physical buffer of metadata is supported", + "0 = the SGL length shall be equal to the amount of data to be transferred", + "1 = supports commands that contain a data or metadata SGL of a length larger than the amount of data to be transferred", + "0 = use of Metadata Pointer (MPTR) that contains an address of an SGL segment containing exactly one SGL Descriptor that is Qword aligned is not supported", + "1 = use of Metadata Pointer (MPTR) that contains an address of an SGL segment containing exactly one SGL Descriptor that is Qword aligned is supported", + "0 = the Address field specifying an offset is not supported", + "1 = supports the Address field in SGL Data Block, SGL Segment, and SGL Last Segment descriptor types specifying an offset"}; buf = (unsigned char *)(ctrl); @@ -791,12 +793,12 @@ static void vt_parse_detail_identify(const struct nvme_id_ctrl *ctrl) vt_convert_data_buffer_to_hex_string(&buf[296], 16, true, s); printf(" \"Unallocated NVM Capacity\":\"%sh\",\n", s); - temp = le32_to_cpu(ctrl->rpmbs); + temp = le32_to_cpu(ctrl->rpmbs); printf(" \"Replay Protected Memory Block Support\":{\n"); vt_convert_data_buffer_to_hex_string(&buf[312], 4, true, s); printf(" \"Value\":\"%sh\",\n", s); printf(" \"Number of RPMB Units\":\"%u\",\n", (temp & 0x00000003)); - snprintf(s, sizeof(s), ((temp >> 3) & 0x00000007)? "Reserved" : "HMAC SHA-256"); + snprintf(s, sizeof(s), ((temp >> 3) & 0x00000007) ? "Reserved" : "HMAC SHA-256"); printf(" \"Authentication Method\":\"%u: %s\",\n", ((temp >> 3) & 0x00000007), s); printf(" \"Total Size\":\"%u\",\n", ((temp >> 16) & 0x000000FF)); printf(" \"Access Size\":\"%u\",\n", ((temp >> 24) & 0x000000FF)); @@ -917,18 +919,18 @@ static void vt_parse_detail_identify(const struct nvme_id_ctrl *ctrl) static int vt_save_smart_to_vtview_log(int argc, char **argv, struct command *cmd, struct plugin *plugin) { int ret, err = 0; - long int total_time = 0; - long int freq_time = 0; - long int cur_time = 0; - long int remain_time = 0; - long int start_time = 0; - long int end_time = 0; + long total_time = 0; + long freq_time = 0; + long cur_time = 0; + long remain_time = 0; + long start_time = 0; + long end_time = 0; char path[256] = ""; char *desc = "Save SMART data into log file with format that is easy to analyze (comma delimited). Maximum log file will be 4K.\n\n" "Typical usages:\n\n" - "Temperature characterization: \n" + "Temperature characterization:\n" "\tvirtium save-smart-to-vtview-log /dev/yourDevice --run-time=100 --record-frequency=0.25 --test-name=burn-in-at-(-40)\n\n" - "Endurance testing : \n" + "Endurance testing :\n" "\tvirtium save-smart-to-vtview-log /dev/yourDevice --run-time=100 --record-frequency=1 --test-name=Endurance-test-JEDEG-219-workload\n\n" "Just logging :\n" "\tvirtium save-smart-to-vtview-log /dev/yourDevice"; @@ -979,13 +981,13 @@ static int vt_save_smart_to_vtview_log(int argc, char **argv, struct command *cm if (ret) { err = EINVAL; dev_close(dev); - return (err); + return err; } total_time = cfg.run_time_hrs * (float)HOUR_IN_SECONDS; freq_time = cfg.log_record_frequency_hrs * (float)HOUR_IN_SECONDS; - if(freq_time == 0) + if (!freq_time) freq_time = 1; start_time = time(NULL); @@ -995,7 +997,7 @@ static int vt_save_smart_to_vtview_log(int argc, char **argv, struct command *cm while (1) { cur_time = time(NULL); - if(cur_time >= end_time) + if (cur_time >= end_time) break; ret = vt_add_entry_to_log(dev_fd(dev), path, &cfg); @@ -1011,7 +1013,7 @@ static int vt_save_smart_to_vtview_log(int argc, char **argv, struct command *cm } dev_close(dev); - return (err); + return err; } static int vt_show_identify(int argc, char **argv, struct command *cmd, struct plugin *plugin) @@ -1037,7 +1039,7 @@ static int vt_show_identify(int argc, char **argv, struct command *cmd, struct p if (ret) { printf("Cannot read identify device\n"); dev_close(dev); - return (-1); + return -1; } vt_process_string(ctrl.sn, sizeof(ctrl.sn)); @@ -1045,5 +1047,5 @@ static int vt_show_identify(int argc, char **argv, struct command *cmd, struct p vt_parse_detail_identify(&ctrl); dev_close(dev); - return (err); + return err; } -- cgit v1.2.3