Daniel Wagner [Fri, 14 Jan 2022 15:59:05 +0000 (16:59 +0100)]
ioctl: Set provided timestamp nvme_set_features_timestamp
The argument order for memcpy is clearly the wrong way around. The
provided timestamp should be stored into the ts variable. The
compiler was warning about ts not being initialized.
Daniel Wagner [Fri, 14 Jan 2022 10:10:08 +0000 (11:10 +0100)]
log: Introduce libnvme error codes
Add libnvme specific error codes which map to a specific error
message. The system error codes in errno are too overloaded to figure
out what is going wrong.
With this we can remove the nvme_log_message buffer. This avoids
having a global library buffer.
Hannes Reinecke [Thu, 13 Jan 2022 16:18:45 +0000 (17:18 +0100)]
Move 'host_traddr' and 'host_iface' into fabrics configuration
Having 'host_traddr' and 'host_iface' as part of the controller
structure is technically correct, but won't work for 'connect-all'.
There we evaluate the contents of the discovery log page, and create
new controllers based on that information.
But as 'host_traddr' and 'host_iface' are Linux-only constructs, the
spec (and the discovery log page) doesn't know about them, and can't
provide us with that information.
Hannes Reinecke [Mon, 15 Nov 2021 10:32:20 +0000 (11:32 +0100)]
tree: scan controllers before scanning subsystems in nvme_scan_topology()
The linux sysfs hierarchy only knows about 'controllers' and 'subsystems',
so when scanning the topology we should follow this structure and scan
first for controllers and then for subsystems.
Just scanning for subsystems and all controllers attached to them has
the problem that the hostnqn can only be derived from the controller,
but by the time the controller is scanned the subsystem has already
been created and attached to the default host.
Scanning for controllers first will setup the correct hosts
(and subsystems), so the subsequent scan for subsystems is primarily
there to find all namespaces attached to the subsystems.
Hannes Reinecke [Tue, 28 Sep 2021 12:14:49 +0000 (14:14 +0200)]
tree: lookup correct subsystem in nvme_scan_ctrl()
Looking subsystems by subsys NQN only might yield wrong results
(eg for discovery controllers), as there might be several subsystem
instances all having the same subsystem NQN.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_zns_append()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_zns_mgmt_send() and nvme_zns_mgmt_recv()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Also convert zns.c to use nvme_zns_report_zones() instead of calling
nvme_zns_mgmt_recv() directly.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for NVMe reservation commands
Use an argument structure for NVMe reservation commands like
nvme_resv_acquire() or nvme_resv_release() instead of passing all
arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_copy()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_dsm()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for NVMe I/O commands
Use an argument structure for NVMe I/O commands like nvme_read() or
nvme_write() instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_virtual_mgmt()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_dev_self_test()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_sanize_nvm()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_set_property() and nvme_get_property()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_lockdown()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_capacity_mgmt()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_directive_send() and nvme_directive_receive()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_get_lba_status()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_security_send() and nvme_security_receive()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_fw_commit()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_fw_download()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_format_nvm() and nvme_ns_mgmt()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_identify()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_set_features() and nvme_get_features()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Also convert zns.c to use nvme_zns_report_zones() instead of calling
nvme_zns_mgmt_recv() directly.
Hannes Reinecke [Fri, 17 Dec 2021 07:03:42 +0000 (08:03 +0100)]
Use argument structure for nvme_get_log()
Use an argument structure instead of passing all arguments one by one.
This allows for a future expansion of the argument list without having
to change the library ABI.
Daniel Wagner [Thu, 23 Dec 2021 13:59:01 +0000 (14:59 +0100)]
linux: Add support to generate DH-HMAC-CHAP keys
Initially the DH-HMAC-CHAP key generation code was part of the
nvme-cli repository and depended on OpenSSL 1. Move the key generation
code into the library. While at it also add support for OpenSSL 3.
Daniel Wagner [Mon, 27 Dec 2021 15:09:04 +0000 (16:09 +0100)]
build: Set C dialect and warning level
Currently, the Makefile is not setting the C dialect but the code was
carved out from the nvme-cli code base which relies on gnu99.
Let's define the C dialect to avoid any confusion and make the build
more consistent.
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 [Thu, 23 Dec 2021 15:38:04 +0000 (16:38 +0100)]
build: Avoid including wrong config.h as subpackage
In case the consuming project also uses a config.h we need to hide our
config.h file. By using the path to our config.h we avoid this
confusion. Obviously, 'src' is a bit too generic, thus move the
generated config.h under libnvme.
Introduce also a private include path because ccan has '#include
"config.h"' in its sources. So we need to present a config.h in the
lookup path but it needs to be the one from this project and not the
one from the consuming project.
Daniel Wagner [Wed, 22 Dec 2021 07:34:03 +0000 (08:34 +0100)]
util: Define inline function as static inline
The gcc in Centos 6.10 complains with
src/nvme/util.h:120: multiple definition of `nvme_feature_decode_arbitration'
'inline' alone does not guarantee that the function gets inlined. The
compiler is still free to decide, thus in this case it doesn't inline
and that's why we having multiple implementation with the same
name (in different compile units). 'static inline' forces the inline
which was the indent of this code.
Martin Belanger [Tue, 21 Dec 2021 20:36:38 +0000 (15:36 -0500)]
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
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Daniel Wagner [Tue, 21 Dec 2021 14:56:14 +0000 (15:56 +0100)]
fabrics: Declare loop index at the beginning of the block
The gcc in Centos 6.10 complains with
nvme/fabrics.c:909: error: ‘for’ loop initial declarations are only allowed in C99 mode
nvme/fabrics.c:909: note: use option -std=c99 or -std=gnu99 to compileyour code
Let's declare the index at the beginning of the basic block.
Daniel Wagner [Mon, 13 Dec 2021 17:37:21 +0000 (02:37 +0900)]
types: Add Controller Metadata and Namespace Metadata
Port and extent the libnvme part from the commit "Add NVMe MI
Features: Controller Metadata (0x7E) and Namespace Metadata (0x7F)."
from the nvme-cli monolithic branch.
While at it add the missing definitions and add some documentation.
This is based on Tokunori Ikegami first port attempt.