From fd268d35cbddff04fc0b27a8af2c97185c8a97ba Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Mon, 15 Aug 2022 14:32:15 +0200 Subject: Merging upstream version 2.1.2. Signed-off-by: Daniel Baumann --- plugins/wdc/wdc-nvme.c | 32 +++++++++++++++----------------- 1 file changed, 15 insertions(+), 17 deletions(-) (limited to 'plugins/wdc/wdc-nvme.c') diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index 5be7e11..5f90c76 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -3498,8 +3498,7 @@ static int wdc_crash_dump(int fd, char *file, int type) if (ret) fprintf(stderr, "ERROR : WDC : failed to generate file name\n"); else - ret = wdc_do_crash_dump(fd, f, type); \ - close(fd); + ret = wdc_do_crash_dump(fd, f, type); return ret; } @@ -4157,7 +4156,7 @@ static void wdc_print_latency_monitor_log_json(struct wdc_ssd_latency_monitor_lo json_free_object(root); } -static void wdc_print_error_rec_log_normal(int fd, struct wdc_ocp_c1_error_recovery_log *log_data) +static void wdc_print_error_rec_log_normal(struct wdc_ocp_c1_error_recovery_log *log_data) { int j; printf("Error Recovery/C1 Log Page Data \n"); @@ -4211,7 +4210,7 @@ static void wdc_print_error_rec_log_json(struct wdc_ocp_c1_error_recovery_log *l json_free_object(root); } -static void wdc_print_dev_cap_log_normal(int fd, struct wdc_ocp_C4_dev_cap_log *log_data) +static void wdc_print_dev_cap_log_normal(struct wdc_ocp_C4_dev_cap_log *log_data) { int j; printf("Device Capabilities/C4 Log Page Data \n"); @@ -4272,7 +4271,7 @@ static void wdc_print_dev_cap_log_json(struct wdc_ocp_C4_dev_cap_log *log_data) json_free_object(root); } -static void wdc_print_unsupported_reqs_log_normal(int fd, struct wdc_ocp_C5_unsupported_reqs *log_data) +static void wdc_print_unsupported_reqs_log_normal(struct wdc_ocp_C5_unsupported_reqs *log_data) { int j; printf("Unsupported Requirements/C5 Log Page Data \n"); @@ -6393,7 +6392,7 @@ static int wdc_print_latency_monitor_log(int fd, struct wdc_ssd_latency_monitor_ return 0; } -static int wdc_print_error_rec_log(int fd, struct wdc_ocp_c1_error_recovery_log *log_data, int fmt) +static int wdc_print_error_rec_log(struct wdc_ocp_c1_error_recovery_log *log_data, int fmt) { if (!log_data) { fprintf(stderr, "ERROR : WDC : Invalid C1 log data buffer\n"); @@ -6401,7 +6400,7 @@ static int wdc_print_error_rec_log(int fd, struct wdc_ocp_c1_error_recovery_log } switch (fmt) { case NORMAL: - wdc_print_error_rec_log_normal(fd, log_data); + wdc_print_error_rec_log_normal(log_data); break; case JSON: wdc_print_error_rec_log_json(log_data); @@ -6410,7 +6409,7 @@ static int wdc_print_error_rec_log(int fd, struct wdc_ocp_c1_error_recovery_log return 0; } -static int wdc_print_dev_cap_log(int fd, struct wdc_ocp_C4_dev_cap_log *log_data, int fmt) +static int wdc_print_dev_cap_log(struct wdc_ocp_C4_dev_cap_log *log_data, int fmt) { if (!log_data) { fprintf(stderr, "ERROR : WDC : Invalid C4 log data buffer\n"); @@ -6418,7 +6417,7 @@ static int wdc_print_dev_cap_log(int fd, struct wdc_ocp_C4_dev_cap_log *log_data } switch (fmt) { case NORMAL: - wdc_print_dev_cap_log_normal(fd, log_data); + wdc_print_dev_cap_log_normal(log_data); break; case JSON: wdc_print_dev_cap_log_json(log_data); @@ -6427,7 +6426,7 @@ static int wdc_print_dev_cap_log(int fd, struct wdc_ocp_C4_dev_cap_log *log_data return 0; } -static int wdc_print_unsupported_reqs_log(int fd, struct wdc_ocp_C5_unsupported_reqs *log_data, int fmt) +static int wdc_print_unsupported_reqs_log(struct wdc_ocp_C5_unsupported_reqs *log_data, int fmt) { if (!log_data) { fprintf(stderr, "ERROR : WDC : Invalid C5 log data buffer\n"); @@ -6435,7 +6434,7 @@ static int wdc_print_unsupported_reqs_log(int fd, struct wdc_ocp_C5_unsupported_ } switch (fmt) { case NORMAL: - wdc_print_unsupported_reqs_log_normal(fd, log_data); + wdc_print_unsupported_reqs_log_normal(log_data); break; case JSON: wdc_print_unsupported_reqs_log_json(log_data); @@ -6839,7 +6838,7 @@ static int wdc_get_ocp_c1_log_page(nvme_root_t r, int fd, char *format) } /* parse the data */ - wdc_print_error_rec_log(fd, log_data, fmt); + wdc_print_error_rec_log(log_data, fmt); } else { fprintf(stderr, "ERROR : WDC : Unable to read error recovery (C1) data from buffer\n"); } @@ -6908,7 +6907,7 @@ static int wdc_get_ocp_c4_log_page(nvme_root_t r, int fd, char *format) } /* parse the data */ - wdc_print_dev_cap_log(fd, log_data, fmt); + wdc_print_dev_cap_log(log_data, fmt); } else { fprintf(stderr, "ERROR : WDC : Unable to read device capabilities (C4) data from buffer\n"); } @@ -6977,7 +6976,7 @@ static int wdc_get_ocp_c5_log_page(nvme_root_t r, int fd, char *format) } /* parse the data */ - wdc_print_unsupported_reqs_log(fd, log_data, fmt); + wdc_print_unsupported_reqs_log(log_data, fmt); } else { fprintf(stderr, "ERROR : WDC : Unable to read unsupported requirements (C5) data from buffer\n"); } @@ -7370,7 +7369,7 @@ static int wdc_vs_device_waf(int argc, char **argv, struct command *command, } /* get data units written from the smart log page */ - ret = nvme_get_log_smart(fd, cfg.namespace_id, true, &smart_log); + ret = nvme_get_log_smart(fd, cfg.namespace_id, false, &smart_log); if (!ret) { data_units_written = int128_to_double(smart_log.data_units_written); } @@ -8732,7 +8731,6 @@ static int wdc_do_drive_essentials(nvme_root_t r, int fd, char *dir, char *key) memset(tarFiles,0,sizeof(tarFiles)); memset(tarCmd,0,sizeof(tarCmd)); memset(&timeInfo,0,sizeof(timeInfo)); - memset(&vuLogInput, 0, sizeof(vuLogInput)); if (wdc_get_serial_and_fw_rev(fd, (char *)idSerialNo, (char *)idFwRev)) { @@ -8838,7 +8836,7 @@ static int wdc_do_drive_essentials(nvme_root_t r, int fd, char *dir, char *key) /* Get FW Slot log page */ memset(&fw_log, 0, sizeof (struct nvme_firmware_slot)); - ret = nvme_get_log_fw_slot(fd, true, &fw_log); + ret = nvme_get_log_fw_slot(fd, false, &fw_log); if (ret) { fprintf(stderr, "ERROR : WDC : nvme_fw_log() failed, ret = %d\n", ret); } else { -- cgit v1.2.3