Daniel Wagner [Fri, 11 Feb 2022 12:45:57 +0000 (13:45 +0100)]
build: make Python memory allocations valgrind friendly
When testing with
meson test -C .build --wrap='valgrind --leak-check=full'
the Python binding will trigger 'Invalid read of size 4' warnings.
Tell Python to use malloc directly for all memory allocation which can
be properly traced by valgrind.
Daniel Wagner [Fri, 11 Feb 2022 12:20:14 +0000 (13:20 +0100)]
tree: Fix memleaks in __nvme_free_ns() and nvme_scan_subsystem()
valgrind reports that we are leaking memory in __nvme_free_ns() and
nvme_scan_subsystem(). Free ns->generic_name and path which makes
valgrind also happy.
Daniel Wagner [Mon, 7 Feb 2022 15:01:57 +0000 (16:01 +0100)]
build: Add kernel-doc CI build
We want to catching documentation failures early. Let's add a
dedicated documentation CI build. To keep build times low just
shortcut here and do not call meson to build the complete
documentation.
Daniel Wagner [Mon, 7 Feb 2022 14:31:24 +0000 (15:31 +0100)]
build: Make CI build fail on warnings
Currently, warnings are hidden in the logs and the build is marked as
succeeded. Mark all warnings as error so that we see them show up in
the review process.
Daniel Wagner [Thu, 3 Feb 2022 17:00:15 +0000 (18:00 +0100)]
doc: Mesonize documentation generation
Introduce a new config flag -Ddocs-build=true which controls if the
build system should generate documentation or not. If disabled but
-Ddocs=man is used then the pre compiled documentation will be
installed.
Furthmore, we are hooking up the sphinx tooling so that we generate
the HTML documentation ouf of the rst files.
Steven Seungcheol Lee [Mon, 17 Jan 2022 03:22:22 +0000 (12:22 +0900)]
ioctl: Add identify ioctl for CNS 09h, 0Ah
09h - Identify Namespace data structure for the specified
User Data Format index containing the namespace capabilities
for the NVM Command Set.
0Ah - I/O Command Set specific Identify Namespace data structure
for the specified User Data Format index containing
the namespace capabilities for the I/O Command Set
specified in the CSI field.
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Steven Seungcheol Lee [Mon, 17 Jan 2022 02:35:54 +0000 (11:35 +0900)]
ioctl: Modify identify command argument based on spec
CNS Specific identifier presents all names below for DWORD11 bits [15:00]
NVM Set Identifier(NVM Set List (04h))
Domain Identifier(Domain List (18h))
Endurance Group Identifier(Endurance Group List (19h))
Signed-off-by: Steven Seungcheol Lee <sc108.lee@samsung.com>
Hannes Reinecke [Thu, 3 Feb 2022 11:28:13 +0000 (12:28 +0100)]
tree: do not set dhchap_key to 'none'
When no dhchap key is set the kernel will set the sysfs attribute
to 'none'. And we shouldn't display this value in our internal tree
as it really means 'not set'.
Hannes Reinecke [Thu, 3 Feb 2022 08:46:33 +0000 (09:46 +0100)]
tree: restart controller lookup
nvme_lookup_ctrl() might match more than one controller (eg for loop
devices), in which case the iterator will only ever find the first one.
So add a parameter 'p' to nvme_lookup_ctrl() to re-start the iteration
at a given point instead of just the first one.
Hannes Reinecke [Wed, 2 Feb 2022 10:04:13 +0000 (11:04 +0100)]
Fixup sphinx warnings
When configuring with 'meson -Dman=true' sphinx is printing out errors
on the generated libnvme.rst file. This patch fixes up the function
documentations to fixup these warnings.
Daniel Wagner [Mon, 31 Jan 2022 12:24:56 +0000 (13:24 +0100)]
libvnme: Remove __nvme_msg from export map
nvme-cli was using the library infrastructure for logging. In the
meantime this has been removed, hence we can remove this function from
the export map.
Furthermore, move nvme_msg() and __nvme_msg() to private header.
Hannes Reinecke [Tue, 1 Feb 2022 06:50:40 +0000 (07:50 +0100)]
Rework nvme_scan_filter()
Split off nvme_scan_filter() into nvme_create_root() and export the
remaining functionality as nvme_scan_topology(). With that
nvme_scan_filter() becomes pointless as the component functions
can be called directly.
Daniel Wagner [Mon, 31 Jan 2022 09:43:58 +0000 (10:43 +0100)]
ioctl: Sort members their natural size
Previous attempt to align the members of all *_args structure didn't
take into account that pointer types vary between 32bit and 64bit
depending the arch. The only reliable alignemnt is to sort the members
according their natural size: 64bit, pointers, 32bit, 16bit, 8bit.
Commit 781b9105cc43 ("nvme: Add Media Unit Status log page(LID:
0x10)") placed the domid member between two u8 members. The access
domid member would not be 16 bit aligned which is caused problems on
certain architectures. Let's fix the aligemnt by moving domid before
lsp. This give us following layout
Hannes Reinecke [Fri, 21 Jan 2022 12:47:20 +0000 (13:47 +0100)]
fabrics: kill 'disable_sqflow' argument to nvmf_add_ctrl()
The 'disable_sqflow' argument to nvmf_add_ctrl() is pointless, as
'struct fabrics_config' is exported and the caller can set it
directly there, without having to involve library functions at all.
And consequently we can also remove nvme_ctrl_disable_sqflow().
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
};