]> www.infradead.org Git - users/sagi/nvme-cli.git/commit
nvme/id-ns: do not try to get namespace id from non-block device.
authorXiao Liang <xiliang@redhat.com>
Wed, 1 Nov 2017 14:49:32 +0000 (22:49 +0800)
committerXiao Liang <xiliang@redhat.com>
Wed, 1 Nov 2017 15:21:10 +0000 (23:21 +0800)
commit9f3aaa2702990fab7fcd05ab885ab6c265c8dd5b
tree5bbd5fff3ba2934c333b3a8a700c6d663c929830
parent4324c9b80b55f62005759d83ed20334ef9b6ee39
nvme/id-ns: do not try to get namespace id from non-block device.

namespace id's default value is 0 and changed to 15 by get_nsid()
when device is not a block device.

With this change:
# ./nvme id-ns /dev/nvme0 -n 0
Error: requesting namespace-id from non-block device
NVMe Status:INVALID_NS(b) NSID:0
                               ^^
Without this change:
Missleading output when user passed 0 or 15 as namespace id.
# nvme id-ns /dev/nvme0
Error: requesting namespace-id from non-block device
NVMe Status:INVALID_NS(b) NSID:15
                               ^^
# nvme id-ns /dev/nvme0 -n 0
Error: requesting namespace-id from non-block device
NVMe Status:INVALID_NS(b) NSID:15
                               ^^
# nvme id-ns /dev/nvme0 -n 15
NVMe Status:INVALID_NS(b) NSID:15

Signed-off-by: Xiao Liang <xiliang@redhat.com>
nvme.c