]> www.infradead.org Git - users/sagi/nvme-cli.git/log
users/sagi/nvme-cli.git
6 years agovirtium: Declare local symbols static
Bart Van Assche [Tue, 18 Jun 2019 18:14:15 +0000 (11:14 -0700)]
virtium: Declare local symbols static

This patch avoids that sparse complains about missing declarations.

Cc: Quyen Truong <quyen.truong@virtium.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agoseagate: Declare local functions static
Bart Van Assche [Tue, 18 Jun 2019 17:06:41 +0000 (10:06 -0700)]
seagate: Declare local functions static

This patch avoids that sparse complains about missing declarations.

Cc: Muhammad Ahmad <muhammad.ahmad@seagate.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agohuawei: Declare local functions static
Bart Van Assche [Tue, 18 Jun 2019 17:18:26 +0000 (10:18 -0700)]
huawei: Declare local functions static

This patch avoids that sparse complains about missing declarations.

Cc: Zou Ming <zouming.zouming@huawei.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agoUse NULL instead of 0 where a pointer is expected
Bart Van Assche [Tue, 18 Jun 2019 18:12:19 +0000 (11:12 -0700)]
Use NULL instead of 0 where a pointer is expected

This patch avoids that sparse reports the following:

warning: Using plain integer as NULL pointer

Cc: Muhammad Ahmad <muhammad.ahmad@seagate.com>
Cc: Quyen Truong <quyen.truong@virtium.com>
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agoRemove superfluous casts
Bart Van Assche [Tue, 18 Jun 2019 16:16:46 +0000 (09:16 -0700)]
Remove superfluous casts

The le64_to_cpu() definition is as follows:

  #define le64_to_cpu(x) le64toh((__force __u64)(x))

According to the le64toh() man page, the return type of that function
is uint64_t. Hence drop the cast from (uint64_t)le64_to_cpu(x)
expressions. This patch has been generated as follows:

  git ls-tree --name-only -r HEAD |
    while read f; do
      [ -f "$f" ] && sed -i 's/(uint64_t)le64_to_cpu(/le64_to_cpu(/g' "$f"
    done

Signed-off-by: Bart Van Assche <bvanassche@acm.org>
6 years agoMerge pull request #507 from YoavCohen/master
Keith Busch [Mon, 10 Jun 2019 15:45:59 +0000 (09:45 -0600)]
Merge pull request #507 from YoavCohen/master

Some Json enhancements

6 years agoMerge pull request #509 from Tonyongxing/master
Keith Busch [Mon, 10 Jun 2019 15:45:46 +0000 (09:45 -0600)]
Merge pull request #509 from Tonyongxing/master

NVMe-Cli Shannon Plugin-add support for shannon systems.

6 years agoMerge pull request #508 from kheitke/sanitize-pretty-print
Keith Busch [Mon, 10 Jun 2019 15:45:02 +0000 (09:45 -0600)]
Merge pull request #508 from kheitke/sanitize-pretty-print

nvme-print: add pretty print for estimated sanitize time

6 years agoNVMe-Cli Shannon Plugin-add support for shannon systems.
yongxing [Mon, 10 Jun 2019 14:56:33 +0000 (22:56 +0800)]
NVMe-Cli Shannon Plugin-add support for shannon systems.

    Hello,current NVMe-Cli tools hasn't supprot for shannon systems, we want to add it.
    May we add some specific commands?
    We add four NVMe commands for shannon temporarily,smart-log-add, get-feature-add, set-feature-add,
    and id-ctrl.

    Any problems, please contact me with:

    Email:yongxing.sun@shannon-sys.com

6 years agonvme: fix coding style issue
Max Gurtovoy [Thu, 30 May 2019 09:43:26 +0000 (12:43 +0300)]
nvme: fix coding style issue

It's more common to use the following coding style:
if (condition) {
   do_that;
   do_this;
} else if (condition2) {
   do_this;
} else {
   do_that;
}

Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
6 years agonvme-print: fix json object memory leak
Max Gurtovoy [Thu, 30 May 2019 09:43:25 +0000 (12:43 +0300)]
nvme-print: fix json object memory leak

Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
6 years agofabrics: Fix memory leak of subsys list
Max Gurtovoy [Thu, 30 May 2019 09:43:24 +0000 (12:43 +0300)]
fabrics: Fix memory leak of subsys list

Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
6 years agonvme: update description for "nvme list" command
Max Gurtovoy [Thu, 30 May 2019 09:43:23 +0000 (12:43 +0300)]
nvme: update description for "nvme list" command

The "nvme list" command doesn't get any device handle as an input
argument. This operation prints out a basic information for all NVMe
namespaces in the system.

Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
6 years agonvme: update list-ns nsid option
Max Gurtovoy [Thu, 30 May 2019 09:43:22 +0000 (12:43 +0300)]
nvme: update list-ns nsid option

This commit updates the optional nsid argument to define the wanted
nsid for start, instead of starting from nsid + 1. E.g. in case we've
wanted to get the list of namespaces starting from 1, before this
commit, we used the "--namespace-id=0" option. Nsid 0 is not valid in
NVMe spec, thus change it to start counting from the given nsid.

Reviewed-by: Minwoo Im <minwoo.im@samsung.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
6 years agonvme-print: add pretty print for estimated sanitize time
Kenneth Heitke [Mon, 3 Jun 2019 21:42:39 +0000 (15:42 -0600)]
nvme-print: add pretty print for estimated sanitize time

Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
6 years agoadd namespace to json output of nvme list
Yoav Cohen [Wed, 29 May 2019 14:15:19 +0000 (17:15 +0300)]
add namespace to json output of nvme list

6 years agoadd free call for json object for commands show-regs
Yoav Cohen [Wed, 29 May 2019 14:13:45 +0000 (17:13 +0300)]
add free call for json object for commands show-regs

6 years agoadd newline for command show-regs
Yoav Cohen [Wed, 29 May 2019 14:11:44 +0000 (17:11 +0300)]
add newline for command show-regs

6 years agonvme-cli: remove unnecessary initialize of local var
Minwoo Im [Thu, 16 May 2019 17:23:50 +0000 (10:23 -0700)]
nvme-cli: remove unnecessary initialize of local var

This patch does not have any functional changes here.  Just clean-up the
unnecessary initialize.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agonvme-cli: don't try to disconnect for ctrl with pcie transport
Minwoo Im [Thu, 16 May 2019 17:23:49 +0000 (10:23 -0700)]
nvme-cli: don't try to disconnect for ctrl with pcie transport

If a host system has both pcie and fabrics controllers, the following
nvme-cli disconnect-all command will might not be working because
contrlller with pcie transport does not have delete_controller in sysfs.

root@target:~# nvme list
Node             SN                   Model                                    Namespace Usage                      Format           FW Rev
---------------- -------------------- ---------------------------------------- --------- -------------------------- ---------------- --------
/dev/nvme0n1     foo                  QEMU NVMe Ctrl                           1         536.87  MB / 536.87  MB    512   B +  0 B   1.0
/dev/nvme1n1     b92326b9b2323bf0     Linux                                    1         134.22  MB / 134.22  MB    512   B +  0 B   5.1.0-rc
/dev/nvme2n1     65fa04eddd9bbac0     Linux                                    1         134.22  MB / 134.22  MB    512   B +  0 B   5.1.0-rc

root@target:~/nvme-cli.git# nvme disconnect-all
Failed to open /sys/class/nvme/nvme0/delete_controller: No such file or directory

This patch checks the transport type of the controller in iteration.

Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoFix sprintf truncate
Keith Busch [Thu, 23 May 2019 21:04:56 +0000 (15:04 -0600)]
Fix sprintf truncate

Buffer was 16k, __builtin___snprintf_chk says it may require 18834. Up
to 20k. Note, we'd usually prefer dynamic buffers for such strings:
asprintf is your friend.

Link: https://github.com/linux-nvme/nvme-cli/issues/506
Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoSpin documentation
Keith Busch [Wed, 22 May 2019 22:42:55 +0000 (16:42 -0600)]
Spin documentation

New man pages provided for 3rd party plugin.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agodoc: fixup 3rd party man page
Keith Busch [Wed, 22 May 2019 22:42:16 +0000 (16:42 -0600)]
doc: fixup 3rd party man page

ensure it compiles with asciidoc

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoMerge pull request #504 from YoavCohen/master
Keith Busch [Wed, 22 May 2019 15:43:19 +0000 (09:43 -0600)]
Merge pull request #504 from YoavCohen/master

fix json print for list-subsys command

6 years agofix json print for list-subsys command
Yoav Cohen [Wed, 22 May 2019 15:34:17 +0000 (18:34 +0300)]
fix json print for list-subsys command

The bug was the instead of adding paths to to the subsystem object it
wass added as a new subsystem

6 years agoMerge pull request #503 from quyentruongvir/virtium-plugin-extensions
Keith Busch [Wed, 22 May 2019 14:11:27 +0000 (08:11 -0600)]
Merge pull request #503 from quyentruongvir/virtium-plugin-extensions

Add Virtium plugin extensions

6 years agoAdd Virtium plugin extension document
Quyen Truong [Wed, 22 May 2019 02:10:36 +0000 (09:10 +0700)]
Add Virtium plugin extension document

6 years agoAdd Virtium plugin extension
Quyen Truong [Tue, 21 May 2019 11:48:37 +0000 (18:48 +0700)]
Add Virtium plugin extension

6 years agonvme.h: Fix typos in status code values
Minwoo Im [Sun, 19 May 2019 18:39:10 +0000 (11:39 -0700)]
nvme.h: Fix typos in status code values

Fix typos in status code value.  linux/nvme.h in kernel project is going
to be fixed soon or later.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
Reviewed-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoMerge pull request #490 from minwooim/for-1.9/free-fd-in-err
Keith Busch [Mon, 20 May 2019 15:12:47 +0000 (09:12 -0600)]
Merge pull request #490 from minwooim/for-1.9/free-fd-in-err

nvme: Do not return directly without freeing fd

6 years agonvme-cli: remove unused NVME_AER_NOTICE_*
Akinobu Mita [Thu, 16 May 2019 16:41:29 +0000 (01:41 +0900)]
nvme-cli: remove unused NVME_AER_NOTICE_*

NVME_AER_NOTICE_* are unused and these values conflict with the values
defined in the kernel nvme.h.

Cc: Keith Busch <keith.busch@intel.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
6 years agonvme-cli: add kernel-doc comment for struct telemetry_log_page_hdr
Akinobu Mita [Thu, 16 May 2019 16:40:28 +0000 (01:40 +0900)]
nvme-cli: add kernel-doc comment for struct telemetry_log_page_hdr

This adds the kernel-doc data structure comment for struct
telemetry_log_page_hdr.

This also replaces spaces with tabs to align the structure fields.

Cc: Keith Busch <keith.busch@intel.com>
Cc: Chaitanya Kulkarni <Chaitanya.Kulkarni@wdc.com>
Cc: Bart Van Assche <bvanassche@acm.org>
Suggested-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
6 years agorespin documentation
Keith Busch [Thu, 16 May 2019 15:47:11 +0000 (09:47 -0600)]
respin documentation

For format man page updates.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoAdd a note to format on device naming conventions
Keith Busch [Thu, 16 May 2019 15:45:34 +0000 (09:45 -0600)]
Add a note to format on device naming conventions

Provide some help in the documentation on common user pitfalls.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoremove non-portable compile-time check
Keith Busch [Thu, 16 May 2019 15:19:42 +0000 (09:19 -0600)]
remove non-portable compile-time check

_Static_assert is a C11 feature, and we're only targeting to be
compatible from C99.

Link: https://github.com/linux-nvme/nvme-cli/issues/502
Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agonvme-cli: use uniform if .. else format
Chaitanya Kulkarni [Sun, 12 May 2019 18:58:20 +0000 (11:58 -0700)]
nvme-cli: use uniform if .. else format

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme-cli: use uniform if .. else format
Chaitanya Kulkarni [Sun, 12 May 2019 18:58:19 +0000 (11:58 -0700)]
nvme-cli: use uniform if .. else format

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme-cli: use uniform if .. else format
Chaitanya Kulkarni [Sun, 12 May 2019 18:58:18 +0000 (11:58 -0700)]
nvme-cli: use uniform if .. else format

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme-cli: remove trailing space
Chaitanya Kulkarni [Sun, 12 May 2019 18:58:17 +0000 (11:58 -0700)]
nvme-cli: remove trailing space

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme-cli: code cleanup adjust if statement
Chaitanya Kulkarni [Sun, 12 May 2019 18:58:16 +0000 (11:58 -0700)]
nvme-cli: code cleanup adjust if statement

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agonvme-cli: cmbloc code cleanup
Chaitanya Kulkarni [Sun, 12 May 2019 18:58:15 +0000 (11:58 -0700)]
nvme-cli: cmbloc code cleanup

This patch removes the unnecessary else condition which is out of
format anyway.

Signed-off-by: Chaitanya Kulkarni <chaitanya.kulkarni@wdc.com>
6 years agoMerge pull request #498 from kheitke/revert-oncs-change
Keith Busch [Fri, 10 May 2019 22:46:42 +0000 (16:46 -0600)]
Merge pull request #498 from kheitke/revert-oncs-change

nvme-print: remove Virtual Management support from ONCS

6 years agonvme-print: remove Virtual Management support from ONCS
Kenneth Heitke [Fri, 10 May 2019 21:55:57 +0000 (15:55 -0600)]
nvme-print: remove Virtual Management support from ONCS

Revert commit 096fd4d which mistakenly reported Virtual Management
support in the ONCS field of the Identify Controller data structure.
Virtual Management support is part of OACS instead of ONCS and was
already correctly being displayed.

Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
6 years agoMerge pull request #494 from minwooim/for-1.9/fit-print-property-size
Keith Busch [Thu, 9 May 2019 20:03:24 +0000 (14:03 -0600)]
Merge pull request #494 from minwooim/for-1.9/fit-print-property-size

For 1.9/fit print property size

6 years agonvme-cli: cleanup comments for telemetry log structure
Akinobu Mita [Thu, 9 May 2019 15:43:17 +0000 (00:43 +0900)]
nvme-cli: cleanup comments for telemetry log structure

This removes three comments for struct nvme_telemetry_log_page_hdr.

- The comment on top of the definision doesn't describe more than the
  struct name itself.

- The rsvd1 field has already been verified.

- The structures with trailing zero size array are commonly used in
  nvme-cli, so we don't need special comment for telemetry_dataarea[0].

Cc: Keith Busch <keith.busch@intel.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Cc: Kenneth Heitke <kenneth.heitke@intel.com>
Suggested-by: Kenneth Heitke <kenneth.heitke@intel.com>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
6 years agoMerge pull request #497 from kheitke/master
Keith Busch [Wed, 8 May 2019 17:38:46 +0000 (11:38 -0600)]
Merge pull request #497 from kheitke/master

nvme-print: update self-test log to include 'aborted due to sanitize'

6 years agonvme-print: update self-test log to include 'aborted due to sanitize'
Kenneth Heitke [Wed, 8 May 2019 17:13:29 +0000 (11:13 -0600)]
nvme-print: update self-test log to include 'aborted due to sanitize'

TP 4022 states that when a sanitize operation is started, self-test
operations in progress shall be aborted. The device-self test log page
includes a new result code that indicates if a self-test was aborted due
to a sanitize operation.

Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
6 years agoMerge pull request #496 from DimStar77/master
Keith Busch [Wed, 8 May 2019 16:51:11 +0000 (10:51 -0600)]
Merge pull request #496 from DimStar77/master

DOC: Move to DocBook 5 when using asciidoctor

6 years agoDOC: Move to DocBook 5 when using asciidoctor
Dominique Leuenberger [Wed, 8 May 2019 16:48:02 +0000 (18:48 +0200)]
DOC: Move to DocBook 5 when using asciidoctor

DocBook 5 has been released about a decade ago. Newer versions of
asciidoctor (since version 2.x) no longer support the previously
used DocBook 4.x format, so it is about time for us to switch too.

Fixes #495

6 years agonvme-cli: add missing endianness conversions for telemetry log page
Akinobu Mita [Sun, 5 May 2019 17:55:27 +0000 (10:55 -0700)]
nvme-cli: add missing endianness conversions for telemetry log page

Add missing endianness conversions for data area last block fields of
telemetry log page.

Cc: Keith Busch <keith.busch@intel.com>
Cc: Jens Axboe <axboe@fb.com>
Cc: Christoph Hellwig <hch@lst.de>
Cc: Sagi Grimberg <sagi@grimberg.me>
Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com>
6 years agoproperty: Fit print size for a property
Minwoo Im [Sun, 5 May 2019 11:58:59 +0000 (20:58 +0900)]
property: Fit print size for a property

We may or may not be able to see the following output in nvme-loop env.
  # nvme get-property /dev/nvme0 -o 0x14
  property: 0x14 (Controller Configuration), value: 7f7800460001
The register CC is not in 64bit, but the upper bits are showing some values
even it's reserved in spec.

This patch makes this print size to fit to its own size of register.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agoproperty: Remove unnecessary wrapper function
Minwoo Im [Sun, 5 May 2019 11:52:40 +0000 (20:52 +0900)]
property: Remove unnecessary wrapper function

nvme_get_property_helper() used to be an actual function who is getting the
value of the given property with offset.  But, Now we don't have any 'advance'
argument to get back to the caller so that we can remove the helper function by
making it nvme_get_property() which is more intuitive.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agoproperty: Introduce inline function to check 64bit reg
Minwoo Im [Sun, 5 May 2019 11:46:39 +0000 (20:46 +0900)]
property: Introduce inline function to check 64bit reg

This patch removes 'advance' argument used in get_property_helper() to tell
the register of the given offset is whether 64bit or not, instead introduce a
inline function to check it simply.

This kind of check might be needed at the print module to figure out if given
register should be printed out in 32bit format or 64bit format.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agoAdd Disable IO flag to wdc_dump_dui_data function
Jeffrey Lien [Tue, 30 Apr 2019 18:48:32 +0000 (18:48 +0000)]
Add Disable IO flag to wdc_dump_dui_data function

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
6 years agolist-ctrl: Do not return directly without freeing fd
Minwoo Im [Thu, 25 Apr 2019 14:21:45 +0000 (23:21 +0900)]
list-ctrl: Do not return directly without freeing fd

It was returning an error value without freeding open fd for the device.
This patch replaces 'return' with 'goto' to free fd.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agocreate-ns: Do not return directly without freeing fd
Minwoo Im [Thu, 25 Apr 2019 14:20:29 +0000 (23:20 +0900)]
create-ns: Do not return directly without freeing fd

It was returning an error value without freeding open fd for the device.
This patch replaces 'return' with 'goto' to free fd.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoformat: Do not return directly without freeing fd
Minwoo Im [Thu, 25 Apr 2019 14:15:56 +0000 (23:15 +0900)]
format: Do not return directly without freeing fd

It was returning an error value without freeding open fd for the device.
This patch replaces 'return' with 'goto' to free fd.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoMerge pull request #488 from minwooim/for-1.9/djust-uniformity-of-code
Keith Busch [Fri, 26 Apr 2019 13:45:07 +0000 (07:45 -0600)]
Merge pull request #488 from minwooim/for-1.9/djust-uniformity-of-code

nvme-print: Few code clean-ups here

6 years agoReorder primary commands
Keith Busch [Thu, 25 Apr 2019 20:16:02 +0000 (14:16 -0600)]
Reorder primary commands

Group the identify commands together.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoMerge pull request #491 from kheitke/secondary-controller-list
Keith Busch [Thu, 25 Apr 2019 20:20:37 +0000 (14:20 -0600)]
Merge pull request #491 from kheitke/secondary-controller-list

nvme-cli: add identify secondary controller list

6 years agonvme-cli: add identify secondary controller list
Kenneth Heitke [Wed, 24 Apr 2019 23:32:20 +0000 (17:32 -0600)]
nvme-cli: add identify secondary controller list

Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
6 years agospec, make: Add discovery.conf to the package files list
Sagi Grimberg [Wed, 24 Apr 2019 21:49:42 +0000 (14:49 -0700)]
spec, make: Add discovery.conf to the package files list

Lets add it as part of the package with a little documentation.

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
6 years agospec, Makefile: add /etc/nvme files to package files
Sagi Grimberg [Wed, 24 Apr 2019 21:49:41 +0000 (14:49 -0700)]
spec, Makefile: add /etc/nvme files to package files

This way it can automatically be removed upon uninstallation
and we don't need %preun target. Also, this will also allow
to get these files on manual installation from sources.

Also, don't settle on the "file exists" check, use the '-s'
to check that it is not empty as well.

Lastly, in order to have hostnqn and hostid updated upon pkg
install, we have install-spec target that would omit hostnqn and
hostid files, and let the rpm %post do it (otherwise we
use the normal install target).

Reviewed-by: Minwoo Im <minwoo.im.dev@gmail.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
6 years agosanitize: Print nvme status in case ret > 0
Minwoo Im [Thu, 25 Apr 2019 13:57:44 +0000 (22:57 +0900)]
sanitize: Print nvme status in case ret > 0

If given 'err' is negative, then it's an internal error so that it needs
to be with perror().  If it's positive, then we can print nvme status
out.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoget-telemtry-log: Print nvme status in case err > 0
Minwoo Im [Thu, 25 Apr 2019 13:53:01 +0000 (22:53 +0900)]
get-telemtry-log: Print nvme status in case err > 0

If given 'err' is negative, then it's an internal error so that it needs
to be with perror().  If it's positive, then we can print nvme status
out.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoprint: Add const to return type of string
Minwoo Im [Thu, 25 Apr 2019 13:27:26 +0000 (22:27 +0900)]
print: Add const to return type of string

All those strings are supposed to be const.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoprint: Introduce show_nvme_status to print nvme status
Minwoo Im [Thu, 25 Apr 2019 12:40:14 +0000 (21:40 +0900)]
print: Introduce show_nvme_status to print nvme status

We have so many subcommands so that we need to have a function in
common to print out status of nvme command.

The nvme status will be printed out in case the subcommand itself fails
due to a reason.  In case of command which is in the middle of the
subcommand, it will be printed as "<cmd> failed" before status.

This patch has nothing to do with functional change.

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>
6 years agoMerge pull request #485 from kheitke/master
Keith Busch [Wed, 24 Apr 2019 21:29:11 +0000 (15:29 -0600)]
Merge pull request #485 from kheitke/master

nvme: fix minor type in id-ctrl human readable output

6 years agonvme: fix minor type in id-ctrl human readable output
Kenneth Heitke [Wed, 24 Apr 2019 21:22:21 +0000 (15:22 -0600)]
nvme: fix minor type in id-ctrl human readable output

Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
6 years agoMerge pull request #483 from minwooim/for-1.9/fix-double-free-in-a-loop
Keith Busch [Wed, 24 Apr 2019 13:47:53 +0000 (07:47 -0600)]
Merge pull request #483 from minwooim/for-1.9/fix-double-free-in-a-loop

For 1.9/fix double free in a loop

6 years agoioctl: Fix wrong return case of get_property
Minwoo Im [Wed, 24 Apr 2019 00:48:58 +0000 (01:48 +0100)]
ioctl: Fix wrong return case of get_property

If get_property_helper() succeeds in the first time, and then fails in
the next time, then the ret value will not be updated to an error value.
This patch removes 'ret' variable to make 'err' to return being updated
everytime get_property_helper() invoked.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agoioctl: Fix double-free in a loop of get_property
Minwoo Im [Wed, 24 Apr 2019 00:46:29 +0000 (01:46 +0100)]
ioctl: Fix double-free in a loop of get_property

As it was reported, *pbar could be double-freed in case
get_property_helper() fails in the middle of the loop.

This issue was reported by Ken Heitke on:
  https://github.com/linux-nvme/nvme-cli/pull/471

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agonvme-cli: Increase size of ONTAP namespace path variable
Simon Schricker [Tue, 16 Apr 2019 13:27:40 +0000 (06:27 -0700)]
nvme-cli: Increase size of ONTAP namespace path variable

nspath's size is ONTAP_NS_PATHLEN and is written to by:

snprintf(nspath, ONTAP_NS_PATHLEN, "%s%s%s%s", ontap_vol,
                        vol_name, "/", ns_name);

Required bytes:

- ontap_vol is a constant char pointer, set to "/vol/", so 5 bytes
- vol_name's size is ONTAP_LABEL_LEN, which is 260, deducting the
  null-byte for termination makes 259 required bytes
- "/" is 1 byte
- ns_name's size is also ONTAP_LABEL_LEN, which is 260, deducting
  the null-byte for termination makes 259 required bytes
- the final null-byte: 1

That makes in total 5 + 259 + 1 + 259 + 1 = 525 required bytes

Signed-off-by: Simon Schricker <sschricker@suse.de>
6 years agoMerge pull request #480 from amluto/master
Keith Busch [Mon, 15 Apr 2019 17:53:44 +0000 (11:53 -0600)]
Merge pull request #480 from amluto/master

Fix passing CFLAGS on the make command line.

6 years agoFix passing CFLAGS on the make command line.
Andy Lutomirski [Mon, 15 Apr 2019 17:48:05 +0000 (10:48 -0700)]
Fix passing CFLAGS on the make command line.

Commit 254bcd6b2343 ("Fix CFLAGS parameter") only fixed the problem
if the variable came from the environment, not if it came from the
command line.  Fix it using 'override'.  See the GNU Make manual,
section 6.7 ("Overriding variables") for details.

Signed-off-by: Andy Lutomirski <luto@kernel.org>
6 years agoRegen docs
Keith Busch [Mon, 15 Apr 2019 14:38:14 +0000 (08:38 -0600)]
Regen docs

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agonvme-cli: fix typo, removing the duplicate 'are'
Simon Schricker [Thu, 11 Apr 2019 09:23:16 +0000 (11:23 +0200)]
nvme-cli: fix typo, removing the duplicate 'are'

Signed-off-by: Simon Schricker <sschricker@suse.de>
6 years agoRevert "plugin: Return EINVAL instead of ENOTTY"
Keith Busch [Fri, 12 Apr 2019 20:48:29 +0000 (14:48 -0600)]
Revert "plugin: Return EINVAL instead of ENOTTY"

This reverts commit 048cd68c8f32c42b7098e1d21c06966f7fc6f099.

The wrong help information is being printed, so just doing a simple revert to
fix it.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoMerge pull request #479 from yaznahar/use_hex_prefix_in_idctrl_output
Keith Busch [Thu, 11 Apr 2019 14:39:39 +0000 (08:39 -0600)]
Merge pull request #479 from yaznahar/use_hex_prefix_in_idctrl_output

Always use 0x prefix for hexdecimal values of id-ctrl output

6 years agoUse 0x prefix for all hex values of id-ctrl output
Alexander Larin [Thu, 11 Apr 2019 14:11:50 +0000 (17:11 +0300)]
Use 0x prefix for all hex values of id-ctrl output

Sometimes human-readable id-ctrl output could be confusing, e.g.
$ nvme id-ctrl /dev/nvme0
NVME Identify Controller:
vid       : 0x144d
ssvid     : 0x144d
sn        : S3HDNX0K601842
mn        : SAMSUNG MZWLL1T6HEHP-00003
fr        : GPNA5B3Q
rab       : 8
ieee      : 002538
cmic      : 0x3
mdts      : 5
cntlid    : 21
...
Here cntlid value is hexdecimal and equals 33, but nothing shows that.
In the same time some other values have 0x prefix. Let's use the prefix
for all hexdecimal values of the output.

Signed-off-by: Alexander Larin <znahar@yandex-team.ru>
6 years agoMerge pull request #478 from minwooim/for-v1.9/return-einval-instead-of-enotty
Keith Busch [Thu, 11 Apr 2019 14:06:36 +0000 (08:06 -0600)]
Merge pull request #478 from minwooim/for-v1.9/return-einval-instead-of-enotty

plugin: Return EINVAL instead of ENOTTY

6 years agoplugin: Return EINVAL instead of ENOTTY
Minwoo Im [Thu, 11 Apr 2019 12:51:19 +0000 (21:51 +0900)]
plugin: Return EINVAL instead of ENOTTY

When a given string for a subcommand is not valid, we can return EINVAL which
means invalid arguments.  ENOTTY is used to indicate that an invalid IOCTL
number was specified.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agoFix Failure to read 0xCA Log Page on SN200 Device [NVMe-CLI] Fix Incorrect Data Forma...
Jeffrey Lien [Wed, 10 Apr 2019 15:15:21 +0000 (15:15 +0000)]
Fix Failure to read 0xCA Log Page on SN200 Device [NVMe-CLI] Fix Incorrect Data Formats with the 0xCA and 0xD0 Log Pages

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
6 years agoMerge pull request #477 from minwooim/for-v1.9/fix_fd_leak
Keith Busch [Wed, 10 Apr 2019 15:24:53 +0000 (09:24 -0600)]
Merge pull request #477 from minwooim/for-v1.9/fix_fd_leak

nvme: Fix file descriptor leak in telemtry-log

6 years agonvme: Close a fd leaked
Minwoo Im [Wed, 13 Mar 2019 05:08:38 +0000 (14:08 +0900)]
nvme: Close a fd leaked

"output" file descriptor has not been closed not only when this command
is successfully done, but error occurs in the middle of the procdure.

This patch put "output" open after memory preparation so that we can add
close_output label before free_mem.

Signed-off-by: Minwoo Im <minwoo.im@samsung.com>
6 years agoRelease for new stable fixes v1.8.1
Keith Busch [Tue, 9 Apr 2019 21:32:46 +0000 (15:32 -0600)]
Release for new stable fixes

There's been a few fixes since the last tag that are fairly critical for
some scenarios, so we're tagging a new one already. Since these are all
just fixes and no new features, we'll add an additional minor digit to
the revision.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agonvme-cli: Revert stop-on-failure with connect-all
James Smart [Tue, 9 Apr 2019 20:51:54 +0000 (13:51 -0700)]
nvme-cli: Revert stop-on-failure with connect-all

The patch that added special treatment for EALREADY connect failures
also changed the behavior on what happens if a discovery log contains
an entry that is not connectable by the system or host port. If it
encounters a log entry that can't be connected to, it will not attempt
to connect to any log entries beyond it. This can leave lots of devices
unconnected to.

Revert the stop-on-failure introduced by the previous patch.

Specifically, this failed for me on an FC array that had a discovery log
entry for a port that was not visible via zoning for the initiator
port being used.

Fixes: 1a922e0e121d7 ("connect-all: special treatment to EALREADY afetr write to /dev/nvme-fabrics"
Signed-off-by: James Smart <jsmart2021@gmail.com>
CC: Eyal Ben David <eyalbe@il.ibm.com>
CC: Martin George <Martin.George@netapp.com>
6 years agoFix NSID for command effects log
Keith Busch [Tue, 9 Apr 2019 15:21:19 +0000 (09:21 -0600)]
Fix NSID for command effects log

This should be the all NSID value.

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoMerge pull request #476 from kheitke/error-log-fix
Keith Busch [Tue, 9 Apr 2019 14:44:42 +0000 (08:44 -0600)]
Merge pull request #476 from kheitke/error-log-fix

Fix output size for error log raw binary dump

6 years agoFix output size for error log raw binary dump
Kenneth Heitke [Mon, 8 Apr 2019 23:04:54 +0000 (17:04 -0600)]
Fix output size for error log raw binary dump

Signed-off-by: Kenneth Heitke <kenneth.heitke@intel.com>
6 years agoRelease version 1.8 v1.8
Keith Busch [Mon, 8 Apr 2019 20:51:59 +0000 (14:51 -0600)]
Release version 1.8

There are some important fixes pending a release tag, so now seems as
good as any to tag the release.

Thank you again to everyone who's contribute to this round. Shortlog
below.

Breno Leitao (2):
      Fix compilation with GCC-8
      Fix CFLAGS parameter

Chaitanya Kulkarni (3):
      nvme-cli: fix compilation with uint64_t cast
      nvme-cli: minor cleanup for submit_io()
      nvme-cli: align all the macros

Dong Ho (11):
      wdc: Change device capability checking
      wdc: Add additional device for vs-internal-log
      wdc: Add device unit info log extraction
      wdc: Add get drive status command
      wdc: Add clear assert dump status command
      wdc: Add drive resize command
      wdc: Update device capabilities for clear pcie corr
      wdc: Update file parameter checking
      wdc: Add command to extract NAND statistics
      wdc: Add data area extraction for DUI command
      wdc: Additional device capabilities check

James Smart (1):
      nvme-cli: fix fc trtype string

Jeffrey Lien (3):
      NVMe-CLI WDC Plugin - add support for additional SN840 device ID.
      WDC plugin Change vs-internal-log Command to Save Partial E6 Log Data.
      WDC Plugins vs-internal-log command unsupported on SN340.

Keith Busch (8):
      generate new documentation
      Regen docs
      Fix print format specifiers
      Regen documentation
      Add new docs to repository
      Generate new documentation
      Fix format block size usage
      Regen documentation

Kenneth Heitke (4):
      Add reporting of Virtual Management support to id-ctrl
      Fix possible NULL pointer dereferences
      Fix possible memory leak on get-internal-log
      Print timestamp as a date and time string

Martin George (2):
      nvme-cli: add netapp ontapdevices command
      nvme-cli: add netapp ontapdevices man page

Mateusz Piotrowski (3):
      Fix markdown indentation issues
      Sort operating systems alphabetically
      Add FreeBSD installation instructions

Maxim (1):
      Adding a helper to format command to enable the user to specify desired block size and have nvme-cli determine the correct LBAF and add format helper to nvme-create-ns command

Minwoo Im (15):
      fabrics: Return negative errno when asprintf() fails
      fabrics: Return negative errno to check remove_ctrl() is failed
      doc: Update nvme-discover by describing options
      doc: Update nvme-connect by describing options
      doc: Update nvme-connect-all by describing options
      doc: Update nvme-disconnect by describing options
      doc: Add missing commands to main document entry
      nvme: Support raw_binary and json format for show-regs
      doc: Update show-regs document with output-format
      ioctl: Free memory if get_property for fabrics failed
      nvme: Use ARRAY_SIZE() macro in common.h
      nvme: Unify min(), max() macro as a common one
      nvme: Simplify description for virt-mgmt
      nvme: Simplify virt-mgmt options to lowercase
      tests: Update print to print() for python3

Roy Shterman (1):
      nvme-print: Fix evaluation of ctratt on pretty print

Sagi Grimberg (1):
      nvme: print I/O error to stderr

Signed-off-by: Keith Busch <keith.busch@intel.com>
6 years agoRegen documentation
Keith Busch [Mon, 8 Apr 2019 20:49:43 +0000 (14:49 -0600)]
Regen documentation

6 years agoMerge pull request #475 from minwooim/for-1.8/update_test_python_version_to_3
Keith Busch [Mon, 8 Apr 2019 15:57:13 +0000 (09:57 -0600)]
Merge pull request #475 from minwooim/for-1.8/update_test_python_version_to_3

tests: Update print to print() for python3

6 years agoMerge pull request #471 from minwooim/for-1.8/fix-mem-leak-from-show-regs
Keith Busch [Mon, 8 Apr 2019 15:56:17 +0000 (09:56 -0600)]
Merge pull request #471 from minwooim/for-1.8/fix-mem-leak-from-show-regs

ioctl: Free memory if get_property for fabrics failed

6 years agoMerge pull request #474 from minwooim/for-1.8/virt-mgmt-clean-up
Keith Busch [Mon, 8 Apr 2019 15:55:42 +0000 (09:55 -0600)]
Merge pull request #474 from minwooim/for-1.8/virt-mgmt-clean-up

[RFC] Simplify virt-mgmt subcommand options to lowercase

6 years agoMerge pull request #470 from minwooim/for-1.8/support_output_format_for_show_regs
Keith Busch [Mon, 8 Apr 2019 15:51:01 +0000 (09:51 -0600)]
Merge pull request #470 from minwooim/for-1.8/support_output_format_for_show_regs

nvme: Support raw_binary and json format for show-regs

6 years agoMerge pull request #472 from minwooim/for-1.8/remove_duplicated_array_len
Keith Busch [Mon, 8 Apr 2019 15:50:16 +0000 (09:50 -0600)]
Merge pull request #472 from minwooim/for-1.8/remove_duplicated_array_len

nvme: Clean-up duplicated macros

6 years agonvme-cli: add netapp ontapdevices man page
Martin George [Mon, 1 Apr 2019 16:39:57 +0000 (09:39 -0700)]
nvme-cli: add netapp ontapdevices man page

Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Steve Schremmer <sschremm@netapp.com>
6 years agonvme-cli: add netapp ontapdevices command
Martin George [Mon, 1 Apr 2019 16:39:56 +0000 (09:39 -0700)]
nvme-cli: add netapp ontapdevices command

Add a new ontapdevices command to the NetApp plugin for
NetApp ONTAP devices.

Signed-off-by: Martin George <marting@netapp.com>
Reviewed-by: Steve Schremmer <sschremm@netapp.com>
6 years agotests: Update print to print() for python3
Minwoo Im [Sun, 7 Apr 2019 11:24:55 +0000 (20:24 +0900)]
tests: Update print to print() for python3

The following issue has been reported that README in "tests" seems not
correct because it will not be able to be invoked in case python3
because print() has to be taken instead of print which had been used for
python2.

Issue !429:
  https://github.com/linux-nvme/nvme-cli/issues/429

Signed-off-by: Minwoo Im <minwoo.im.dev@gmail.com>