Walter Doekes [Wed, 16 Dec 2015 14:08:11 +0000 (15:08 +0100)]
Don't cast pointers, cast values.
The compiler rightly warned about an issue in ed3848130, but the fix was
wrong.
There is no guarantee that an int is exactly 32 bits and no guarantee
that a long long is exactly 64 bits. The former one is guaranteed to be
at least 16 bits (but we can safely assume 32 for non-ancient machines).
Imagine an u32 array:
0... 1... 2... 3... 4... 5...
Now cast the pointer to the zeroth element to a 64-bits-int-pointer;
64bit sized int are quite common.
0....... 1....... 2.......
Writing to 0, 1 and 2 would put values in 0, 2 and 4 (on little endian).
And if there is enough data, it would overwrite the stack.
This change moves the casting to the point where the individual values
are copied. That's safe.
Stephen Bates [Tue, 15 Dec 2015 16:19:35 +0000 (09:19 -0700)]
Added ubuntu PPA make target.
As we move toward deploying nvme-cli (aka nvme-utils) via the ubuntu
distro we need a make target that builds the correct sources for a
PPA. For now this is a presonal PPA and can be tracked at:
https://launchpad.net/~sbates/+archive/ubuntu/ppa
Here we refactor the changelog creation and add a new make target
(deb-ppa).
Wen Xiong [Mon, 14 Dec 2015 19:12:53 +0000 (13:12 -0600)]
Subject: compilation issue on ppc.
We saw the following compilation issue on ppc.
[root@everest-lp2 nvme-cli]# make
cc -I ./src -D_GNU_SOURCE -std=gnu99 -O2 -g -Wall -Werror
-DNVME_VERSION='"0.2.15.gc4c2"' nvme.c -o nvme argconfig. o
suffix.o common.o
nvme.c: In function âmânvme.c:2227:2: error: passing argument 2 of
âgconfig_parse_comma_sep_array_longârom incompatible pointer type [-
Werror]
ns = argconfig_parse_comma_sep_array_long(cfg.slbas, slbas, 256);
^
In file included from nvme.c:52:0:
src/argconfig.h:106:10: note: expected âng long unsigned int *âut
argument is of type âu64 *âunsigned
argconfig_parse_comma_sep_array_long(char *string, unsigned long long
*ret,
^
cc1: all warnings being treated as errors
make: *** [nvme] Error 1
keithbusch [Tue, 8 Dec 2015 23:01:52 +0000 (16:01 -0700)]
Merge pull request #41 from samiWaheed/master
Added decoding of temp sensors to the SMART log page (02h)
Thanks for the fix. I did not catch that a previous commit did lot more than just _move_ the printing functions to a common library, creating this regression.
Sami Waheed [Tue, 8 Dec 2015 22:51:24 +0000 (14:51 -0800)]
Added decoding of temp sensors to the SMART log page (02h)
- Display temperature sensors data using smart-log command
- Removed code that truncated the last byte of fr, mn, sn in id-ctrl.
Matched string format with list command
Walter Doekes [Fri, 4 Dec 2015 13:41:39 +0000 (14:41 +0100)]
Improve debian package build process.
* The changes from 3686759 make the debian/rules a lot simpler.
* Fix so ld doesn't leave a.out turds.
* Add dist-orig make target that creates a reproducible orig.tar.gz.
A reproducible source archive is a first step towards reproducible
builds.
* Fix typo in debian package description.
* Add dist and pkg to the PHONY targets.
Patrick McCormick [Thu, 3 Dec 2015 17:56:22 +0000 (12:56 -0500)]
Makefile cleanup.
Don't link with unused libs: -lm, -lpthread
Don't hardcode in 64 bit compile, this will break cross compilation
Put preprocessor flags in CPPFLAGS
Add to existing variables instead of var = $var pattern
Signed-off-by: Patrick McCormick <patrick.m.mccormick@intel.com>
Modified the license of the code pulled from libargconfig to be GPLv2
There have been legal concerns of linking Apache licensed code with
GPLv2 code. This change modifies the license of the code originating
from libargconfig. All of the copyright holders (including myself and
PMC Sierra represented by Stephen Bates <Stephen.Bates@pmcs.com>) have
signed off on this change.
Sami Waheed [Tue, 15 Sep 2015 22:29:04 +0000 (15:29 -0700)]
Changed default NSID in get-feature function. Fixed format of LBA range output
- Changed default NSID to 1 in get-feature function. Some features
require a valid NSID (i.e. lba range type)
- Fixed format of LBA range output
- Added description to the attributes field in LBA range output
- Changed default NSID to 0xffffffff in get_log (Matches help
documentation now)
Keith Busch [Fri, 28 Aug 2015 14:42:00 +0000 (08:42 -0600)]
Use device maximum for error log entries
It's been reported that some controllers return error if more logs were
requested than the device's max. This patch overrides the user's request,
or the default if the option was not given, with the device's max if
the setting exceeds it.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Paul Grabinar [Mon, 10 Aug 2015 12:28:03 +0000 (13:28 +0100)]
Allow for firmware activation that needs a reset
On a firmware activate, some drives require a reset before the new
firmware can be used. Such drives return a status 0x10b to the activate
request.
Rather than treat this as an error, tell this user the activation was
successful, but a reset is required.
kaoudis [Wed, 5 Aug 2015 16:39:14 +0000 (10:39 -0600)]
add help strings and submenus
Add relevant help to nvme commands and command options.
Don't seg fault when trying to print help strings.
Don't declare "-h" an unrecognized option; print help menu instead.
Keith Busch [Tue, 9 Jun 2015 15:35:24 +0000 (09:35 -0600)]
Makefile: install documentation without building
Fixes dependency timestamp problems on cloning that 'make' rules
require it rebuild manpages even though this is not needed. We don't
want an 'asciidoc' dependency to build and install the program unless
you explicitly want to build the documentation, so changing the make
target's dependencies to not rebuild it.
Signed-off-by: Keith Busch <keith.busch@intel.com>
Keith Busch [Wed, 3 Jun 2015 21:45:35 +0000 (15:45 -0600)]
Printf platform fixes
Changing the 64-bit printf formats to use an appropriate inttype macro
for the given architecture, and converting for appropriate endianess for
"__le64" types.
Signed-off-by: Keith Busch <keith.busch@intel.com>
stevegalbraith [Wed, 27 May 2015 16:36:38 +0000 (09:36 -0700)]
Fix to determine initial value for lba in print_list_item
The index used to determine lba value takes into accout the entire FLBAS field. Bit 4 determines whether an extended or separate is used to send metadata and if set to 1'b,
throws off the index value. Masked out the top 4 bits to only take into account Bits 3:0 which indicate the LBA format type used.
Jon Derrick [Tue, 12 May 2015 16:09:04 +0000 (10:09 -0600)]
Added a human-readable format option to id-ctrl and id-ns. This will
partially decode several relevant bitfields in the ID Controller and
Namespace commands. Reserved fields are displayed if not 0.
Signed-off-by: Jon Derrick <jonathan.derrick@intel.com>