Andrew Maier [Thu, 3 Feb 2022 18:55:56 +0000 (11:55 -0700)]
README: Update the ubuntu install instructions
nvme-cli is now a supported package in the Ubuntu universe (from Xenial
and above). Therefore, we can remove the reference to the sbates ppa.
This patch also updates the wording around the supported packages and
architectures.
Daniel Wagner [Mon, 31 Jan 2022 13:34:33 +0000 (14:34 +0100)]
nvme: Adapt to logging changes in libnvme
libnvme allows to define which file descriptor should be used for
logging. This is only for the fabric related interface relevant hence
this is attached to the nvme_root_r object.
Use common code for this into a helper which maps the verbose command
line levels to the correct log levels.
Daniel Wagner [Fri, 28 Jan 2022 17:58:45 +0000 (18:58 +0100)]
tree: Do not map status to errno codes
The caller of the commands is not interersted in any mapping
of status codes to error codes. It only wants to know success(0) or
failure (!=0). Remove all nvme_status_to_errno() calls.
Daniel Wagner [Fri, 28 Jan 2022 13:35:50 +0000 (14:35 +0100)]
nvme: Return 0 on success and 1 on error
main() should return 0 on success and 1 on error. Generally there are
not fixed rules. Though SUSv3 specifies EXIT_SUCCESS(0) and
EXIT_FAILURE(1).
The main reason why we should avoid anything but 0/1 is the shell
interpretes those return codes. Values above 128 can cause confusion
in shell scripts. When a command is terminated by a signal, the
shell indicates this fact by setting the value of the variable $?
to 128 plus the signal number.
See also
https://stackoverflow.com/questions/1101957/are-there-any-standard-exit-status-codes-in-linux
https://tldp.org/LDP/abs/html/exitcodes.html
Daniel Wagner [Thu, 27 Jan 2022 10:06:39 +0000 (11:06 +0100)]
nvme: Call nvme_identify_*list with correct nsid offset
Commit 81bb8289f642 ("nvme: update list-ns nsid option") changed the
start index for the namespace argument. But the merge back from the
monolithic branch was incomplete and missed to update the index offset
when calling nvme_identify_allocated_ns_list and
nvme_identify_active_ns_list.
Tokunori Ikegami [Thu, 27 Jan 2022 08:31:30 +0000 (09:31 +0100)]
nvme: Use canonical types
Use the more common type names.
Signed-off-by: Tokunori Ikegami <ikegami.t@gmail.com>
[dwagner: carved this change from other independ change] Signed-off-by: Daniel Wagner <dwagner@suse.de>
Daniel Wagner [Fri, 21 Jan 2022 17:01:33 +0000 (18:01 +0100)]
fabrics: Stop using nvme_msg from libnvme
nvme_msg() is logging function from libnvme. The cli should not use
the logging infrastructure from the library instead it should use it's
own infrastructure. At this point nvme-cli doesn't have one, so just
use the default stderr for all error messages.
This is a preperation step to unexport the nvme_msg() from libnvme.
Hannes Reinecke [Fri, 21 Jan 2022 07:17:34 +0000 (08:17 +0100)]
nvme-print: check namespace in nvme_ctrl_for_each_path()
We should check if the namespace is available when scanning all
paths in nvme_ctrl_for_each_path(); a controller might be resetting
and might not be able to access the namespaces here.
Steven Seungcheol Lee [Fri, 7 Jan 2022 06:56:24 +0000 (15:56 +0900)]
nvme: modify flbas rsvd bits to be used
flbas Bits 6:5 indicate the most significant 2 bits of
the Format Index of the supported LBA Format indicated
in this data structure that was used to format the namespace
using libnvme util function nvme_id_ns_flbas_to_lbaf_inuse
to extract currently used lba index
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Hannes Reinecke [Fri, 14 Jan 2022 13:16:22 +0000 (14:16 +0100)]
fabrics: Only disconnect discovery controllers during 'connect-all'
When calling 'connect-all' the 'persistent' argument only applies to
discovery controllers; normal I/O controllers should stay connected,
as this was kinda the point...
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.