Mike Frysinger [Fri, 16 Dec 2016 17:08:02 +0000 (12:08 -0500)]
Documentation: allow parent PREFIX to override
The current Documentation/Makefile always sets PREFIX to /usr/local.
If the parent Makefile sets it to something else, then it still gets
clobbered. Change the Makefile to look like the parent and allow the
cascading logic to work.
Mike Frysinger [Fri, 16 Dec 2016 00:10:28 +0000 (19:10 -0500)]
change default CFLAGS settings into the default
The way compiler settings are appended to CFLAGS breaks custom flags
that people are using to build. So if someone does:
$ export CFLAGS='-O0 -ggdb'
$ make
The build will force -O2 instead.
Shift these defaults into a default setting rather than always appending.
Aaron Miller [Fri, 9 Dec 2016 23:38:35 +0000 (15:38 -0800)]
Fix right trim() in JSON output
Was always trimming from the end of the format buffer, not the end of
the snprintf output. Also need to remove the initial decrement as
snprintf will leave fmt_sz pointing at the terminating NUL.
Aaron Miller [Tue, 6 Dec 2016 21:50:21 +0000 (13:50 -0800)]
Output JSON device list in an array
When printing as an object with product name as key, multiple cards with
the same product name can be present as the same key, and most JSON
parsers will only see one.
Keith Busch [Tue, 6 Dec 2016 22:36:32 +0000 (15:36 -0700)]
Fix segfault listing models
The models strings may not exist in the place this program thinks it
does. Check if the file is valid before reading from it, and return an
apporpriate string accordingly.
https://github.com/linux-nvme/nvme-cli/issues/140
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Mon, 10 Oct 2016 23:11:19 +0000 (17:11 -0600)]
Make program have single exit location
All errors are returned rather than exiting the program. This requires
more return code error checking, but it makes it predictable where the
program may end and required if we ever implement an interactive mode.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Sagi Grimberg [Thu, 17 Nov 2016 15:35:13 +0000 (10:35 -0500)]
Fix Debian rules
Usually when building a package we don't want to run tests
that require nvme devices. So until we can classify to tests
that have requirements to not run unless some env variables
are set we need this rule.
Keith Busch [Tue, 15 Nov 2016 23:15:25 +0000 (18:15 -0500)]
Release version 1.0
Been long enough, and lots of updates accumlated. Thank you to everyone
who contributed this round!
Just some highlights in this release:
* Bug fixes on some of the lesser used parameters and commands
* Support for fabrics discover and connect to targets
* More 3rd party extensions have been added
* New JSON output formats on some of the show routines
* Documenation updates and fixes
* Compiler warnings for some configurations
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Fri, 11 Nov 2016 15:24:23 +0000 (10:24 -0500)]
get-feature updates
This fixes some of the printing options. We don't want to print text if
the request is to display the buffer in raw binary, and we don't want
to do a binary output if there is no buffer to write.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Gwendal Grignou [Thu, 13 Oct 2016 21:25:33 +0000 (14:25 -0700)]
Fix compilation errors:
While compiling nvme-cli for ChromeOS, the compiler founds minor issues
in the code:
- unsigned and sizet_t can never be negative.
- use fabs instead of llabs when argument is a double.
Christoph Hellwig [Wed, 12 Oct 2016 08:45:51 +0000 (10:45 +0200)]
fine tune the nvme-discover manpage
- remove the device argument, which as far as I can tell does not
exist.
- mention the /etc/nvme/hostnqn file, the default host nqn and explain
host nqns a bit more
- mention the loopback transport
- be a bit more specific about IP addressing as a concept separate from
the RDMA transport
- improve the introduction a bit.
Jay Freyensee [Fri, 7 Oct 2016 19:09:20 +0000 (12:09 -0700)]
nvme-cli: tweak discover man pages w/argconfig fix
With Sagi's fix to argconfig.c, the nvme-discover man
pages need to be tweaked to show the true intent of
using discovery.conf, a default with multiple discover
command-lines.
Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Jay Freyensee [Fri, 7 Oct 2016 18:46:16 +0000 (11:46 -0700)]
nvme-cli: have cfg var get set more than 1 execution
Without this fix, the struct config cfg variable only
gets set one time when argconfig_parse() is called. Any other
time it is attempted to be set, it acts as a read-only value
and continues to use the initial value it was set with.
This poses a problem for the discovery feature, discovery.conf file
as it is desired to make the file multiple line instead of a single
line, such as:
-t rdma -a 192.168.69.33 -s 4420 -q host2-proper-nqn
-t rdma -a 192.168.1.4 -s 4420 -q host2-proper-nqn
-t rdma -a 192.168.69.33 -s 99 -q host2-proper-nqn
I've tried the fix with a few existing commands and nothing
appears to be broken, but I haven't done an exhaustive test.
Reported-by: Jay Freyensee <james_p_freyensee@linux.intel.com> Originally-by: Sagi Grimberg <sagi@lightbits.io> Tested-by: Jay Freyensee <james_p_freyensee@linux.intel.com>
Modified: print the subnqn (NVM Subsystem NVMe Qualified Name) field for both normal and jason formats upon the id_ctrl() command. Also, sn, mn, and fr fields are printed as the jason format.
Jay Freyensee [Fri, 23 Sep 2016 16:49:50 +0000 (09:49 -0700)]
nvme-cli: change 'r' to 'c' for connect flag
To make things a tad easier for human usage understanding,
refine the single letter short option of 'r' to 'c' for the
'connect' command as 'r' is already used by 'discover'.
Signed-off-by: Jay Freyensee <james_p_freyensee@linux.intel.com> Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
Keith Busch [Thu, 22 Sep 2016 16:11:25 +0000 (12:11 -0400)]
nvme-format: Add optional reset parameter
Reset after format shouldn't be necessary, but some controllers require
it. This patch adds a parameter a user can set to trigger an automatic
controller reset after a successful format.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Scott Bauer [Thu, 22 Sep 2016 15:50:54 +0000 (09:50 -0600)]
Fix stack-based overflow in id-ctrl json output.
Fixes:
==15224==ERROR: AddressSanitizer: stack-buffer-overflow on address 0x7fffffffcf55 at pc 0x7ffff6ecb9f5 bp 0x7fffffffcd80 sp 0x7fffffffc510
WRITE of size 22 at 0x7fffffffcf55 thread T0
#0 0x7ffff6ecb9f4 in __interceptor_vsprintf (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x619f4)
#1 0x7ffff6ecbcc9 in __interceptor_sprintf (/usr/lib/x86_64-linux-gnu/libasan.so.2+0x61cc9)
#2 0x420357 in json_nvme_id_ctrl /home/sbauer/nvme_code/nvme-cli/nvme-print.c:1266
#3 0x4072f1 in __id_ctrl /home/sbauer/nvme_code/nvme-cli/nvme.c:935
#4 0x40742f in id_ctrl /home/sbauer/nvme_code/nvme-cli/nvme.c:950
#5 0x42fa63 in handle_plugin /home/sbauer/nvme_code/nvme-cli/plugin.c:140
#6 0x410c46 in main /home/sbauer/nvme_code/nvme-cli/nvme.c:2729
#7 0x7ffff6ac182f in __libc_start_main (/lib/x86_64-linux-gnu/libc.so.6+0x2082f)
#8 0x402268 in _start (/home/sbauer/nvme_code/nvme-cli/nvme+0x402268)
Address 0x7fffffffcf55 is located in stack of thread T0 at offset 117 in frame
#0 0x42011f in json_nvme_id_ctrl /home/sbauer/nvme_code/nvme-cli/nvme-print.c:1254
This frame has 3 object(s):
[32, 41) 'fr'
[96, 117) 'sn' <== Memory access at offset 117 overflows this variable
[160, 201) 'mn'
Signed-off-by: Scott Bauer <scott.bauer@intel.com>
Scott Bauer [Mon, 19 Sep 2016 15:47:15 +0000 (09:47 -0600)]
json: Print to stderr and abort() instead of returning NULL and faulting.
No one who uses the JSON API is checking for return values.
Instead of littering the json code with if-else chains,
we will error on any memory allocation failure. Even though
incredibly unlikely malloc will return NULL it's easier to
check for it and print an error instead of faulting.
Signed-off-by: Scott Bauer <scott.bauer@intel.com>