Hannes Reinecke [Fri, 21 Jan 2022 11:53:51 +0000 (12:53 +0100)]
tree: only open controller device node if required
Opening the controller device will fail if the controller is resetting,
so trying to open it during controller initialisation will fail, and
the controller will not displayed correctly.
So only try to open the controller device if required, allowing the
initialisation to continue.
Daniel Wagner [Fri, 21 Jan 2022 09:39:53 +0000 (10:39 +0100)]
ioctl: Initialize all members in nvme_get_log_args
Commit 781b9105cc43 ("nvme: Add Media Unit Status log page(LID:
0x10)") introduces a new member in nvme_get_log_args. Older compilers
are not happy when we don't initialize all members in the inline
functions.
In file included from ../subprojects/libnvme/src/libnvme.h:19:0,
from ../subprojects/libnvme/test/cpp.cc:10:
../subprojects/libnvme/src/nvme/ioctl.h: In function ‘int nvme_get_log_cmd_effects(int, nvme_csi, nvme_cmd_effects_log*)’:
../subprojects/libnvme/src/nvme/ioctl.h:1328:2: sorry, unimplemented: non-trivial designated initializers not supported
};
Daniel Wagner [Wed, 19 Jan 2022 14:54:50 +0000 (15:54 +0100)]
src: Use PRIu64 format specifier for uint64 types
When compiling for 32bit architectures the compiler is complaining
about the wrong format specifier for uint64. Use the the PRIu64 format
specifier in this case which is supported from 32bit and 64bit.
Steven Seungcheol Lee [Wed, 19 Jan 2022 02:47:18 +0000 (11:47 +0900)]
util: 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
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Daniel Wagner [Fri, 14 Jan 2022 17:24:34 +0000 (18:24 +0100)]
build: Add __nvme_msg back to exported symbols
nvme_msg() is a macro which call __nvme_msg(). The naming scheme is
not great but until we figured it out, add it back to the list of
exported symbols.
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.