Hello community, here is the log from the commit of package nvme-cli for openSUSE:Factory checked in at 2019-01-28 20:50:03 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/nvme-cli (Old) and /work/SRC/openSUSE:Factory/.nvme-cli.new.28833 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "nvme-cli" Mon Jan 28 20:50:03 2019 rev:29 rq:669109 version:1.7 Changes: -------- --- /work/SRC/openSUSE:Factory/nvme-cli/nvme-cli.changes 2018-10-22 11:23:59.211117177 +0200 +++ /work/SRC/openSUSE:Factory/.nvme-cli.new.28833/nvme-cli.changes 2019-01-28 20:50:47.233756965 +0100 @@ -1,0 +2,515 @@ +Mon Jan 28 14:36:32 UTC 2019 - [email protected] + +- Update to version 1.7: + * Use tnvmcap register for creating namespace + * don't execute a command if --dry-run is supplied + * Remove trailing "\n" so that the output is valid json + * nvme-cli: remove unnecessary assignments + * nvme-print.c : fix ns-descs JSON output + * nvme-cli: fix typo in json_print_list_items + * nvme-get-property : Add documentation + * fabrics: write ctrl_loss_tmo to fabrics device on connect + * fabrics: write keep-alive-timeout to fabrics device on connect + * nvme-models.c - search for pci.ids + * nvme-cli add ns write protect feature support + * nvme-cli: add minimal ana-log page support + * nvme-cli: add ana-log documentation + * Fix print format specifier for 64-bit + * nvme-ana-log: fixup compiler warning in show_ana_log() + * nvme-vendor: fixup c99 declaration in huawei plugin + * nvme-discover: sanitize options + * Fix nvme id namespace struct + * nvme-cli: make show_registers_cap() static + * nvme-cli: wdc-plugin mark array static declaration + * nvme-cli: fix sparse warnings for declaration + * nvme-cli: don't use unsigned for fd in lnvm-nvme.c + * nvme-cli: remove always true condition for u8 + * nvme-cli: fix dead-code nvmf log page discovery + * nvme-cli: code cleanup for passthru() handlers + * nvme-cli: fix scaandir() return value + * nvme-cli: netapp plugin handle empty strings + * nvme-cli: Fix the displayed metadata length value on Big Endian systems. + * nvme list : fix nvme list output if identify failed on device + * nvme-cli: use uniform error message for open + * nvme-cli: fix indentation + * nvme-cli: make wdc plug-in functions static + * nvme-cli: mark functions static + * nvme-cli: make malloc error handling uniform + * Enlarge local char[] so snprintf(3) can't truncate path. + * fabrics: make some arguments integers + * fabrics: don't fail empty discovery log page + * nvme: commonize subsystems info in a helper + * fabrics: add disconnect-all command + * Regen documentation + * attach-ns : fix segfault for ctrl list wrong input + * nvme-discover: Retry discovery log if the generation counter changes + * nvme-ioctl: retrieve log pages in 4k chunks + * nvme-discover: Re-check generation counter after log page transfer + * seagate-nvme: fixup coding style + * nvme-cli: Add 'rae' argument to nvme_get_log() + * nvme-cli: kill nvme_passthru_admin() + * nvme-cli: print "\n" after nvme list-subsys -o json + * nvme-cli: tests: fix fw_log test coding style + * nvme-cli: tests: fix id_ctrl test coding style + * nvme-cli: tests: fix id_ns test coding style + * nvme-cli: tests: Add get_id_ctrl function + * Update gitignore for generated test files + * Add PCI device id checking for the WDC plugin commands. + * Fix nvme test device selection to use controller value defined in the config.json file. Before this fix, the value was hard coded to nvme0. + * nvme-cli: prevent resv action field overflow + * nvme-cli: report subsystem-reset not supported by controller + * nvme-cli: fix indentation for dir_[send/receive] + * nvme-cli: make read error handling uniform + * Use sys/ioctl.h to pull in definitions. + * Remove unnecessary asm/byteorder.h + * Remove unnecessary linux/types.h include. + * Include libgen.h for basename prototype. + * Include sys/stat.h + * nvme-cli: remove endian.h + * We don't need to include linux/types.h here. + * Initialize line. + * Use standard interfaces to get timezone offsets. + * nvme-cli: fix ioctl argument + * nvme-cli: fix a typo + * Enable code block syntax highlight in README.md + * Makefile: fix bash completion install path + * NVMe-CLI WDC Plugin - Simplify the device id checking routines. + * nvme-cli: Add wdc-plugin command vs-internal-log and update wdc-plug cap-diag command with transfer-size parameter. + * nvme-cli: Add help text for wdc-plugin command vs-internal-log. Update help text for wdc-plugin command cap-diag. + * Update documentation + * nvme.spec.in : fix bash completion path, require + * nvme-cli wdc plugin: Add get pfail dump command. + * nvme-cli wdc plugin: Add documentation for pfail dump. + * Re-gen documentation for new files + * wdc: Fix strncpy warning + * Refactor plugins in a file hierarchy + * nvme-cli: fix sanitize status endianness + * nvme-cli: fix ana-log endianness + * wdc: Use const string for suffix + * nvme-cli:fix a typo in SELF-TEST log + * nvme-cli: fix a typo + * nvme-cli: fix array len to hold string of size 4 + * nvme-cli: fix endianness for the structure field + * nvme: Handle supported capabilities result for get features + * connect-all: special treatment to EALREADY afetr write to /dev/nvme-fabrics + * Added zsh completion installation + * nvme-cli: fix a typo + * nvme: fixup ANA group descriptor offset + * nvme: introduce get_nvme_ctrl_attr() + * nvme: print out controller state for 'list-subsys' + * nvme-list-subsys: Add device name argument and print out ANA state + * list-subsys: Preserve line breaks and spaces + * Regen documentation + * In json output, if the commands add zero length string, it occur allocation fail & abort (cannot display empty value) + * Fix printing of large ANAGRPID values + * micron-nvme: Replace direct use of ioctl + * Fix printing of large ANAGRPID values + * Fix typos in docs + * Fix typos in tests and utils + * fabrics: support fabrics sq flow control disable + * fabrics: use trtype_str when parsing a discovery log entry + * nvme: Add TCP transport + * fabrics: add tcp port tsas decoding + * fabrics: add transport header and data digest + * nvme-ioctl: clear rae for discovery log pages + * Added support for virtualization-management command + * nvme-cli: Don't print result on passthru error + * nvme-cli: readme: fix typo in Alpine distro support + * Added gentoo to README.md + * fabrics: pass in number of write queues + * fabrics: pass in number of polling queues + * Update documentation + * README: update Arch Linux install instructions + * fabrics: allow nr_io/write/poll_queues and queue size to discovery + * nvme: Adding a block size selector to format + * nvme: Regenerate documentation + * timeout option added to ns_create/delete (#440) + * nvme: Remove duplicate error message + * rpm spec file: add zsh completion (#447) + * nvme: Release 1.7 +- Drop obsolete patches: + - 0001-Use-tnvmcap-register-for-creating-namespace.patch + - 0002-don-t-execute-a-command-if-dry-run-is-supplied.patch + - 0003-Remove-trailing-n-so-that-the-output-is-valid-json.patch + - 0004-nvme-cli-remove-unnecessary-assignments.patch + - 0005-nvme-print.c-fix-ns-descs-JSON-output.patch + - 0006-nvme-cli-fix-typo-in-json_print_list_items.patch + - 0007-nvme-get-property-Add-documentation.patch + - 0008-fabrics-write-ctrl_loss_tmo-to-fabrics-device-on-con.patch + - 0009-fabrics-write-keep-alive-timeout-to-fabrics-device-o.patch + - 0010-nvme-models.c-search-for-pci.ids.patch + - 0011-nvme-cli-add-ns-write-protect-feature-support.patch + - 0012-nvme-cli-add-minimal-ana-log-page-support.patch + - 0013-nvme-cli-add-ana-log-documentation.patch + - 0014-Fix-print-format-specifier-for-64-bit.patch + - 0015-nvme-ana-log-fixup-compiler-warning-in-show_ana_log.patch + - 0016-nvme-vendor-fixup-c99-declaration-in-huawei-plugin.patch + - 0017-nvme-discover-sanitize-options.patch + - 0018-Fix-nvme-id-namespace-struct.patch + - 0019-nvme-cli-make-show_registers_cap-static.patch + - 0020-nvme-cli-wdc-plugin-mark-array-static-declaration.patch + - 0021-nvme-cli-fix-sparse-warnings-for-declaration.patch + - 0022-nvme-cli-don-t-use-unsigned-for-fd-in-lnvm-nvme.c.patch + - 0023-nvme-cli-remove-always-true-condition-for-u8.patch + - 0024-nvme-cli-fix-dead-code-nvmf-log-page-discovery.patch + - 0025-nvme-cli-code-cleanup-for-passthru-handlers.patch + - 0026-nvme-cli-fix-scaandir-return-value.patch + - 0027-nvme-cli-netapp-plugin-handle-empty-strings.patch + - 0028-nvme-cli-Fix-the-displayed-metadata-length-value-on-.patch + - 0029-nvme-list-fix-nvme-list-output-if-identify-failed-on.patch + - 0030-nvme-cli-use-uniform-error-message-for-open.patch + - 0031-nvme-cli-fix-indentation.patch + - 0032-nvme-cli-make-wdc-plug-in-functions-static.patch + - 0033-nvme-cli-mark-functions-static.patch + - 0034-nvme-cli-make-malloc-error-handling-uniform.patch + - 0035-Enlarge-local-char-so-snprintf-3-can-t-truncate-path.patch + - 0036-fabrics-make-some-arguments-integers.patch + - 0037-fabrics-don-t-fail-empty-discovery-log-page.patch + - 0038-nvme-commonize-subsystems-info-in-a-helper.patch + - 0039-fabrics-add-disconnect-all-command.patch + - 0040-Regen-documentation.patch + - 0041-attach-ns-fix-segfault-for-ctrl-list-wrong-input.patch + - 0042-nvme-discover-Retry-discovery-log-if-the-generation-.patch + - 0043-nvme-ioctl-retrieve-log-pages-in-4k-chunks.patch + - 0044-nvme-discover-Re-check-generation-counter-after-log-.patch + - 0045-seagate-nvme-fixup-coding-style.patch + - 0046-nvme-cli-Add-rae-argument-to-nvme_get_log.patch + - 0047-nvme-cli-kill-nvme_passthru_admin.patch + - 0048-nvme-cli-print-n-after-nvme-list-subsys-o-json.patch + - 0049-nvme-cli-tests-fix-fw_log-test-coding-style.patch + - 0050-nvme-cli-tests-fix-id_ctrl-test-coding-style.patch + - 0051-nvme-cli-tests-fix-id_ns-test-coding-style.patch + - 0052-nvme-cli-tests-Add-get_id_ctrl-function.patch + - 0054-Add-PCI-device-id-checking-for-the-WDC-plugin-comman.patch + - 0055-Fix-nvme-test-device-selection-to-use-controller-val.patch + - 0056-nvme-cli-prevent-resv-action-field-overflow.patch + - 0057-nvme-cli-report-subsystem-reset-not-supported-by-con.patch + - 0058-nvme-cli-fix-indentation-for-dir_-send-receive.patch + - 0059-nvme-cli-make-read-error-handling-uniform.patch + - 0060-Use-sys-ioctl.h-to-pull-in-definitions.patch + - 0061-Remove-unnecessary-asm-byteorder.h.patch + - 0062-Remove-unnecessary-linux-types.h-include.patch + - 0063-Include-libgen.h-for-basename-prototype.patch + - 0064-Include-sys-stat.h.patch + - 0065-nvme-cli-remove-endian.h.patch + - 0066-We-don-t-need-to-include-linux-types.h-here.patch + - 0067-Initialize-line.patch + - 0068-Use-standard-interfaces-to-get-timezone-offsets.patch ++++ 318 more lines (skipped) ++++ between /work/SRC/openSUSE:Factory/nvme-cli/nvme-cli.changes ++++ and /work/SRC/openSUSE:Factory/.nvme-cli.new.28833/nvme-cli.changes Old: ---- nvme-cli-1.6.tar.gz New: ---- 0001-wdc-Change-device-capability-checking.patch 0002-wdc-Add-additional-device-for-vs-internal-log.patch 0003-generate-new-documentation.patch 0004-Fix-compilation-with-GCC-8.patch 0005-Fix-CFLAGS-parameter.patch 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch 0100-nvme_fc-auto-connect-scripts.patch nvme-cli-1.7.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ nvme-cli.spec ++++++ --- /var/tmp/diff_new_pack.QduteC/_old 2019-01-28 20:50:47.953756205 +0100 +++ /var/tmp/diff_new_pack.QduteC/_new 2019-01-28 20:50:47.953756205 +0100 @@ -1,7 +1,7 @@ # # spec file for package nvme-cli # -# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany. +# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany. # # All modifications and additions to the file contributed by third parties # remain the property of their copyright owners, unless otherwise agreed @@ -17,13 +17,20 @@ Name: nvme-cli -Version: 1.6 +Version: 1.7 Release: 0 Summary: NVM Express user space tools License: GPL-2.0-only Group: Hardware/Other Url: https://github.com/linux-nvme/nvme-cli Source: %{name}-%{version}.tar.gz +Patch1: 0001-wdc-Change-device-capability-checking.patch +Patch2: 0002-wdc-Add-additional-device-for-vs-internal-log.patch +Patch3: 0003-generate-new-documentation.patch +Patch4: 0004-Fix-compilation-with-GCC-8.patch +Patch5: 0005-Fix-CFLAGS-parameter.patch +Patch6: 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch +Patch100: 0100-nvme_fc-auto-connect-scripts.patch BuildRequires: asciidoc BuildRequires: libuuid-devel BuildRequires: xmlto @@ -37,15 +44,30 @@ %prep %setup -q -n %{name}-%{version} +%patch1 -p1 +%patch2 -p1 +%patch3 -p1 +%patch4 -p1 +%patch5 -p1 +%patch6 -p1 +%patch100 -p1 %build echo %{version} > version -make CFLAGS="%{optflags}" PREFIX=%{_prefix} %{?_smp_mflags} all +make CFLAGS="%{optflags} -I." PREFIX=%{_prefix} %{?_smp_mflags} all %install make PREFIX=%{_prefix} DESTDIR=%{buildroot} install-bin install-man %{?_smp_mflags} install -m 644 -D /dev/null %{buildroot}%{_sysconfdir}/nvme/hostnqn install -m 644 -D completions/bash-nvme-completion.sh %{buildroot}%{_sysconfdir}/bash_completion.d/nvme +install -m 644 -D nvme-fc-autoconnect/70-nvmefc-autoconnect.rules %{buildroot}%{_udevrulesdir}/70-nvmefc-autoconnect.rules +install -m 644 -D nvme-fc-autoconnect/nvmefc-boot-connections.service %{buildroot}%{_unitdir}/nvmefc-boot-connections.service +install -m 644 -D nvme-fc-autoconnect/[email protected] %{buildroot}%{_unitdir}/[email protected] + +%define services nvmefc-boot-connections.service + +%pre +%service_add_pre %services %post if [ ! -e %{_sysconfdir}/nvme/hostnqn ]; then @@ -54,6 +76,13 @@ if [ ! -e %{_sysconfdir}/nvme/hostid ]; then %{_bindir}/uuidgen > %{_sysconfdir}/nvme/hostid fi +%service_add_post %services + +%preun +%service_del_preun %services [email protected] + +%postun +%service_del_postun %services [email protected] %files %defattr(-,root,root) @@ -62,6 +91,9 @@ %{_mandir}/man1/nvme*.1* %dir %{_sysconfdir}/bash_completion.d/ %{_sysconfdir}/bash_completion.d/nvme +%{_udevrulesdir}/70-nvmefc-autoconnect.rules +%{_unitdir}/nvmefc-boot-connections.service +%{_unitdir}/[email protected] %dir %{_sysconfdir}/nvme/ %ghost %{_sysconfdir}/nvme/hostnqn %ghost %{_sysconfdir}/nvme/hostid ++++++ 0001-wdc-Change-device-capability-checking.patch ++++++ ++++ 783 lines (skipped) ++++++ 0002-wdc-Add-additional-device-for-vs-internal-log.patch ++++++ >From 47384b5e28a13cd060dddbf24d18cf0a8c11fd03 Mon Sep 17 00:00:00 2001 From: Dong Ho <[email protected]> Date: Fri, 11 Jan 2019 00:37:09 +0000 Subject: [PATCH] wdc: Add additional device for vs-internal-log Add support for SN730 device to vs-internal-log. Reviewed-by Chaitanya Kulkarni <[email protected]> --- plugins/wdc/wdc-nvme.c | 266 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 266 insertions(+) diff --git a/plugins/wdc/wdc-nvme.c b/plugins/wdc/wdc-nvme.c index d198571..88c5c76 100644 --- a/plugins/wdc/wdc-nvme.c +++ b/plugins/wdc/wdc-nvme.c @@ -69,6 +69,8 @@ #define WDC_NVME_SN520_DEV_ID_1 0x5004 #define WDC_NVME_SN520_DEV_ID_2 0x5005 #define WDC_NVME_SN720_DEV_ID 0x5002 +#define WDC_NVME_SN730_DEV_ID 0x3714 +#define WDC_NVME_SN730_DEV_ID_1 0x3734 #define WDC_DRIVE_CAP_CAP_DIAG 0x0000000000000001 #define WDC_DRIVE_CAP_INTERNAL_LOG 0x0000000000000002 @@ -80,6 +82,21 @@ #define WDC_DRIVE_CAP_DRIVE_ESSENTIALS 0x0000000100000000 #define WDC_DRIVE_CAP_DUI_DATA 0x0000000200000000 +#define WDC_SN730_CAP_VUC_LOG 0x0000000400000000 + +/* SN730 Get Log Capabilities */ +#define SN730_NVME_GET_LOG_OPCODE 0xc2 +#define SN730_GET_FULL_LOG_LENGTH 0x00080009 +#define SN730_GET_KEY_LOG_LENGTH 0x00090009 +#define SN730_GET_COREDUMP_LOG_LENGTH 0x00120009 +#define SN730_GET_EXTENDED_LOG_LENGTH 0x00420009 + +#define SN730_GET_FULL_LOG_SUBOPCODE 0x00010009 +#define SN730_GET_KEY_LOG_SUBOPCODE 0x00020009 +#define SN730_GET_CORE_LOG_SUBOPCODE 0x00030009 +#define SN730_GET_EXTEND_LOG_SUBOPCODE 0x00040009 +#define SN730_LOG_CHUNK_SIZE 0x1000 + /* Capture Diagnostics */ #define WDC_NVME_CAP_DIAG_HEADER_TOC_SIZE WDC_NVME_LOG_SIZE_DATA_LEN #define WDC_NVME_CAP_DIAG_OPCODE 0xE6 @@ -277,6 +294,18 @@ typedef struct _WDC_DE_CSA_FEATURE_ID_LIST __u8 featureName[WDC_DE_GENERIC_BUFFER_SIZE]; } WDC_DE_CSA_FEATURE_ID_LIST; +typedef struct tarfile_metadata { + char fileName[MAX_PATH_LEN]; + int8_t bufferFolderPath[MAX_PATH_LEN]; + char bufferFolderName[MAX_PATH_LEN]; + char tarFileName[MAX_PATH_LEN]; + char tarFiles[MAX_PATH_LEN]; + char tarCmd[MAX_PATH_LEN+MAX_PATH_LEN]; + char currDir[MAX_PATH_LEN]; + UtilsTimeInfo timeInfo; + uint8_t* timeString[MAX_PATH_LEN]; +} tarfile_metadata; + static WDC_DE_CSA_FEATURE_ID_LIST deFeatureIdList[] = { {0x00 , "Dummy Placeholder"}, @@ -580,6 +609,11 @@ static __u64 wdc_get_drive_capabilities(int fd) { WDC_DRIVE_CAP_CA_LOG_PAGE | WDC_DRIVE_CAP_DRIVE_STATUS | WDC_DRIVE_CAP_CLEAR_ASSERT); break; + case WDC_NVME_SN730_DEV_ID: + /* FALLTHRU */ + case WDC_NVME_SN730_DEV_ID_1: + capabilities = WDC_SN730_CAP_VUC_LOG; + break; default: capabilities = 0; } @@ -1049,6 +1083,236 @@ static int wdc_cap_diag(int argc, char **argv, struct command *command, return 0; } +static int wdc_do_get_sn730_log_len(int fd, uint32_t *len_buf, uint32_t subopcode) +{ + int ret; + uint32_t *output = NULL; + struct nvme_admin_cmd admin_cmd; + + if ((output = (uint32_t*)malloc(sizeof(uint32_t))) == NULL) { + fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno)); + return -1; + } + memset(output, 0, sizeof (uint32_t)); + memset(&admin_cmd, 0, sizeof (struct nvme_admin_cmd)); + + admin_cmd.data_len = 8; + admin_cmd.opcode = SN730_NVME_GET_LOG_OPCODE; + admin_cmd.addr = (uintptr_t)output; + admin_cmd.cdw12 = subopcode; + admin_cmd.cdw10 = SN730_LOG_CHUNK_SIZE / 4; + + ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd); + if (ret == 0) + *len_buf = *output; + free(output); + return ret; +} + +static int wdc_do_get_sn730_log(int fd, void * log_buf, uint32_t offset, uint32_t subopcode) +{ + int ret; + uint8_t *output = NULL; + struct nvme_admin_cmd admin_cmd; + + if ((output = (uint8_t*)calloc(SN730_LOG_CHUNK_SIZE, sizeof(uint8_t))) == NULL) { + fprintf(stderr, "ERROR : WDC : calloc : %s\n", strerror(errno)); + return -1; + } + memset(&admin_cmd, 0, sizeof (struct nvme_admin_cmd)); + admin_cmd.data_len = SN730_LOG_CHUNK_SIZE; + admin_cmd.opcode = SN730_NVME_GET_LOG_OPCODE; + admin_cmd.addr = (uintptr_t)output; + admin_cmd.cdw12 = subopcode; + admin_cmd.cdw13 = offset; + admin_cmd.cdw10 = SN730_LOG_CHUNK_SIZE / 4; + + ret = nvme_submit_passthru(fd, NVME_IOCTL_ADMIN_CMD, &admin_cmd); + if (!ret) + memcpy(log_buf, output, SN730_LOG_CHUNK_SIZE); + return ret; +} + +static int get_sn730_log_chunks(int fd, uint8_t* log_buf, uint32_t log_len, uint32_t subopcode) +{ + int ret = 0; + uint8_t* chunk_buf = NULL; + int remaining = log_len; + int curr_offset = 0; + + if ((chunk_buf = (uint8_t*) malloc(sizeof (uint8_t) * SN730_LOG_CHUNK_SIZE)) == NULL) { + fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno)); + ret = -1; + goto out; + } + + while (remaining > 0) { + memset(chunk_buf, 0, SN730_LOG_CHUNK_SIZE); + ret = wdc_do_get_sn730_log(fd, chunk_buf, curr_offset, subopcode); + if (!ret) { + if (remaining >= SN730_LOG_CHUNK_SIZE) { + memcpy(log_buf + (curr_offset * SN730_LOG_CHUNK_SIZE), + chunk_buf, SN730_LOG_CHUNK_SIZE); + } else { + memcpy(log_buf + (curr_offset * SN730_LOG_CHUNK_SIZE), + chunk_buf, remaining); + } + remaining -= SN730_LOG_CHUNK_SIZE; + curr_offset += 1; + } else + goto out; + } +out: + free(chunk_buf); + return ret; +} + +static int wdc_do_sn730_get_and_tar(int fd, char * outputName) +{ + int ret = 0; + void *retPtr; + uint8_t* full_log_buf = NULL; + uint8_t* key_log_buf = NULL; + uint8_t* core_dump_log_buf = NULL; + uint8_t* extended_log_buf = NULL; + uint32_t full_log_len = 0; + uint32_t key_log_len = 0; + uint32_t core_dump_log_len = 0; + uint32_t extended_log_len = 0; + tarfile_metadata* tarInfo = NULL; + + tarInfo = (struct tarfile_metadata*) malloc(sizeof(tarfile_metadata)); + if (tarInfo == NULL) { + fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno)); + ret = -1; + goto free_buf; + } + memset(tarInfo, 0, sizeof(tarfile_metadata)); + + /* Create Logs directory */ + wdc_UtilsGetTime(&tarInfo->timeInfo); + memset(tarInfo->timeString, 0, sizeof(tarInfo->timeString)); + wdc_UtilsSnprintf((char*)tarInfo->timeString, MAX_PATH_LEN, "%02u%02u%02u_%02u%02u%02u", + tarInfo->timeInfo.year, tarInfo->timeInfo.month, tarInfo->timeInfo.dayOfMonth, + tarInfo->timeInfo.hour, tarInfo->timeInfo.minute, tarInfo->timeInfo.second); + + wdc_UtilsSnprintf((char*)tarInfo->bufferFolderName, MAX_PATH_LEN, "%s", + (char*)outputName); + + retPtr = getcwd((char*)tarInfo->currDir, MAX_PATH_LEN); + if (retPtr != NULL) + wdc_UtilsSnprintf((char*)tarInfo->bufferFolderPath, MAX_PATH_LEN, "%s%s%s", + (char *)tarInfo->currDir, WDC_DE_PATH_SEPARATOR, (char *)tarInfo->bufferFolderName); + else { + fprintf(stderr, "ERROR : WDC : get current working directory failed\n"); + goto free_buf; + } + + ret = wdc_UtilsCreateDir((char*)tarInfo->bufferFolderPath); + if (ret) + { + fprintf(stderr, "ERROR : WDC : create directory failed, ret = %d, dir = %s\n", ret, tarInfo->bufferFolderPath); + goto free_buf; + } else { + fprintf(stderr, "Stored log files in directory: %s\n", tarInfo->bufferFolderPath); + } + + ret = wdc_do_get_sn730_log_len(fd, &full_log_len, SN730_GET_FULL_LOG_LENGTH); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + ret = wdc_do_get_sn730_log_len(fd, &key_log_len, SN730_GET_KEY_LOG_LENGTH); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + ret = wdc_do_get_sn730_log_len(fd, &core_dump_log_len, SN730_GET_COREDUMP_LOG_LENGTH); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + ret = wdc_do_get_sn730_log_len(fd, &extended_log_len, SN730_GET_EXTENDED_LOG_LENGTH); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + + full_log_buf = (uint8_t*) calloc(full_log_len, sizeof (uint8_t)); + key_log_buf = (uint8_t*) calloc(key_log_len, sizeof (uint8_t)); + core_dump_log_buf = (uint8_t*) calloc(core_dump_log_len, sizeof (uint8_t)); + extended_log_buf = (uint8_t*) calloc(extended_log_len, sizeof (uint8_t)); + + if (!full_log_buf || !key_log_buf || !core_dump_log_buf || !extended_log_buf) { + fprintf(stderr, "ERROR : WDC : malloc : %s\n", strerror(errno)); + ret = -1; + goto free_buf; + } + + /* Get the full log */ + ret = get_sn730_log_chunks(fd, full_log_buf, full_log_len, SN730_GET_FULL_LOG_SUBOPCODE); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + + /* Get the key log */ + ret = get_sn730_log_chunks(fd, key_log_buf, key_log_len, SN730_GET_KEY_LOG_SUBOPCODE); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + + /* Get the core dump log */ + ret = get_sn730_log_chunks(fd, core_dump_log_buf, core_dump_log_len, SN730_GET_CORE_LOG_SUBOPCODE); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + + /* Get the extended log */ + ret = get_sn730_log_chunks(fd, extended_log_buf, extended_log_len, SN730_GET_EXTEND_LOG_SUBOPCODE); + if (ret) { + fprintf(stderr, "NVMe Status:%s(%x)\n", nvme_status_to_string(ret), ret); + goto free_buf; + } + + /* Write log files */ + wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR, + "full_log", (char*)tarInfo->timeString); + wdc_WriteToFile(tarInfo->fileName, (char*)full_log_buf, full_log_len); + + wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR, + "key_log", (char*)tarInfo->timeString); + wdc_WriteToFile(tarInfo->fileName, (char*)key_log_buf, key_log_len); + + wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR, + "core_dump_log", (char*)tarInfo->timeString); + wdc_WriteToFile(tarInfo->fileName, (char*)core_dump_log_buf, core_dump_log_len); + + wdc_UtilsSnprintf(tarInfo->fileName, MAX_PATH_LEN, "%s%s%s_%s.bin", (char*)tarInfo->bufferFolderPath, WDC_DE_PATH_SEPARATOR, + "extended_log", (char*)tarInfo->timeString); + wdc_WriteToFile(tarInfo->fileName, (char*)extended_log_buf, extended_log_len); + + /* Tar the log directory */ + wdc_UtilsSnprintf(tarInfo->tarFileName, sizeof(tarInfo->tarFileName), "%s%s", (char*)tarInfo->bufferFolderPath, WDC_DE_TAR_FILE_EXTN); + wdc_UtilsSnprintf(tarInfo->tarFiles, sizeof(tarInfo->tarFiles), "%s%s%s", (char*)tarInfo->bufferFolderName, WDC_DE_PATH_SEPARATOR, WDC_DE_TAR_FILES); + wdc_UtilsSnprintf(tarInfo->tarCmd, sizeof(tarInfo->tarCmd), "%s %s %s", WDC_DE_TAR_CMD, (char*)tarInfo->tarFileName, (char*)tarInfo->tarFiles); + + ret = system(tarInfo->tarCmd); + + if (ret) + fprintf(stderr, "ERROR : WDC : Tar of log data failed, ret = %d\n", ret); + +free_buf: + free(tarInfo); + free(full_log_buf); + free(core_dump_log_buf); + free(key_log_buf); + free(extended_log_buf); + return ret; +} + static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command, struct plugin *plugin) { @@ -1111,6 +1375,8 @@ static int wdc_vs_internal_fw_log(int argc, char **argv, struct command *command if ((capabilities & WDC_DRIVE_CAP_INTERNAL_LOG) == WDC_DRIVE_CAP_INTERNAL_LOG) { snprintf(f + strlen(f), PATH_MAX, "%s", ".bin"); return wdc_do_cap_diag(fd, f, xfer_size); + } else if ((capabilities & WDC_SN730_CAP_VUC_LOG) == WDC_SN730_CAP_VUC_LOG) { + return wdc_do_sn730_get_and_tar(fd, f); } else { fprintf(stderr, "ERROR : WDC: unsupported device for this command\n"); return -1; -- 2.13.7 ++++++ 0003-generate-new-documentation.patch ++++++ ++++ 2551 lines (skipped) ++++++ 0004-Fix-compilation-with-GCC-8.patch ++++++ >From dc26bb70d82569730b4ce5c88f22084812a2334d Mon Sep 17 00:00:00 2001 From: Breno Leitao <[email protected]> Date: Mon, 21 Jan 2019 06:31:15 -0500 Subject: [PATCH] Fix compilation with GCC-8 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Printf() is being called to print an unsigned long int using the long long identifier. This causes the following error with GCC-8: nvme.c:3056:5: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=] "Invalid value for block size (%llu), must be a power of two\n", ^ nvme.c:3091:6: error: format ‘%llu’ expects argument of type ‘long long unsigned int’, but argument 3 has type ‘__u64 {aka long unsigned int}’ [-Werror=format=] "LBAF corresponding to block size %llu (LBAF %u) not found\n", Adjusting the printf arguments to print the proper format. Signed-off-by: Breno Leitao <[email protected]> --- nvme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/nvme.c b/nvme.c index 992c6b9..e85834d 100644 --- a/nvme.c +++ b/nvme.c @@ -3053,7 +3053,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu if (cfg.bs) { if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) { fprintf(stderr, - "Invalid value for block size (%llu), must be a power of two\n", + "Invalid value for block size (%lu), must be a power of two\n", cfg.bs); return EINVAL; } @@ -3088,7 +3088,7 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu } if (cfg.lbaf == 0xff) { fprintf(stderr, - "LBAF corresponding to block size %llu (LBAF %u) not found\n", + "LBAF corresponding to block size %lu (LBAF %u) not found\n", cfg.bs, lbads); fprintf(stderr, "Please correct block size, or specify LBAF directly\n"); -- 2.13.7 ++++++ 0005-Fix-CFLAGS-parameter.patch ++++++ >From 254bcd6b23436fd929e18c935322410b541ca121 Mon Sep 17 00:00:00 2001 From: Breno Leitao <[email protected]> Date: Mon, 21 Jan 2019 07:03:24 -0500 Subject: [PATCH] Fix CFLAGS parameter Currently nvme-cli 1.7 is not compiling on Debian because the Debian helper (compilation toolkit) does pass a CFLAGS variable, thus, avoiding the initial definition (CFLAGS ?= -O2 -g -Wall -Werror -I.) The problem is that -I should not be removed, otherwise the code does not compile, with the following bug: cc -Wdate-time -D_FORTIFY_SOURCE=2 -D_GNU_SOURCE -D__CHECK_ENDIAN__ -g -O2 -fdebug-prefix-map=/home/breno/nvme/nvme-cli-1.7=. -fstack-protector-strong -Wformat -Werror=format-security -std=gnu99 -DLIBUUID -DNVME_VERSION='"1.7"' -o plugins/intel/intel-nvme.o -c plugins/intel/intel-nvme.c plugins/intel/intel-nvme.c:10:18: fatal error: nvme.h: No such file or directory compilation terminated. This patch just moves the -I parameter to part of the CFLAGS that is not replaced by dh's CFLAGS. Signed-off-by: Breno Leitao <[email protected]> --- Makefile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 525616a..3a4e223 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ -CFLAGS ?= -O2 -g -Wall -Werror -I. -CFLAGS += -std=gnu99 +CFLAGS ?= -O2 -g -Wall -Werror +CFLAGS += -std=gnu99 -I. CPPFLAGS += -D_GNU_SOURCE -D__CHECK_ENDIAN__ LIBUUID = $(shell $(LD) -o /dev/null -luuid >/dev/null 2>&1; echo $$?) NVME = nvme -- 2.13.7 ++++++ 0006-nvme-cli-fix-compilation-with-uint64_t-cast.patch ++++++ >From 97274c2cf573349e637b4a55c0045488206470ad Mon Sep 17 00:00:00 2001 From: Chaitanya Kulkarni <[email protected]> Date: Fri, 25 Jan 2019 08:54:32 -0700 Subject: [PATCH] nvme-cli: fix compilation with uint64_t cast Signed-off-by: Chaitanya Kulkarni <[email protected]> --- nvme.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/nvme.c b/nvme.c index e85834d..8922ec2 100644 --- a/nvme.c +++ b/nvme.c @@ -3053,8 +3053,8 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu if (cfg.bs) { if ((cfg.bs & (~cfg.bs + 1)) != cfg.bs) { fprintf(stderr, - "Invalid value for block size (%lu), must be a power of two\n", - cfg.bs); + "Invalid value for block size (%"PRIu64"), must be a power of two\n", + (uint64_t) cfg.bs); return EINVAL; } } @@ -3088,8 +3088,8 @@ static int format(int argc, char **argv, struct command *cmd, struct plugin *plu } if (cfg.lbaf == 0xff) { fprintf(stderr, - "LBAF corresponding to block size %lu (LBAF %u) not found\n", - cfg.bs, lbads); + "LBAF corresponding to block size %"PRIu64"(LBAF %u) not found\n", + (uint64_t)cfg.bs, lbads); fprintf(stderr, "Please correct block size, or specify LBAF directly\n"); return EINVAL; -- 2.13.7 ++++++ 0100-nvme_fc-auto-connect-scripts.patch ++++++ >From 6d827f7848212033ba2e560922a4b55bc323a1ef Mon Sep 17 00:00:00 2001 From: Hannes Reinecke <[email protected]> Date: Mon, 14 Jan 2019 10:15:16 +0100 Subject: [PATCH] nvme_fc auto-connect scripts References: bsc#1103354 Here's a set of script to enable FC-NVMe autoconnect, based on the initial posting from James Smart. FC-NVMe already generates an uevent whenever a new FC-NVMe remote port is registered, so we can create an udev rule to parse this event and start connecting to it. The problem here is that the 'nvme connect' call might be taking some time or might even stall altogether, so we cannot call it directly from the udev rule. Rather, the udev rule starts a systemd service, which then calls 'nvme connect' as a 'oneshot' program. With this approach we are insulated from any stalls in udev rules. Additionally we can implement a boot service to restart any missed connections attempts. Cc: James Smart <[email protected]> Signed-off-by: Hannes Reinecke <[email protected]> --- nvme-fc-autoconnect/70-nvmefc-autoconnect.conf | 1 + nvme-fc-autoconnect/70-nvmefc-autoconnect.rules | 8 ++++++++ nvme-fc-autoconnect/nvmefc-boot-connections.service | 9 +++++++++ nvme-fc-autoconnect/[email protected] | 14 ++++++++++++++ 4 files changed, 32 insertions(+) create mode 100644 nvme-fc-autoconnect/70-nvmefc-autoconnect.conf create mode 100644 nvme-fc-autoconnect/70-nvmefc-autoconnect.rules create mode 100644 nvme-fc-autoconnect/nvmefc-boot-connections.service create mode 100644 nvme-fc-autoconnect/[email protected] diff --git a/nvme-fc-autoconnect/70-nvmefc-autoconnect.conf b/nvme-fc-autoconnect/70-nvmefc-autoconnect.conf new file mode 100644 index 0000000..b92d94f --- /dev/null +++ b/nvme-fc-autoconnect/70-nvmefc-autoconnect.conf @@ -0,0 +1 @@ +install_items+="/usr/lib/udev/rules.d/70-nvmefc-autoconnect.rules" diff --git a/nvme-fc-autoconnect/70-nvmefc-autoconnect.rules b/nvme-fc-autoconnect/70-nvmefc-autoconnect.rules new file mode 100644 index 0000000..aa4f9bf --- /dev/null +++ b/nvme-fc-autoconnect/70-nvmefc-autoconnect.rules @@ -0,0 +1,8 @@ +# +# nvme_fc: udev event to automatically scan (via discovery controller) +# new FC nvme remote ports and auto-connect to the subsystems they report. +# + +ACTION=="change", SUBSYSTEM=="fc", ENV{FC_EVENT}=="nvmediscovery", \ + ENV{NVMEFC_HOST_TRADDR}=="*", ENV{NVMEFC_TRADDR}=="*", \ + RUN+="/usr/bin/systemctl --no-block start nvmefc-connect@--host-traddr=$env{NVMEFC_HOST_TRADDR}\\x20--traddr=$env{NVMEFC_TRADDR}.service" diff --git a/nvme-fc-autoconnect/nvmefc-boot-connections.service b/nvme-fc-autoconnect/nvmefc-boot-connections.service new file mode 100644 index 0000000..aa35c15 --- /dev/null +++ b/nvme-fc-autoconnect/nvmefc-boot-connections.service @@ -0,0 +1,9 @@ +[Unit] +Description=Auto-connect to subsystems on FC-NVME devices during boot + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "echo add > /sys/class/fc/fc_udev_device/nvme_discovery" + +[Install] +WantedBy=default.target diff --git a/nvme-fc-autoconnect/[email protected] b/nvme-fc-autoconnect/[email protected] new file mode 100644 index 0000000..c2370d6 --- /dev/null +++ b/nvme-fc-autoconnect/[email protected] @@ -0,0 +1,14 @@ +# +# Unit file used by 70-nvmefc-autoconnect.rules. +# + +[Unit] +Description=Auto-connect to subsystems on FC-NVME devices +After=syslog.target + +[Service] +Type=oneshot +ExecStart=/bin/sh -c "/usr/sbin/nvme connect-all --transport=fc `/usr/bin/echo -e '%i'`" + +[Install] +WantedBy=default.target -- 2.13.7 ++++++ _service ++++++ --- /var/tmp/diff_new_pack.QduteC/_old 2019-01-28 20:50:48.025756130 +0100 +++ /var/tmp/diff_new_pack.QduteC/_new 2019-01-28 20:50:48.025756130 +0100 @@ -3,8 +3,8 @@ <param name="scm">git</param> <param name="url">https://github.com/linux-nvme/nvme-cli.git</param> <param name="filename">nvme-cli</param> - <param name="version">1.6</param> - <param name="revision">v1.6</param> + <param name="version">1.7</param> + <param name="revision">v1.7</param> <param name="exclude">.git</param> <param name="changesgenerate">enable</param> </service> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.QduteC/_old 2019-01-28 20:50:48.041756113 +0100 +++ /var/tmp/diff_new_pack.QduteC/_new 2019-01-28 20:50:48.041756113 +0100 @@ -1,4 +1,4 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/linux-nvme/nvme-cli.git</param> - <param name="changesrevision">642d426faf8a67ed01e90f7c35c0d967f8cc52a3</param></service></servicedata> \ No newline at end of file + <param name="changesrevision">4704680580b24cd7ea399e9ac679839d0414c1c9</param></service></servicedata> \ No newline at end of file ++++++ nvme-cli-1.6.tar.gz -> nvme-cli-1.7.tar.gz ++++++ ++++ 32592 lines of diff (skipped)
