]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
3 years agolibnvme: Export nvme_ctrl_get_config
Daniel Wagner [Thu, 19 May 2022 08:41:27 +0000 (10:41 +0200)]
libnvme: Export nvme_ctrl_get_config

We missed to export the nvme_ctrl_get_config() function in
version 1.0.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #361 from igaw/clarify-license
Hannes Reinecke [Tue, 17 May 2022 15:02:24 +0000 (17:02 +0200)]
Merge pull request #361 from igaw/clarify-license

Clarify license and add missing SPDX identifiers

3 years agomeson: Use SPDX identifier as license text
Daniel Wagner [Tue, 17 May 2022 14:01:23 +0000 (16:01 +0200)]
meson: Use SPDX identifier as license text

First it is recommended to use SPDX identifiers for the version field
and second it clarifies which LGPL version this project is using.

While at it, also use the SPDX identifier in the README.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotreewide: Add SPDX identifier
Daniel Wagner [Tue, 17 May 2022 13:49:24 +0000 (15:49 +0200)]
treewide: Add SPDX identifier

Add the SPDX identifer with the projects default license choice.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolog: Change license to LGPL-2.1-or-later
Daniel Wagner [Tue, 17 May 2022 13:48:14 +0000 (15:48 +0200)]
log: Change license to LGPL-2.1-or-later

Change the license to LGPL-2.1-or-later to match with the projects
license.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agolicenses: Remove old dir from initial ccan import
Daniel Wagner [Tue, 17 May 2022 13:34:00 +0000 (15:34 +0200)]
licenses: Remove old dir from initial ccan import

The ccan directory has been moved to nvme-cli/ccan including the
initial location of licenses. Remove stale directory.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #360 from martin-gpy/nvme_config_segfault
Daniel Wagner [Fri, 13 May 2022 13:53:26 +0000 (15:53 +0200)]
Merge pull request #360 from martin-gpy/nvme_config_segfault

tree: avoid segfault if subsysnqn is not available

3 years agoMerge pull request #359 from glimchb/master
Daniel Wagner [Fri, 13 May 2022 13:48:48 +0000 (15:48 +0200)]
Merge pull request #359 from glimchb/master

ci: add static library compilation

3 years agoMerge pull request #357 from t-8ch/host_mem_buf-feature-length
Daniel Wagner [Fri, 13 May 2022 13:47:00 +0000 (15:47 +0200)]
Merge pull request #357 from t-8ch/host_mem_buf-feature-length

util: Add feature length for host memory buffer

3 years agotree: avoid segfault if subsysnqn is not available
Martin George [Fri, 13 May 2022 07:43:10 +0000 (13:13 +0530)]
tree: avoid segfault if subsysnqn is not available

A nvme config command specifying the -M & -J options would end
up in a segfault if subsysnqn is NULL, as shown below:

nvme config -M -J /etc/nvme/config.json
Segmentation fault (core dumped)

Avoid this segfault by proceeding with the subsysnqn strcmp in
nvme_lookup_subsystem() only if subsysnqn is available.

Signed-off-by: Martin George <marting@netapp.com>
3 years agoci: add static library compilation
Boris Glimcher [Mon, 2 May 2022 10:09:07 +0000 (13:09 +0300)]
ci: add static library compilation

Now possible since we can use uuid for fallback

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
3 years agoMerge pull request #349 from glimchb/master
Daniel Wagner [Fri, 29 Apr 2022 17:06:05 +0000 (19:06 +0200)]
Merge pull request #349 from glimchb/master

build: use uuid wrap for fallback build

3 years agoutil: Add feature length for host memory buffer
Thomas Weißschuh [Fri, 29 Apr 2022 15:06:27 +0000 (17:06 +0200)]
util: Add feature length for host memory buffer

Without this the command "nvme get-feature /dev/nvme0 -H -f 0x0d"
segfaults because it retrieves no data but tries to use it in
nvme_show_host_mem_buffer()

3 years agobuild: use uuid wrap for fallback build
Boris Glimcher [Wed, 13 Apr 2022 13:11:34 +0000 (16:11 +0300)]
build: use uuid wrap for fallback build

see https://github.com/util-linux/util-linux/pull/1657

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
3 years agoMerge pull request #356 from hreinecke/coverity
Hannes Reinecke [Fri, 22 Apr 2022 10:12:17 +0000 (12:12 +0200)]
Merge pull request #356 from hreinecke/coverity

Coverity fixes

3 years agotest/zns: coverity fixes
Hannes Reinecke [Fri, 22 Apr 2022 09:44:05 +0000 (11:44 +0200)]
test/zns: coverity fixes

Coverity found some resource leaks.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: coverity fixes
Hannes Reinecke [Fri, 22 Apr 2022 09:42:47 +0000 (11:42 +0200)]
tree: coverity fixes

Coverity found some resource leaks and a possible out-of-bounds access
in nvme_ctrl_lookup_subsystem_name() where we could overflow the
'path' variable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics: coverity fixes
Hannes Reinecke [Fri, 22 Apr 2022 09:37:19 +0000 (11:37 +0200)]
fabrics: coverity fixes

Coverity reported a possible out-of-bounds access in inet6_pton
and we never checked the return value of nvme_ctrl_identify() in
nvme_fetch_cntrltype_dctype_from_id(), leading to a possible
NULL pointer access in nvmf_is_registration_supported().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoexamples/telemetry-listen: coverity fixes
Hannes Reinecke [Fri, 22 Apr 2022 09:37:19 +0000 (11:37 +0200)]
examples/telemetry-listen: coverity fixes

Coverity reported several issues.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #354 from eli-schwartz/uuid_h-name
Daniel Wagner [Thu, 21 Apr 2022 15:32:09 +0000 (17:32 +0200)]
Merge pull request #354 from eli-schwartz/uuid_h-name

fix broken includes for the uuid.h header

3 years agoreduce the exposed interface for libnvme_dep
Eli Schwartz [Fri, 15 Apr 2022 05:06:56 +0000 (01:06 -0400)]
reduce the exposed interface for libnvme_dep

It does not publicly expose openssl. It does publicly expose uuid.h and
json.h, but only in terms of header types, not symbols used... so use a
partial dependency that doesn't expose the link libraries.

3 years agofix broken includes for the uuid.h header
Eli Schwartz [Fri, 15 Apr 2022 00:23:40 +0000 (20:23 -0400)]
fix broken includes for the uuid.h header

Per `man 3 uuid`, the correct include is `<uuid.h>`, and correspondingly
the util-linux build system installs the uuid.h file to
`$(includedir)/uuid/` and uuid.pc adds `-I${includedir}/uuid` to the
dependency Cflags.

Including it as `<uuid/uuid.h>` simply fails altogether. The exception
is if, by coincidence, the libuuid includedir happens to be the same as
one of the compiler's own internal include directories... which is
pretty common if that is `/usr/include`. In this case, `<uuid/uuid.h>`
fails to be found in the uuid dependency's export directories, but the
compiler picks up a copy in its builtin search path.

In other cases, such as when util-linux is compiled into a custom prefix
and added to the PKG_CONFIG_PATH, it either:

- fails with missing header errors, if libuuid-dev is not installed

- seems to succeed, but compiles against a different version of the
  headers than the library that is linked to, resulting in potentially
  various problems from bizarre linker errors, to subtly broken
  incompatible symbols that crash, or corrupt the results

The problem is even worse if you try to use util-linux as a subproject
dependency fallback. In this case, `<uuid.h>` is correctly exported, but
there is no disk location for `<uuid/uuid.h>` and absolutely no way to
generate such a location in the builddir. This completely prevents the
use of subproject fallbacks.

Once the header include is renamed, it is revealed that the example and
test executables don't correctly build as they depend on the full public
interface of libnvme, which includes the public compile interface of
libuuid due to `libnvme.h` including `uuid.h`. Update all executables to
depend on the full public interface of libnvme_dep instead of simply
linking to the library name on its own.

3 years agoMerge pull request #340 from igaw/add-git-version
Daniel Wagner [Thu, 14 Apr 2022 12:11:30 +0000 (14:11 +0200)]
Merge pull request #340 from igaw/add-git-version

build: Add git ref to the binary

3 years agoMerge pull request #350 from glimchb/doc
Daniel Wagner [Thu, 14 Apr 2022 12:02:45 +0000 (14:02 +0200)]
Merge pull request #350 from glimchb/doc

doc: update installation doc

3 years agoMerge pull request #352 from igaw/fix-log-level
Daniel Wagner [Thu, 14 Apr 2022 10:33:41 +0000 (12:33 +0200)]
Merge pull request #352 from igaw/fix-log-level

fabrics: Remove double connection error logging

3 years agofabrics: Remove double connection error logging
Daniel Wagner [Thu, 14 Apr 2022 10:18:53 +0000 (12:18 +0200)]
fabrics: Remove double connection error logging

nvmf_connect_disc_entry() is calling nvmf_add_ctrl() to do the
connecting attempt. We have in nvmf_add_ctrl() all error paths logging
enabled, so another logging in nvmf_connect_disc_entry() is not
necessary and introduces a problem such as nmve-cli users interpreting
this as hard error.

For example the kernel reports via < 0 return values state information
such as the connection is already there if the user runs 'nvme
connect-all' twice:

  $ .build/nvme connect-all -t tcp --traddr=10.161.8.24  --trsvcid=4421
  Failed to write to /dev/nvme-fabrics: Operation already in progress
  failed to connect controller, error 1006

Let's remove this error message.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #351 from igaw/fix-log-level
Daniel Wagner [Thu, 14 Apr 2022 10:13:00 +0000 (12:13 +0200)]
Merge pull request #351 from igaw/fix-log-level

fabrics: Lower log level in __nvmf_add_ctrl

3 years agofabrics: Lower log level in __nvmf_add_ctrl
Daniel Wagner [Thu, 14 Apr 2022 10:01:43 +0000 (12:01 +0200)]
fabrics: Lower log level in __nvmf_add_ctrl

9df8676d2db6 ("Add logging functionality to libnvme") introduced the
logging. The log level for writing to /dev/nvme-fabrics was set on
NOTICE because the kernel reports also status information such
EALREADY which is a soft error.

866c288a456f ("fabrics: update log level for write failures")
increased the log level without taking this into account.

Drop back to NOTICE level to avoid error message when doing

  $ nvme connect-all ....
  Failed to write to /dev/nvme-fabrics: Operation already in progress

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoutil: add function to retrieve version information
Daniel Wagner [Wed, 13 Apr 2022 19:15:52 +0000 (21:15 +0200)]
util: add function to retrieve version information

Allow to query the version of the library via a function.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agodoc: update installation doc
Boris Glimcher [Wed, 13 Apr 2022 13:53:51 +0000 (16:53 +0300)]
doc: update installation doc

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
3 years agoMerge pull request #344 from glimchb/doc
Daniel Wagner [Wed, 13 Apr 2022 12:34:37 +0000 (14:34 +0200)]
Merge pull request #344 from glimchb/doc

doc: add quickstart and installation

3 years agoMerge pull request #342 from cions/fix-cxx11-narrowing
Daniel Wagner [Wed, 13 Apr 2022 09:59:53 +0000 (11:59 +0200)]
Merge pull request #342 from cions/fix-cxx11-narrowing

ioctl.h: Fix clang -Wc++11-narrowing error

3 years agoMerge pull request #345 from linux-nvme/dependabot/github_actions/actions/checkout-3
Daniel Wagner [Wed, 13 Apr 2022 09:55:42 +0000 (11:55 +0200)]
Merge pull request #345 from linux-nvme/dependabot/github_actions/actions/checkout-3

build(deps): bump actions/checkout from 2 to 3

3 years agobuild(deps): bump actions/checkout from 2 to 3
dependabot[bot] [Wed, 13 Apr 2022 09:54:18 +0000 (09:54 +0000)]
build(deps): bump actions/checkout from 2 to 3

Bumps [actions/checkout](https://github.com/actions/checkout) from 2 to 3.
- [Release notes](https://github.com/actions/checkout/releases)
- [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md)
- [Commits](https://github.com/actions/checkout/compare/v2...v3)

---
updated-dependencies:
- dependency-name: actions/checkout
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoMerge pull request #346 from linux-nvme/dependabot/github_actions/codecov/codecov...
Daniel Wagner [Wed, 13 Apr 2022 09:53:58 +0000 (11:53 +0200)]
Merge pull request #346 from linux-nvme/dependabot/github_actions/codecov/codecov-action-3

build(deps): bump codecov/codecov-action from 1 to 3

3 years agoMerge pull request #347 from linux-nvme/dependabot/github_actions/actions/setup-python-3
Daniel Wagner [Wed, 13 Apr 2022 09:53:20 +0000 (11:53 +0200)]
Merge pull request #347 from linux-nvme/dependabot/github_actions/actions/setup-python-3

build(deps): bump actions/setup-python from 1 to 3

3 years agoMerge pull request #348 from linux-nvme/dependabot/github_actions/actions/upload...
Daniel Wagner [Wed, 13 Apr 2022 09:52:45 +0000 (11:52 +0200)]
Merge pull request #348 from linux-nvme/dependabot/github_actions/actions/upload-artifact-3

build(deps): bump actions/upload-artifact from 1 to 3

3 years agoMerge pull request #338 from TotalCaesar659/patch-1
Daniel Wagner [Wed, 13 Apr 2022 09:49:05 +0000 (11:49 +0200)]
Merge pull request #338 from TotalCaesar659/patch-1

Update URLs to HTTPS

3 years agobuild(deps): bump actions/upload-artifact from 1 to 3
dependabot[bot] [Wed, 13 Apr 2022 09:47:17 +0000 (09:47 +0000)]
build(deps): bump actions/upload-artifact from 1 to 3

Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 1 to 3.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agobuild(deps): bump actions/setup-python from 1 to 3
dependabot[bot] [Wed, 13 Apr 2022 09:47:14 +0000 (09:47 +0000)]
build(deps): bump actions/setup-python from 1 to 3

Bumps [actions/setup-python](https://github.com/actions/setup-python) from 1 to 3.
- [Release notes](https://github.com/actions/setup-python/releases)
- [Commits](https://github.com/actions/setup-python/compare/v1...v3)

---
updated-dependencies:
- dependency-name: actions/setup-python
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agobuild(deps): bump codecov/codecov-action from 1 to 3
dependabot[bot] [Wed, 13 Apr 2022 09:47:10 +0000 (09:47 +0000)]
build(deps): bump codecov/codecov-action from 1 to 3

Bumps [codecov/codecov-action](https://github.com/codecov/codecov-action) from 1 to 3.
- [Release notes](https://github.com/codecov/codecov-action/releases)
- [Changelog](https://github.com/codecov/codecov-action/blob/master/CHANGELOG.md)
- [Commits](https://github.com/codecov/codecov-action/compare/v1...v3)

---
updated-dependencies:
- dependency-name: codecov/codecov-action
  dependency-type: direct:production
  update-type: version-update:semver-major
...

Signed-off-by: dependabot[bot] <support@github.com>
3 years agoMerge pull request #341 from glimchb/dep
Daniel Wagner [Wed, 13 Apr 2022 09:46:46 +0000 (11:46 +0200)]
Merge pull request #341 from glimchb/dep

ci: create first dependabot.yml

3 years agoMerge pull request #337 from nekopsykose/scope-delimiter
Daniel Wagner [Wed, 13 Apr 2022 09:40:29 +0000 (11:40 +0200)]
Merge pull request #337 from nekopsykose/scope-delimiter

fabrics: use '%' instead of SCOPE_DELIMITER

3 years agodoc: add quickstart and installation
Boris Glimcher [Wed, 13 Apr 2022 08:29:22 +0000 (11:29 +0300)]
doc: add quickstart and installation

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
3 years agoMerge pull request #343 from igaw/build-rst-doc
Daniel Wagner [Tue, 12 Apr 2022 18:01:25 +0000 (20:01 +0200)]
Merge pull request #343 from igaw/build-rst-doc

doc: Build ReST documantion as standalone target

3 years agoMerge pull request #339 from igaw/pypi-sdist-only
Daniel Wagner [Tue, 12 Apr 2022 18:01:04 +0000 (20:01 +0200)]
Merge pull request #339 from igaw/pypi-sdist-only

ci: publish only sdist on PyPi

3 years agoci: publish only sdist on PyPi
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.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agodoc: Build ReST documantion as standalone target
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.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoioctl.h: Fix clang -Wc++11-narrowing error
cions [Tue, 12 Apr 2022 16:38:56 +0000 (01:38 +0900)]
ioctl.h: Fix clang -Wc++11-narrowing error

Signed-off-by: Joh Matsuura <gh.cions@gmail.com>
3 years agoci: create first dependabot.yml
Boris Glimcher [Tue, 12 Apr 2022 11:39:53 +0000 (14:39 +0300)]
ci: create first dependabot.yml

Signed-off-by: Boris Glimcher <Boris.Glimcher@emc.com>
3 years agobuild: Add git ref to the binary
Daniel Wagner [Tue, 12 Apr 2022 11:24:27 +0000 (13:24 +0200)]
build: Add git ref to the binary

In order to be able to figure out which binary is in use (for example
in debugging situation) it's really helpful to have the 'git describe'
ref added to the binary.

The simplest way to expose the it via good old Source Code Control
System string id. No need to come up with something complicated else
as there is no agreement on how to do this. So let's add this simple
magic string to library.

You can either query with 'what' or just

  $strings .build/src/libnvme.so | grep '@(#)'
  @(#)libnvme 1.0-1-g5ff5d22+

The idea how to extract the version string is shamelessly copied from
the systemd project.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoUpdate URLs to HTTPS
TotalCaesar659 [Mon, 11 Apr 2022 12:46:54 +0000 (15:46 +0300)]
Update URLs to HTTPS

3 years agofabrics: use '%' instead of SCOPE_DELIMITER
psykose [Sat, 9 Apr 2022 17:30:32 +0000 (17:30 +0000)]
fabrics: use '%' instead of SCOPE_DELIMITER

this definition does not exist in musl libc, and has always been '%' in
glibc[0] for over 20 years.

[0]: https://github.com/bminor/glibc/commit/c0bc5f7b8fd62dfa566dd3adb91f3a1ee8db6aeb

3 years agodoc: Regenerate all documentation v1.0
Daniel Wagner [Fri, 8 Apr 2022 16:14:55 +0000 (18:14 +0200)]
doc: Regenerate all documentation

Prepare for initial 1.0 release

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #332 from linux-nvme/fix-discovery-tcp-port
Daniel Wagner [Thu, 7 Apr 2022 08:00:41 +0000 (10:00 +0200)]
Merge pull request #332 from linux-nvme/fix-discovery-tcp-port

Remove default discovery port bits

3 years agoMerge pull request #333 from jk-ozlabs/fixes
Daniel Wagner [Tue, 5 Apr 2022 08:28:48 +0000 (10:28 +0200)]
Merge pull request #333 from jk-ozlabs/fixes

test: fix meson test() executable definitions

3 years agotest: drop hardware-dependent tests from meson test target
Jeremy Kerr [Tue, 5 Apr 2022 02:17:20 +0000 (10:17 +0800)]
test: drop hardware-dependent tests from meson test target

Currently, the tests under test/ require intractions with actual
hardware, which isn't available under CI.

[Additionally, the test() functions are mostly incorrect, as they'll all
just repeat the same test.c test]

This test drops the test() defitinitons, but leaves the executable()s
available for developer use, and adds a comment to indicate what we're
doing.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agotree: Remove default port setting for TCP and RDMA ports
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.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #331 from jk-ozlabs/fixes
Daniel Wagner [Mon, 4 Apr 2022 10:08:14 +0000 (12:08 +0200)]
Merge pull request #331 from jk-ozlabs/fixes

log.h: include tree.h for nvme_root_t

3 years agoMerge pull request #330 from hreinecke/filter-ns
Hannes Reinecke [Fri, 1 Apr 2022 15:23:37 +0000 (17:23 +0200)]
Merge pull request #330 from hreinecke/filter-ns

Update nvme_scan_filter_t

3 years agotree: add 'f_args' argument to pass user data to the filter function
Hannes Reinecke [Fri, 1 Apr 2022 14:02:18 +0000 (16:02 +0200)]
tree: add 'f_args' argument to pass user data to the filter function

Increase usability by adding an 'f_args' argument to pass user data
to the filter function.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: remove 'ctrl_get_ana_state()'
Hannes Reinecke [Fri, 1 Apr 2022 13:29:01 +0000 (15:29 +0200)]
tree: remove 'ctrl_get_ana_state()'

This function was a hack to begin with, and as we now have namespace
filters it can be removed.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: add namespace path iterators
Hannes Reinecke [Fri, 1 Apr 2022 10:26:13 +0000 (12:26 +0200)]
tree: add namespace path iterators

For some reason the namespace path iterators have not been implemented.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: filter out namespaces
Hannes Reinecke [Fri, 1 Apr 2022 12:37:08 +0000 (14:37 +0200)]
tree: filter out namespaces

As the scan filter accepts a namespace as argument use it to
filter out namespaces, too.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agodoc: Regenerate all documentation v1.0-rc8
Daniel Wagner [Fri, 1 Apr 2022 12:47:29 +0000 (14:47 +0200)]
doc: Regenerate all documentation

Prepare for next release candiate.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agotree: update nvme_scan_filter_t usage
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #329 from hreinecke/read_config
Hannes Reinecke [Fri, 1 Apr 2022 11:36:43 +0000 (13:36 +0200)]
Merge pull request #329 from hreinecke/read_config

tree: always allocate config file in nvme_read_config()

3 years agotree: always allocate config file in nvme_read_config()
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agolog.h: include tree.h for nvme_root_t
Jeremy Kerr [Fri, 1 Apr 2022 03:05:59 +0000 (11:05 +0800)]
log.h: include tree.h for nvme_root_t

nvme_init_logging() has a nvme_root_t, so we need a definition from
tree.h

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #321 from igaw/remove-packed-attribute
Daniel Wagner [Thu, 31 Mar 2022 11:19:43 +0000 (13:19 +0200)]
Merge pull request #321 from igaw/remove-packed-attribute

ioctl: Remove attribute packed and alignedof for args structs

3 years agoMerge pull request #325 from martin-belanger/fix-dim-tas
Daniel Wagner [Thu, 31 Mar 2022 11:19:21 +0000 (13:19 +0200)]
Merge pull request #325 from martin-belanger/fix-dim-tas

fabrics: Invoke nvmf_dim() with provided tas argument.

3 years agofabrics: Invoke nvmf_dim() with provided tas argument
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>
3 years agoMerge pull request #327 from hreinecke/doc-update
Hannes Reinecke [Thu, 31 Mar 2022 09:06:02 +0000 (11:06 +0200)]
Merge pull request #327 from hreinecke/doc-update

Update function prototype documentation

3 years agoUpdate function prototype documentation
Hannes Reinecke [Thu, 31 Mar 2022 08:39:25 +0000 (10:39 +0200)]
Update function prototype documentation

CI has been complaining, so fix things up.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #324 from hreinecke/subsystem-rework
Hannes Reinecke [Thu, 31 Mar 2022 07:39:56 +0000 (09:39 +0200)]
Merge pull request #324 from hreinecke/subsystem-rework

Rework nvme_scan_subsystem()

3 years agotree: rework nvme_scan_subsystem()
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: make subsystem name mandatory in nvme_scan_ctrl()
Hannes Reinecke [Wed, 30 Mar 2022 14:47:17 +0000 (16:47 +0200)]
tree: make subsystem name mandatory in nvme_scan_ctrl()

nvme_scan_ctrl() is iterating over sysfs, so any controller must
have a corresponding subsystem; not finding one is an error.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: move nvme_init_subsystem() into nvme_lookup_subsystem()
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.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #323 from hreinecke/export-symbol
Hannes Reinecke [Wed, 30 Mar 2022 10:30:12 +0000 (12:30 +0200)]
Merge pull request #323 from hreinecke/export-symbol

libnvme: export 'nvme_lookup_ctrl()'

3 years agolibnvme: export 'nvme_lookup_ctrl()'
Hannes Reinecke [Wed, 30 Mar 2022 10:25:50 +0000 (12:25 +0200)]
libnvme: export 'nvme_lookup_ctrl()'

For some reason it has been missing from the map file.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #322 from hreinecke/update-config
Hannes Reinecke [Wed, 30 Mar 2022 10:02:15 +0000 (12:02 +0200)]
Merge pull request #322 from hreinecke/update-config

fabrics: add 'nvmf_update_config()'

3 years agofabrics: add 'nvmf_update_config()'
Hannes Reinecke [Wed, 30 Mar 2022 08:29:55 +0000 (10:29 +0200)]
fabrics: add 'nvmf_update_config()'

Add a function to update the fabrics configuration values of an
existing controller.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoioctl: Remove attribute packed and alignedof for args structs
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:

 struct nvme_dim_args {
        __u32 *                    result;               /*     0     8 */
        void *                     data;                 /*     8     8 */
@@ -776,4 +777,4 @@
        /* size: 40, cachelines: 1, members: 7 */
        /* padding: 7 */
        /* last cacheline: 40 bytes */
-} __attribute__((__aligned__(8)));
+};

Thus, just remove the attributes.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #320 from hreinecke/json-scan
Hannes Reinecke [Wed, 30 Mar 2022 06:22:39 +0000 (08:22 +0200)]
Merge pull request #320 from hreinecke/json-scan

json: fix endless loop scanning for controllers

3 years agojson: fix endless loop scanning for controllers
Hannes Reinecke [Wed, 30 Mar 2022 06:05:56 +0000 (08:05 +0200)]
json: fix endless loop scanning for controllers

nvme_lookup_ctrl() will always create a new controller if none is
found, so checking for a NULL return value is not correct here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #319 from hreinecke/scan-filter
Hannes Reinecke [Tue, 29 Mar 2022 09:53:32 +0000 (11:53 +0200)]
Merge pull request #319 from hreinecke/scan-filter

Fixup scan filter usage

3 years agotree: do not return error when filtering out subsystems
Hannes Reinecke [Tue, 29 Mar 2022 08:09:56 +0000 (10:09 +0200)]
tree: do not return error when filtering out subsystems

The filter is set by the caller, and just modifies the tree.
It does not invalidate the scanning, so we shouldn't return
an error.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: add debugging messages during scanning
Hannes Reinecke [Tue, 29 Mar 2022 08:39:58 +0000 (10:39 +0200)]
tree: add debugging messages during scanning

Add some debugging messages during scanning to aid debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #318 from hreinecke/display-tree
Daniel Wagner [Tue, 29 Mar 2022 08:18:54 +0000 (10:18 +0200)]
Merge pull request #318 from hreinecke/display-tree

meson: build display-tree example

3 years agomeson: build display-tree example
Hannes Reinecke [Tue, 29 Mar 2022 08:03:35 +0000 (10:03 +0200)]
meson: build display-tree example

The 'display-tree' example program wasn't build with meson.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #307 from bjpaupor/lbstm
Daniel Wagner [Fri, 25 Mar 2022 14:40:22 +0000 (15:40 +0100)]
Merge pull request #307 from bjpaupor/lbstm

Add lbstm support for create-ns

3 years agoMerge pull request #315 from igaw/fix-host-traddr-free
Daniel Wagner [Fri, 25 Mar 2022 09:36:43 +0000 (10:36 +0100)]
Merge pull request #315 from igaw/fix-host-traddr-free

fabrics: Free old traddr in nvmf_add_ctrl

3 years agoMerge pull request #308 from Arunpandian15/tests_23_03
Daniel Wagner [Fri, 25 Mar 2022 09:35:04 +0000 (10:35 +0100)]
Merge pull request #308 from Arunpandian15/tests_23_03

test: print test logs for pass case

3 years agotest: print test logs for pass case
Arunpandian J [Fri, 25 Mar 2022 03:56:47 +0000 (09:26 +0530)]
test: print test logs for pass case

test log print for passed cases and aligning
log output.

Signed-off-by: Arunpandian J <apj.arun@samsung.com>
3 years agofabrics: Free old traddr in nvmf_add_ctrl
Daniel Wagner [Thu, 24 Mar 2022 18:56:48 +0000 (19:56 +0100)]
fabrics: Free old traddr in nvmf_add_ctrl

We need to free the old traddr and not the newly translated traddr.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #306 from jeffreyalien/nvme-2.0-2
Daniel Wagner [Thu, 24 Mar 2022 15:44:03 +0000 (16:44 +0100)]
Merge pull request #306 from jeffreyalien/nvme-2.0-2

Nvme 2.0 Changes

3 years agoRemove nvme_init_id_ns
Brandon Paupore [Thu, 24 Mar 2022 14:46:19 +0000 (09:46 -0500)]
Remove nvme_init_id_ns

Function was used only once in nvme-cli for the create-ns command,
instead just handle setting the fields in nvme-cli directly.

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
3 years agoAdd lbstm support for create-ns
Brandon Paupore [Thu, 24 Mar 2022 14:51:28 +0000 (09:51 -0500)]
Add lbstm support for create-ns

Signed-off-by: Brandon Paupore <brandon.paupore@wdc.com>
3 years agotypes: Add support for get log - MI Command Supported
Jeff Lien [Tue, 22 Mar 2022 15:54:01 +0000 (10:54 -0500)]
types: Add support for get log - MI Command Supported

Add API to get NVMe-MI Commands Supported and Effects log page.

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>
3 years agotypes: Add new Identify constant
Jeff Lien [Mon, 21 Mar 2022 21:23:01 +0000 (16:23 -0500)]
types: Add new Identify constant

Add IDENTIFY_CNS_CSI_ID_NS_DATA_STRUCTURE/0x1B define

Signed-off-by: Jeff Lien <jeff.lien@wdc.com>