Keith Busch [Tue, 4 Jan 2022 17:02:55 +0000 (09:02 -0800)]
support a meatadata file redirection for passthru
The passthrough command provided a way to specific a metadata size, but
no way to save or set the data from a file. Provide an option so this is
allowed.
While we're here, it looks like the passthrough command only supported
file redirection for data-out commands. Go ahead and fix that with this
commit since the metadata needs to go both ways too.
Daniel Wagner [Mon, 20 Dec 2021 15:34:35 +0000 (16:34 +0100)]
nvme: Use libnvme helper to retrieve logical block size
Use the libnvme helper nvme_get_logical_block_size to figure out the
logical block size. This way we have support for normal char
devices (nvme%d) and for generic devices (ng%d%d).
Daniel Wagner [Tue, 28 Dec 2021 15:44:36 +0000 (16:44 +0100)]
nvme: Fix entry short help text for fid-support-effects-log
The function is to retrieve the log page information. Update the help
text accordingly and moved the entry up into the group of get_log_page
functions.
Daniel Wagner [Mon, 27 Dec 2021 14:52:50 +0000 (15:52 +0100)]
build: Set maximum warning level
Without defining the default warning level the build system
will use the default level, which is implementation depended.
For example muon sets it to 3 which includes '-Wpendantic'.
This results in a lot of ISO-C non compliant warnings.
Let's define the warning level so that all build systems
are using the same values.
Daniel Wagner [Fri, 7 Jan 2022 10:14:20 +0000 (11:14 +0100)]
build: Replacing make by meson.
This involves replacing all Makefiles by meson.build files.
Also the top-level configure script now simply invokes meson.
The top-level Makefile is just a wrapper for meson. It supports
the following operations:
make
make test
make install
make clean # Remove build artifacts but keep configuration
make purge # Remove build artifacts and configuration
/tmp/nvme-cli/nvmf-autoconnect/dracut-conf/70-nvmf-autoconnect.conf.in:1:19: error: key of zero length not supported
1 | install_items+=" @@UDEVRULESDIR@@/70-nvmf-autoconnect.rules "
^
/tmp/nvme-cli/meson.build:161:1: error: in function configure_file
161 | configure_file(
^
Since meson does not support custom token rules for configuring
replacements, and there is no real benefit to doubling the @@, just fix
this to use one @.
Daniel Wagner [Wed, 15 Dec 2021 09:32:37 +0000 (10:32 +0100)]
nvme: Consolidate --force option and udpate documetation
Refactor the error handling for the --force option.
Drop support for the -f and use --force consistent in all commands.
Also update the documation accordingly.
Daniel Wagner [Fri, 17 Dec 2021 15:45:10 +0000 (16:45 +0100)]
nvme-print: Add Controller Metadata and Namespace Metadata
Port and extent the libnvme part from the commit b8a403b ("Add NVMe MI
Features: Controller Metadata (0x7E) and Namespace Metadata (0x7F).")
from the nvme-cli monolithic branch.
Daniel Wagner [Wed, 15 Dec 2021 13:22:02 +0000 (14:22 +0100)]
build: Use compiler.find_library for libhugetlbfs
libhugetlbfs is not detected via dependency() because the library
neither provides a pkg-config() nor a cmake helper. Use
compiler.find_library to figure out if the library is available.
We do not use the has_header feature of compiler.find_library()
function as this would update our minimum version for meson to
0.50.0. Instead open code it by using compiler.has_header().
Daniel Wagner [Wed, 15 Dec 2021 12:18:06 +0000 (13:18 +0100)]
build: Add wrapdb support for OpenSSL
The meson wrapdb library has support for OpenSSL. Introduce a combo
option for full control if the user wants OpenSSL added to nvme-cli or
not. Only if the option is set to 'true' the fallback will be
considered when there is no system version of OpenSSL available.
Brandon Paupore [Tue, 14 Dec 2021 17:49:15 +0000 (11:49 -0600)]
Fix JSON report zones output
Previously multiple JSON objects would be in the output of
zns-report-zones if there were more than 1024 zones requested because of
the chunked requests sent by nvme-cli.
Fix this to output a single JSON object with one zone_list. This is done
by passing around and appending to the zone_list, then outputting all of
it once after receiving all the reports.
Wen Xiong [Wed, 1 Dec 2021 22:25:58 +0000 (17:25 -0500)]
nvme-cli: Decode "Supported Events Bitmap" in PEL header
"Supported Events Bitmap" in PEL header shows what events
are supported in current nvme devices.
Persistent Event Log for device: nvme0n1
Action for Persistent Event Log: 0
..
..
..
Supported Events Bitmap:
Support SMART/Health Log Snapshot Event(0x1)
Support Firmware Commit Event(0x2)
Support Timestamp Change Event(0x3)
Support Power-on or Reset Event(0x4)
Support NVM Subsystem Hardware Error Event(0x5)
Support Change Namespace Event(0x6)
Support Format NVM Start Event(0x7)
Support Format NVM Completion Event(0x8)
Support Sanitize Start Event(0x9)
Support Sanitize Completion Event(0xa)
Support Set Feature Event(0xb)
Support Set Telemetry CRT Event(0xc)
Support Thermal Excursion Event(0xd)
Steven Seungcheol Lee [Fri, 10 Dec 2021 11:39:40 +0000 (20:39 +0900)]
zns: Add printing Zone Capacity Changed from zone reset
if the Variable Zone Capacity bit is set to ‘1’ in the Zone Operation
Characteristics field in the Zoned Namespace Command Set specific
Identify Namespace data structure, then the zone capacity may change
upon successful completion of a Zone Management Send command
specifying the Zone Send Action of Reset Zone
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Steven Seungcheol Lee [Mon, 22 Nov 2021 10:27:08 +0000 (19:27 +0900)]
Add version check for OpenSSL(1.1.0) required
HMAC_CTX_new(), HMAC_CTX_free() are new in OpenSSL 1.1.0.
nvme.c: In function ‘gen_dhchap_key’:
nvme.c:6792:24: error: implicit declaration of function ‘HMAC_CTX_new’; did you mean ‘HMAC_CTX_init’? [-Werror=implicit-function-declaration]
6792 | HMAC_CTX *hmac_ctx = HMAC_CTX_new();
| ^~~~~~~~~~~~
| HMAC_CTX_init
nvme.c:6792:24: error: initialization of ‘HMAC_CTX *’ {aka ‘struct hmac_ctx_st *’} from ‘int’ makes pointer from integer without a cast [-Werror=int-conversion]
nvme.c:6805:3: error: implicit declaration of function ‘HMAC_CTX_free’; did you mean ‘HMAC_CTX_copy’? [-Werror=implicit-function-declaration]
6805 | HMAC_CTX_free(hmac_ctx);
| ^~~~~~~~~~~~~
| HMAC_CTX_copy
cc1: all warnings being treated as errors
make: *** [Makefile:155: nvme.o] Error 1
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Steven Seungcheol Lee [Mon, 22 Nov 2021 08:34:58 +0000 (17:34 +0900)]
nvme: fix fatal error for sys/random.h
fatal error: sys/random.h: No such file or directory
sys/random.h supported from glibc version 2.25
so add header file existence check
if there is no sys/random.h, try to read /dev/urandom or /dev/random
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
[dwagner: cache errno value, close will overwrite it] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Steven Seungcheol Lee [Thu, 9 Dec 2021 11:34:24 +0000 (20:34 +0900)]
util/json: fix build error of json_object_add_value_uint64 #1260
util/json used when system does not have json-c library
json_object_add_value_uint handled with unsigned long long (64bits)
That's why json_object_add_value_uint64 is redefined with it
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Daniel Wagner [Thu, 9 Dec 2021 12:48:30 +0000 (13:48 +0100)]
plugins: Force types for isalnum and isblank
The two users of isalnum and isblank hand in unsigned char and not
int as expected by the API. This triggers thye type checker in the
debug build, e.g.
../subprojects/libnvme/ccan/ccan/build_assert/build_assert.h:38:22: error: size of unnamed array is negative
38 | (sizeof(char [1 - 2*!(cond)]) - 1)
| ^
../ccan/ccan/str/str.h:189:16: note: in expansion of macro ‘BUILD_ASSERT_OR_ZERO’
189 | ((i) + BUILD_ASSERT_OR_ZERO(!__builtin_types_compatible_p(typeof(i), \
| ^~~~~~~~~~~~~~~~~~~~
../ccan/ccan/str/str.h:196:32: note: in expansion of macro ‘str_check_arg_’
196 | #define isalnum(i) str_isalnum(str_check_arg_(i))
| ^~~~~~~~~~~~~~
../plugins/memblaze/memblaze-nvme.c:410:13: note: in expansion of macro ‘isalnum’
410 | if (isalnum(*c) == 0) {
| ^~~~~~~
Brandon Paupore [Thu, 2 Dec 2021 21:40:39 +0000 (15:40 -0600)]
Use unique names for VULs, also return 0 on success
Previously nvme_log_id_to_string returned "WDC Vendor Unique Log ID" if
it was any vendor unique log ID. This causes problems when requesting
JSON output, as only the final vendor unique log ID would be shown.
Instead, append the log id to the string making each unique.
Also, wdc_log_page_directory previously returned whatever the
output_format was. Instead return 0 if the format was valid.