Daniel Wagner [Tue, 12 Apr 2022 08:52:35 +0000 (10:52 +0200)]
ci: publish only sdist on PyPi
Pre building the binaries with wheels is difficult, as we would also
need to ship the libnvme.so with the Python binding.
This is a well known limitation of this kind of setup (binding to a
shared library). Most project fallback to just ship the sdist.
Though there is a drawback as the C library is missing and the user
has to provide the library himself, with all problems which come along
with setup. But it seems common practice with other Python bindings,
so we don't want to be hostile to the ones which know what they are
doing.
Normal users should just use the distribution packages anyway.
Daniel Wagner [Tue, 12 Apr 2022 17:00:33 +0000 (19:00 +0200)]
doc: Build ReST documantion as standalone target
In order to feed readthedocs with documecation we have to build the
ReST documentation and store it the source tree.
To avoid cluttering the root dir of the documantion directory move the
generation of the *.rst docs into the rst subdir. Unfortunatly, meson
doesn't have an option to generate the newly files into subdir. So
move the rst build instruction into rst/meson.build.
While at it, split the whole documentation into sections.
We want to replace any VERSION string in the documantion. Instead just
addressing conf.py we process all files in one go for consistency reasons.
Daniel Wagner [Mon, 4 Apr 2022 15:36:20 +0000 (17:36 +0200)]
tree: Remove default port setting for TCP and RDMA ports
When the controller is created, the discovery_ctrl attribute is not
set yet. The caller is supposed to set this after the creation of the
new discovery controller. Thus we can't really set the default port at
this level. This is a bit of a chicken-egg situation.
Move this work up to the caller to provide the correct defaults.
Hannes Reinecke [Fri, 1 Apr 2022 12:29:02 +0000 (14:29 +0200)]
tree: update nvme_scan_filter_t usage
Add two more arguments (nvme_ctrl_t and nvme_ns_t) to the nvme scan
filter to allow the implementation to distinguish between the call sites.
This allows for a more targeted approach when implementing filters.
Hannes Reinecke [Fri, 1 Apr 2022 11:28:11 +0000 (13:28 +0200)]
tree: always allocate config file in nvme_read_config()
Even if there was an error when reading the config file we still
should store the config file name, as it might used later on to
update/write the config file.
So parsing errors don't really matter, and we'll get notified for
I/O errors on writing anyway.
Martin Belanger [Thu, 31 Mar 2022 11:07:01 +0000 (07:07 -0400)]
fabrics: Invoke nvmf_dim() with provided tas argument
Looks like a copy-paste issue. One of the arguments to
nvmf_register_ctrl() is "tas" (i.e. the DIM Task). This argument
should be passed to the nvmf_dim() API, but instead a fixed value
of NVMF_DIM_TAS_REGISTER was passed.
The "tas" field specifies whether to perform a "registration",
"deregistration", or a "registration update".
Signed-off-by: Martin Belanger <martin.belanger@dell.com>
Hannes Reinecke [Wed, 30 Mar 2022 15:00:48 +0000 (17:00 +0200)]
tree: rework nvme_scan_subsystem()
The nvme subsystem does not have a 'hostnqn' sysfs entry, so we
cannot infer from the nvme subsystem sysfs entry to which host
it relates. And really, the subsystem should already have been
created by the previous call to nvme_scan_ctrl().
So do not call nvme_lookup_subsystem() in nvme_scan_subystem(),
but rather just validate the sysfs subsystem entries and create
any missing subsystems.
Hannes Reinecke [Wed, 30 Mar 2022 14:42:18 +0000 (16:42 +0200)]
tree: move nvme_init_subsystem() into nvme_lookup_subsystem()
We're always calling nvme_init_subsystem() when nvme_lookup_subsystem()
is called with a non-NULL 'name' parameter. So we might as well move
it into nvme_lookup_subsystem() and simplify the callers.
Daniel Wagner [Wed, 30 Mar 2022 07:38:03 +0000 (09:38 +0200)]
ioctl: Remove attribute packed and alignedof for args structs
The attribute packed is usually used to make sure the data structures
is compatible between different compilers in regards of padding rules.
As we have sorted the members of all argument structs according their
naturual size, there are no holes to pad. This makes the packed
attributed superflous as compilers are agree on the data layout in
this case.
The alignedof attribute is used to tell the outer alignmen of the data
structure because the aligment of a packed data structure is 1.
Anyway, both attributes doen't add any benefits to the layout and
pahole agrees on this.
This is an example the diff between the packed/aligneof version and
the plain version:
Daniel Wagner [Wed, 23 Mar 2022 14:49:38 +0000 (15:49 +0100)]
fabrics: Avoid out of bounds string chomping
Update all callsides of nvme_chomp to use the correct max lenght of
the string to avoid out of bounds access.
While at it, nvme_chomp() is used by fabrics.c to sanitize the traddr
and trsvcid. There is no user outside of fabrics and clearly this is a
small helper function. Thus move it to fabrics and rename it to a more
comon name strchomp.
Tomas Bzatek [Wed, 23 Mar 2022 12:17:02 +0000 (13:17 +0100)]
tree: Handle NULL subsysname in nvme_scan_ctrl()
As noted couple of lines earlier, the subsysname string might
be NULL. In that case, defer initialization of nvme_subsystem_t
in hope that it would get initialized while scanning subsystems.
Tomas Bzatek [Tue, 22 Mar 2022 15:22:30 +0000 (16:22 +0100)]
tree: Fix subsystem initialization in nvme_scan_ctrl()
The subsystem instance would normally get properly initialized
in later stages of topology scanning, unless there's a host
mismatch and the instance would stand alone.
Daniel Wagner [Fri, 18 Mar 2022 16:40:19 +0000 (17:40 +0100)]
doc: Provide SYSCONFDIR without quotes
Unfortunately, we can't use the configuration data object defined in
the top meson.build file as this one is with quotes. Instead, making
the c code ugly, just provide a new configuration data object without
the quotes. This avoid generating strings suchs as
Daniel Wagner [Fri, 18 Mar 2022 13:05:27 +0000 (14:05 +0100)]
fabrics: Correctly stringify default hostnqn and hostid paths
Fixes: f356ab0ca74a ("fabrics: Allow to change sysconfdir for hostnqn and hostid file") Reported-by: Hannes Reinecke <hare@suse.de> Signed-off-by: Daniel Wagner <dwagner@suse.de>
Hannes Reinecke [Fri, 18 Mar 2022 13:54:07 +0000 (14:54 +0100)]
linux: fixup log page offset in nvme_get_log_page()
When resubmitting the log page with a different length in
nvme_get_log_page() we need to store the original length
of the log page to avoid the length being overwritten.
Daniel Wagner [Tue, 15 Mar 2022 11:09:58 +0000 (12:09 +0100)]
fabrics: Allow to change sysconfdir for hostnqn and hostid file
Instead hard coding the sysconfdir allow the user to overwrite the
location of the hostnqn and hostid file. The default is "/etc" but
when configured with --prefix=DIR the files should be read from
"DIR/nvme/".