]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
3 years agoAdd json config schema
Hannes Reinecke [Mon, 15 Nov 2021 14:29:46 +0000 (15:29 +0100)]
Add json config schema

Add a schema file to describe the JSON configuration file format.

Signed-off-by: Hannes Reinecke <hare@suse.de>
Reviewed-by: Keith Busch <kbusch@kernel.org>
3 years agoMerge pull request #98 from martin-belanger/fix-iface-offset
Daniel Wagner [Thu, 11 Nov 2021 15:22:31 +0000 (16:22 +0100)]
Merge pull request #98 from martin-belanger/fix-iface-offset

Fix host_iface offset.

3 years agoFix host_iface offset.
Martin Belanger [Thu, 11 Nov 2021 15:07:00 +0000 (10:07 -0500)]
Fix host_iface offset.

This was a copy-paste typo.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #93 from tbzatek/docs-updates-4
Daniel Wagner [Mon, 8 Nov 2021 08:32:20 +0000 (09:32 +0100)]
Merge pull request #93 from tbzatek/docs-updates-4

Docs updates + minor fixes

3 years agobuild: Change library version to be a valid number
Tomas Bzatek [Thu, 4 Nov 2021 16:43:02 +0000 (17:43 +0100)]
build: Change library version to be a valid number

pkg-config file version number should be a valid number
to make version comparison actually work.

3 years agotypes: Doc strings update for Sanitize and Format operations
Tomas Bzatek [Thu, 4 Nov 2021 16:34:29 +0000 (17:34 +0100)]
types: Doc strings update for Sanitize and Format operations

3 years agotypes: Fix a typo in the NVME_FORMAT_MSET_EXTENEDED constant
Tomas Bzatek [Thu, 4 Nov 2021 12:01:30 +0000 (13:01 +0100)]
types: Fix a typo in the NVME_FORMAT_MSET_EXTENEDED constant

3 years agoMerge pull request #89 from martin-belanger/rm-duplicate-line
Daniel Wagner [Wed, 3 Nov 2021 12:40:15 +0000 (13:40 +0100)]
Merge pull request #89 from martin-belanger/rm-duplicate-line

Remove a duplicate read() statement

3 years agoFix reading of system UUID on Debian
Martin Belanger [Tue, 2 Nov 2021 19:21:50 +0000 (15:21 -0400)]
Fix reading of system UUID on Debian

The system UUID can be read from the sysfs in two different locations:

1) /sys/class/dmi/id/product_uuid
2) /sys/firmware/dmi/entries

Location 1) is present on all the systems I've tested: SUSE, Red Hat,
Fedora, and Ubuntu. Unfortunately, location 2) does not exist on
Debian-based systems.

Currently, uuid_from_dmi() only reads from location 2), which fails
on Debian.

This patch adds code that reads from location 1) first, and will
only try location 2) if reading from 1) fails.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
[dwagner: Updated return value from -1 to -ENXIO]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoFix python unit tests when run as a subproject of another project (#91)
Martin Belanger [Wed, 3 Nov 2021 09:03:24 +0000 (05:03 -0400)]
Fix python unit tests when run as a subproject of another project (#91)

* Fix python unit tests when run as a subproject of another
project, i.e. nvme-cli.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoRemoved a duplicate line (read from file). I checked with
Martin Belanger [Tue, 2 Nov 2021 12:19:52 +0000 (08:19 -0400)]
Removed a duplicate line (read from file). I checked with
Hannes and he confirmed that the line was added by mistake.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #83 from igaw/ccan-build-c-files
Daniel Wagner [Tue, 2 Nov 2021 11:38:03 +0000 (12:38 +0100)]
Merge pull request #83 from igaw/ccan-build-c-files

ccan: Add *.c files to the build

3 years agoMerge pull request #87 from martin-belanger/add-python-testsv2
Daniel Wagner [Thu, 28 Oct 2021 12:30:01 +0000 (14:30 +0200)]
Merge pull request #87 from martin-belanger/add-python-testsv2

Add Python tests to meson framework.

3 years agoAdd Python tests to meson framework.
Martin Belanger [Wed, 27 Oct 2021 12:20:10 +0000 (08:20 -0400)]
Add Python tests to meson framework.

Python has this strict directory layout requirement. A Python package is a
directory that must contain a __init__.py file in addition to containing
modules.

To be able to run Python tests and load modules directly from the build
directory, the Python package (libnvme) and module (nvme.py) must be organized
in the build directory the same way they would be in the install directory. And
the PYTHONPATH must be set to point to the build directory. In other words,
like this:

  .build                <- PYTHONPATH points to here.
   \_ libnvme           <- Package
       \_ nvme.py       <- Module
       \_ __init__.py
       \_ _nvme.cpython-38-x86_64-linux-gnu.so

This patch changes the directory layout so that meson will organize the Python
package and module as shown above. The patch also defines Python tests and sets
the PYTHONPATH to allow importing directly from the build directory.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #86 from birkelund/fix-virt-mgmt
Daniel Wagner [Wed, 27 Oct 2021 09:31:25 +0000 (11:31 +0200)]
Merge pull request #86 from birkelund/fix-virt-mgmt

ioctl: fix mask values for virt mgmt

3 years agoioctl: fix mask values for virt mgmt
Klaus Jensen [Tue, 26 Oct 2021 18:12:36 +0000 (20:12 +0200)]
ioctl: fix mask values for virt mgmt

Fix the the Virtualization Managemtn CDW10 masks for ACT, RT and CNTLID.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoMerge pull request #60 from martin-belanger/add-init-method
Daniel Wagner [Mon, 25 Oct 2021 07:46:09 +0000 (09:46 +0200)]
Merge pull request #60 from martin-belanger/add-init-method

[Python]: Add init() method to class nvme_ctrl.

3 years agoAdd Python init() method. Move nvme_init_ctrl() from private.h to tree.h
Martin Belanger [Thu, 21 Oct 2021 12:42:24 +0000 (08:42 -0400)]
Add Python init() method. Move nvme_init_ctrl() from private.h to tree.h
Addess review comments.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoccan: Add *.c files to the build
Daniel Wagner [Fri, 22 Oct 2021 07:15:39 +0000 (09:15 +0200)]
ccan: Add *.c files to the build

We are missing the *.c files from the ccan code base in the build.
As we currently don't use any function implemented in the *.c files
all just works.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #81 from igaw/fix-python-lib
Daniel Wagner [Fri, 22 Oct 2021 06:42:50 +0000 (08:42 +0200)]
Merge pull request #81 from igaw/fix-python-lib

libnvme.map: Expose symbols for Python binding

3 years agoMerge pull request #75 from jk-ozlabs/fixes
Daniel Wagner [Fri, 22 Oct 2021 06:42:25 +0000 (08:42 +0200)]
Merge pull request #75 from jk-ozlabs/fixes

Minor header definition fixes

3 years agolibnvme.map: Expose symbols for Python binding
Daniel Wagner [Fri, 22 Oct 2021 06:13:52 +0000 (08:13 +0200)]
libnvme.map: Expose symbols for Python binding

There a few missing symbols for the Python binding. Add them to the
libnvme.map.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #79 from birkelund/meson-install-missing-header
Daniel Wagner [Thu, 21 Oct 2021 10:47:46 +0000 (12:47 +0200)]
Merge pull request #79 from birkelund/meson-install-missing-header

src/meson.build: install missing linux.h

3 years agosrc/meson.build: install missing linux.h
Klaus Jensen [Thu, 21 Oct 2021 10:43:46 +0000 (12:43 +0200)]
src/meson.build: install missing linux.h

src/nvme/linux.h is missing from install_headers.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoMerge pull request #77 from jk-ozlabs/ccan-fix
Daniel Wagner [Thu, 21 Oct 2021 08:41:50 +0000 (10:41 +0200)]
Merge pull request #77 from jk-ozlabs/ccan-fix

meson + ccan configuration fixes

3 years agomeson: use correct byteswap macro name
Jeremy Kerr [Thu, 21 Oct 2021 01:44:18 +0000 (09:44 +0800)]
meson: use correct byteswap macro name

We're declaring HAVE_BSWAP64, but ccan expects HAVE_BSWAP_64.

Fixes: bb84156 ("meson.build: Add ccan-required configuration macros")
Reported-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoconfigure: include ccan config from top-level config.h
Jeremy Kerr [Wed, 20 Oct 2021 13:14:25 +0000 (21:14 +0800)]
configure: include ccan config from top-level config.h

In 3a84d900, we moved the ccan config.h to ccan-config.h, but didn't end
up including it in the top-level config.h.

To complete the simplification, config.h should include the
(configurator-generated) ccan-config.h.

Fixes: 3a84d90084b5 ("configure: simplify config-host.h & config-host.mak generation")
Reported-by: Klaus Jensen <k.jensen@samsung.com>
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomakefiles: use config.h in examples/ & tests/
Jeremy Kerr [Thu, 21 Oct 2021 08:20:42 +0000 (16:20 +0800)]
makefiles: use config.h in examples/ & tests/

After the recent reverts, we now need to use the proper config.h in
examples/ and tests/ too.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoRevert "meson: revert to using the ccan configurator"
Jeremy Kerr [Thu, 21 Oct 2021 08:08:01 +0000 (16:08 +0800)]
Revert "meson: revert to using the ccan configurator"

We have a fix queued for the issue that the original revert is
working-around.

This also includes adjustments to the examples/ & tests/ meson
definitions to suit.

This reverts commit b66a139f12357757c54adf7f38031f0f9105c501.
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoRevert "src/Makefile: fix ccan config.h"
Jeremy Kerr [Thu, 21 Oct 2021 08:07:08 +0000 (16:07 +0800)]
Revert "src/Makefile: fix ccan config.h"

This reverts commit 859bd459dee308639eedb490d348d311dc08f859.

We have the proper fixes in progress, no need for the revert-workaround.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #78 from igaw/json-c.wrap
Daniel Wagner [Thu, 21 Oct 2021 07:30:11 +0000 (09:30 +0200)]
Merge pull request #78 from igaw/json-c.wrap

build: Add missing json-c.wrap

3 years agoMerge pull request #8 from birkelund/types
Daniel Wagner [Thu, 21 Oct 2021 07:19:38 +0000 (09:19 +0200)]
Merge pull request #8 from birkelund/types

Header cleanup (make nvme/types.h independent of Linux and usable without linking)

3 years agobuild: Add missing json-c.wrap
Daniel Wagner [Thu, 21 Oct 2021 07:16:58 +0000 (09:16 +0200)]
build: Add missing json-c.wrap

Commit 6af90f95fd1b ("build: Add fallback dependency for json-c") is
missing the wrap file.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #73 from martin-belanger/fix-python-dependency
Daniel Wagner [Thu, 21 Oct 2021 07:11:12 +0000 (09:11 +0200)]
Merge pull request #73 from martin-belanger/fix-python-dependency

Make Python Bindings optional

3 years agoMerge pull request #71 from martin-belanger/update-python-examples
Daniel Wagner [Thu, 21 Oct 2021 07:08:05 +0000 (09:08 +0200)]
Merge pull request #71 from martin-belanger/update-python-examples

[Python]: Fix inaccurate Python examples

3 years agoprivate.h: Add required includes
Jeremy Kerr [Wed, 20 Oct 2021 04:21:13 +0000 (12:21 +0800)]
private.h: Add required includes

In private.h, we use the list, nvme_fabrics_config and (optional) UUID
types, so add their appropriate #includes.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agotypes.h: heal -> health
Jeremy Kerr [Wed, 20 Oct 2021 03:59:03 +0000 (11:59 +0800)]
types.h: heal -> health

We currently have an abbreviation 'heal' in nvme_mi_ctrl_heal_status;
while the subsystem health status uses the full 'health'. This change
unifies these by using the full term instead of the abbreviation.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agotypes: remove endian/mmio helpers
Klaus Jensen [Wed, 29 Sep 2021 19:07:41 +0000 (21:07 +0200)]
types: remove endian/mmio helpers

The endian/mmio helpers do not belong in types.h.

Since we are already using ccan and have ccan/endian available, just
include that where needed. The implementation is 100% equivalent, even
with sparse annotations.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agolinux: move linux specific stuff from util.{c,h}
Klaus Jensen [Wed, 29 Sep 2021 18:20:23 +0000 (20:20 +0200)]
linux: move linux specific stuff from util.{c,h}

Add the nvme/linux.h header for Linux specific helpers. This leaves
util.{c,h} with only system-agnostic utilities.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agotypes: move the feature shift/masks from util.h
Klaus Jensen [Mon, 18 Oct 2021 18:48:48 +0000 (20:48 +0200)]
types: move the feature shift/masks from util.h

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agotypes: move command parameters from ioctl.h
Klaus Jensen [Wed, 29 Sep 2021 17:44:55 +0000 (19:44 +0200)]
types: move command parameters from ioctl.h

Move spec-defined command parameters out of nvme/ioctl.h and into
nvme/types.h. This allows third-party libraries and applications to use
the type definitions of libnvme without potentially clashing with
various function prototypes that are ioctl specific.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agomeson: revert to using the ccan configurator
Klaus Jensen [Tue, 19 Oct 2021 20:13:53 +0000 (22:13 +0200)]
meson: revert to using the ccan configurator

Something fishy is going on with the -include config.h and #include
"config.h" in the ccan sources. If examples/tests use ccan, they end up
with redefinitions caused by the ccan config defines not being properly set.

Revert to generating a ccan-specific config.h using the configurator (like the
Make-based setup).

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agosrc/Makefile: fix ccan config.h
Klaus Jensen [Tue, 19 Oct 2021 19:34:38 +0000 (21:34 +0200)]
src/Makefile: fix ccan config.h

The ccan/ccan-config.h generated by the ccan configurator is never read
by the ccan sources which expect config.h. Instead, because of -I.. in
src/Makefile, the ccan sources picks up the base config.h (as generated
by configure). All kinds of wrong since config.h should actually have
been config-host.h.

Fix the compiler args to not include the base directory and generate the
ccan config file as ccan/config.h. Rename ./config.h to ./config-host.h.

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years ago[Python]: Fix inaccurate Python examples
Martin Belanger [Tue, 19 Oct 2021 12:56:27 +0000 (08:56 -0400)]
[Python]: Fix inaccurate Python examples

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMake Python Bindings optional
Martin Belanger [Tue, 19 Oct 2021 18:34:03 +0000 (14:34 -0400)]
Make Python Bindings optional

Added a new configuration parameter "python". By default it is set to 'auto',
which means that the Python bindings will be built if all dependencies can be
found on the host. If not, Python bindings won;t be built. The option can
also be set to 'true' or 'false' to force Python bindings to be built or not.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #70 from igaw/fallback-json-c
Daniel Wagner [Tue, 19 Oct 2021 08:58:09 +0000 (10:58 +0200)]
Merge pull request #70 from igaw/fallback-json-c

build: Add fallback dependency for json-c

3 years agobuild: Add fallback dependency for json-c
Daniel Wagner [Tue, 19 Oct 2021 08:15:32 +0000 (10:15 +0200)]
build: Add fallback dependency for json-c

meson supports embedded library build. This is very handy for system
which ship outdated an really outdated json-c library.

The include path for json.h has to be adapted. The json-c upstream
project is not clear which include prefix should be used ('#include
<json-c/json.h>" vs '#include <json.h>'. In order to support embedded
builds, we need to use the second version of the include. The source
code is added to the build, hence we use the include directory path of
the project layout. And json-c has all include files in the root
directory. This is no problem when using a installed version of json-c
as pkg-config adds '-I/usr/inlude/json-c' to the include paths:

  $pkg-config --cflags json-c
  -I/usr/include/json-c

So the simplest thing to support both build cased (external/embedded)
just drop the include prefix.

While at it also fix the 'requires' argument which expects strings not
dependencies objects.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #68 from igaw/set-lib-version
Daniel Wagner [Tue, 19 Oct 2021 08:42:11 +0000 (10:42 +0200)]
Merge pull request #68 from igaw/set-lib-version

build: Split libtool versioning from project versioning

3 years agoMerge pull request #69 from birkelund/meson-fixes
Daniel Wagner [Tue, 19 Oct 2021 08:39:59 +0000 (10:39 +0200)]
Merge pull request #69 from birkelund/meson-fixes

meson fixes

Looks good to me. I'll update my PRs for my meson build fixes ontop of ours.

3 years agomeson: use library() and rely on user settings
Klaus Jensen [Mon, 18 Oct 2021 21:00:10 +0000 (23:00 +0200)]
meson: use library() and rely on user settings

There is no need to have both _static and _shared targets. Just use
library(). Project using libnvme as a subproject can now just set

  default_options: ['default_library=static']

in the subproject statement to choose the library version.

For pkgconfig, simplify and let the module figure out Libs and Requires.
This has the effect of removing Requires and making it a
Requires.private so we don't require libnvme consumers to link with
libuuid and json-c (unless they specifically needs to use it like
test/test.c).

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoupdate libnvme.map
Klaus Jensen [Mon, 18 Oct 2021 20:59:39 +0000 (22:59 +0200)]
update libnvme.map

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoMerge pull request #59 from martin-belanger/reowrk-python-exceptions
Hannes Reinecke [Mon, 18 Oct 2021 13:51:10 +0000 (15:51 +0200)]
Merge pull request #59 from martin-belanger/reowrk-python-exceptions

[Python]: Clean up exception handling

3 years agoMerge pull request #58 from martin-belanger/add-more-to-python
Hannes Reinecke [Mon, 18 Oct 2021 13:49:49 +0000 (15:49 +0200)]
Merge pull request #58 from martin-belanger/add-more-to-python

[Python]: Add set_persistent() and C definitions

3 years agoMerge pull request #67 from igaw/libjson-c-min-version
Daniel Wagner [Mon, 18 Oct 2021 12:26:32 +0000 (14:26 +0200)]
Merge pull request #67 from igaw/libjson-c-min-version

build: Set minimum version for json-c

3 years agobuild: Split libtool versioning from project versioning
Daniel Wagner [Mon, 18 Oct 2021 11:58:53 +0000 (13:58 +0200)]
build: Split libtool versioning from project versioning

As described in GNU autotools manuals, libtool versioning is not the
same as the project versioning.

The project versioning string is defined in project_version. meson
uses this string for all operations such a creating the tarball. I
decided against using something fancy as 'git describe' for it,
because meson is not supporting this kind of dynamic project
versioning.

Instead we just need to increment the version after the release and
before the first commit. With this scheme we basically know by looking
at the version string if it is an official released version. If this
is not good enough we can try to adopt the approach other project are
doing such as systemd which introduced an additional package
versioning which depends on 'git describe'.

There is little point in fighting the tool if it can be done quite
easily by the described approach from above.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #66 from jk-ozlabs/fixes
Daniel Wagner [Mon, 18 Oct 2021 09:39:03 +0000 (11:39 +0200)]
Merge pull request #66 from jk-ozlabs/fixes

log: we use bool, so include stdbool.h

3 years agobuild: Set minimum version for json-c
Daniel Wagner [Mon, 18 Oct 2021 09:24:34 +0000 (11:24 +0200)]
build: Set minimum version for json-c

Set minimum version for json-c to 0.13.

libnvme uses json_util_get_last_err() which got introduced in 0.13,
released in December 2017.

While at it, drop the cc.find_library() lookup logic. First, we don't
do this for libuuid and second, dependency() is using pkg-config to
figure out the dependency, thus we can set the minimum version
number. Instead, cc.find_library() will try to link a test program
with '-libjson-c' and have no way to figure out which version it
actually is. Avoid any confusion and make the meson.build script
simpler.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolog: we use bool, so include stdbool.h
Jeremy Kerr [Fri, 6 Aug 2021 03:40:47 +0000 (11:40 +0800)]
log: we use bool, so include stdbool.h

The log headers use the bool type, so add an include for stdbool.h,
rather than requiring the includer to do so.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoMerge pull request #64 from igaw/meson-subproject
Daniel Wagner [Tue, 12 Oct 2021 15:27:16 +0000 (17:27 +0200)]
Merge pull request #64 from igaw/meson-subproject

build: Allow subproject meson builds

3 years agobuild: Allow subproject meson builds
Daniel Wagner [Tue, 12 Oct 2021 15:18:48 +0000 (17:18 +0200)]
build: Allow subproject meson builds

meson has a very fancy feature called subproject. This allows bundle
third party libraries in a project. In order to be able to use this
for nvme-cli we need to drop all global config settings and declare
all dependencies.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoExpose C enums and #defines in Python module.
Martin Belanger [Mon, 11 Oct 2021 19:50:23 +0000 (15:50 -0400)]
Expose C enums and #defines in Python module.
Add persistent_set() method to the Python nvme_ctrl class.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agoMerge pull request #63 from igaw/remove-systemd-dep
Hannes Reinecke [Tue, 12 Oct 2021 12:48:13 +0000 (14:48 +0200)]
Merge pull request #63 from igaw/remove-systemd-dep

fabrics: Remove 'UUID derived from machine-id' feature

3 years agofabrics: Remove 'UUID derived from machine-id' feature
Daniel Wagner [Tue, 12 Oct 2021 12:26:57 +0000 (14:26 +0200)]
fabrics: Remove 'UUID derived from machine-id' feature

Commit 3e0520ecad13 ("Read system UUID from DMI and merge hostnqn
generation functions") in nvme-cli introduced the feature to create
the UUID derived from machine-id using the systemd's
sd_id128_get_machine_app_specific function. This adds many library
dependencies to libnvme.

The feature is not really necessary as we have nvme-gen-hostnqn
already in place. So drop the feature entirely.

If the feature needs to be added back, it's probably better to
reimplement this function (e.g. move the hmac_sha256 function from
nvme-cli and use this to derive the UUID from machine-id).

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #56 from igaw/meson-ci
Daniel Wagner [Tue, 12 Oct 2021 09:35:30 +0000 (11:35 +0200)]
Merge pull request #56 from igaw/meson-ci

build: Add meson CI workflow

3 years agoMerge pull request #61 from jk-ozlabs/cross
Daniel Wagner [Tue, 12 Oct 2021 09:34:34 +0000 (11:34 +0200)]
Merge pull request #61 from jk-ozlabs/cross

Support for cross-compiling libnvme

3 years agoMerge pull request #55 from igaw/fix-uuid-read-overflow
Hannes Reinecke [Tue, 12 Oct 2021 09:33:09 +0000 (11:33 +0200)]
Merge pull request #55 from igaw/fix-uuid-read-overflow

fabrics: Do not overflow when reading systemd_uuid

3 years agopynvme: Make swig optional & python bindings conditional on swig
Jeremy Kerr [Tue, 12 Oct 2021 07:24:38 +0000 (15:24 +0800)]
pynvme: Make swig optional & python bindings conditional on swig

We may not need have a python environment for some targets; make the
python bindings optional.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoUnify configuration includes, use meson-generated configuration data
Jeremy Kerr [Tue, 12 Oct 2021 06:42:28 +0000 (14:42 +0800)]
Unify configuration includes, use meson-generated configuration data

Currently, we have two separate configuration includes: ccan/config.h
and config-host.h. The first is generated by the ccan configurator, the
second by the configuration step (either ./configure, or meson).

This change unifies these into a top-level config.h include.

For the meson case, we can use the meson configuration file to provide
all data. For the configure case, we still use the ccan configurator,
but include the resulting file from the top-level config.h

This allows us to cross-compile with meson.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agomeson.build: Add ccan-required configuration macros
Jeremy Kerr [Tue, 12 Oct 2021 04:10:54 +0000 (12:10 +0800)]
meson.build: Add ccan-required configuration macros

This implements meson-native tests for the conditionals required by
ccan.

Queried via:

  git grep -oh 'HAVE_\w\+' ccan/ccan/ | sort -u

These are all build-time-only tests, so will work fine while
cross-compiling.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoconfigure: simplify config-host.h & config-host.mak generation
Jeremy Kerr [Tue, 12 Oct 2021 06:52:03 +0000 (14:52 +0800)]
configure: simplify config-host.h & config-host.mak generation

Create the configuration files using a here-string, rather than separate
commands.

While we're at it, fix the configure-command-line formatting in the .h
header.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
3 years agoClean up Python exception handling
Martin Belanger [Mon, 11 Oct 2021 20:09:49 +0000 (16:09 -0400)]
Clean up Python exception handling

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
3 years agofabrics: Do not overflow when reading systemd_uuid
Daniel Wagner [Mon, 11 Oct 2021 09:57:09 +0000 (11:57 +0200)]
fabrics: Do not overflow when reading systemd_uuid

gcc complains with:

../src/nvme/fabrics.c:774:15: warning: ‘read’ writing 512 bytes into a region of size 37 overflows the destination [-Wstringop-overflow=]
  774 |         len = read(f, system_uuid, 512);
      |               ^~~~~~~~~~~~~~~~~~~~~~~~~
../src/nvme/fabrics.c: In function ‘nvmf_hostnqn_generate’:
../src/nvme/fabrics.c:863:14: note: destination object ‘uuid_str’ of size 37
  863 |         char uuid_str[37]; /* e.g. 1b4e28ba-2fa1-11d2-883f-0016d3cca427 + \0 */
      |              ^~~~~~~~

Let's limit the read to 37 as we know that's the max size for a UUID.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agobuild: Add meson CI workflow
Daniel Wagner [Mon, 11 Oct 2021 10:10:15 +0000 (12:10 +0200)]
build: Add meson CI workflow

Based on https://github.com/marketplace/actions/meson-build

resolves: #54

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #53 from hreinecke/meson-fix
Hannes Reinecke [Sat, 9 Oct 2021 11:21:17 +0000 (13:21 +0200)]
Merge pull request #53 from hreinecke/meson-fix

Fix version number for meson build

3 years agoFix version number for meson build
Hannes Reinecke [Fri, 8 Oct 2021 16:05:21 +0000 (18:05 +0200)]
Fix version number for meson build

The shared library has the version number '1.0.1', not '0.1'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #50 from hreinecke/csi
Daniel Wagner [Fri, 8 Oct 2021 15:47:30 +0000 (17:47 +0200)]
Merge pull request #50 from hreinecke/csi

Add nvme_identify_active_ns_list_csi() and nvme_identify_allocated_ns…

3 years agoMerge pull request #48 from hreinecke/dump-config
Daniel Wagner [Fri, 8 Oct 2021 15:45:01 +0000 (17:45 +0200)]
Merge pull request #48 from hreinecke/dump-config

Add 'nvme_dump_config()' function

3 years agoMerge pull request #47 from hreinecke/cleanup-sym
Daniel Wagner [Fri, 8 Oct 2021 15:43:06 +0000 (17:43 +0200)]
Merge pull request #47 from hreinecke/cleanup-sym

Cleanup exported symbols

3 years agoMerge pull request #52 from igaw/build-meson
Daniel Wagner [Fri, 8 Oct 2021 15:29:45 +0000 (17:29 +0200)]
Merge pull request #52 from igaw/build-meson

build: Add support for meson build system

3 years agobuild: Add support for meson build system
Martin Belanger [Thu, 7 Oct 2021 00:39:55 +0000 (20:39 -0400)]
build: Add support for meson build system

[dwagner: updated README.md]
Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoAdd nvme_identify_active_ns_list_csi() and nvme_identify_allocated_ns_list_csi()
Hannes Reinecke [Thu, 7 Oct 2021 09:51:36 +0000 (11:51 +0200)]
Add nvme_identify_active_ns_list_csi() and nvme_identify_allocated_ns_list_csi()

Update the command IDs with the values from NVMe base spec v2.0 and
implement the missing nvme_identify_active_ns_list_csi() and
nvme_identify_allocated_ns_list_csi().

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #49 from linux-nvme/hreinecke-workflow
Hannes Reinecke [Fri, 8 Oct 2021 13:01:46 +0000 (15:01 +0200)]
Merge pull request #49 from linux-nvme/hreinecke-workflow

Create github CI workflow

3 years agoCreate make.yml
Hannes Reinecke [Fri, 8 Oct 2021 11:36:42 +0000 (13:36 +0200)]
Create make.yml

3 years agotree: add nvme_dump_config()
Hannes Reinecke [Thu, 30 Sep 2021 09:45:43 +0000 (11:45 +0200)]
tree: add nvme_dump_config()

Add nvme_dump_config() to print out the current tree to stdout.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agojson: allow 'NULL' argument to json_update_config()
Hannes Reinecke [Thu, 30 Sep 2021 09:42:37 +0000 (11:42 +0200)]
json: allow 'NULL' argument to json_update_config()

Allow a 'NULL' argument to json_update_config() to indicate that
the contents should be written to stdout.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: make nvme_init_ctrl() an internal symbol
Hannes Reinecke [Thu, 30 Sep 2021 09:16:39 +0000 (11:16 +0200)]
tree: make nvme_init_ctrl() an internal symbol

nvme_init_ctrl() should not be exported, so move it to private.h
to indicate it's an internal symbol.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofabrics: make uuid_from_device_tree and uuid_from_dmi static
Hannes Reinecke [Thu, 30 Sep 2021 08:24:09 +0000 (10:24 +0200)]
fabrics: make uuid_from_device_tree and uuid_from_dmi static

The functions are internal to fabrics.c, so mark them as 'static'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: remove nvme_ctrl_get_host{nqn,id}
Hannes Reinecke [Thu, 30 Sep 2021 08:48:28 +0000 (10:48 +0200)]
tree: remove nvme_ctrl_get_host{nqn,id}

No point in trying to fetch the host details from the controller;
if required the caller can walk up the chain directly.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoMerge pull request #45 from igaw/update-mapfile
Hannes Reinecke [Fri, 8 Oct 2021 11:05:20 +0000 (13:05 +0200)]
Merge pull request #45 from igaw/update-mapfile

libnvme.map: Add nvme_get_attr

3 years agoMerge pull request #46 from martin-belanger/fix-compiler-warning
Hannes Reinecke [Fri, 8 Oct 2021 11:03:59 +0000 (13:03 +0200)]
Merge pull request #46 from martin-belanger/fix-compiler-warning

Fix compiler warning.

3 years agoFix compiler warning.
Martin Belanger [Thu, 7 Oct 2021 16:36:11 +0000 (12:36 -0400)]
Fix compiler warning.

Signed-off-by: Martin Belanger martin_belanger@dell.com
3 years agolibnvme.map: Add nvme_get_attr
Daniel Wagner [Thu, 7 Oct 2021 15:42:50 +0000 (17:42 +0200)]
libnvme.map: Add nvme_get_attr

nvme_get_attr is missing in the export.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #42 from martin-belanger/scoped-ipv6
Hannes Reinecke [Thu, 7 Oct 2021 15:13:47 +0000 (17:13 +0200)]
Merge pull request #42 from martin-belanger/scoped-ipv6

Add support for scoped IPv6 in TRADDR

3 years agoAdd support for scoped IPv6
Martin Belanger [Wed, 6 Oct 2021 18:39:56 +0000 (14:39 -0400)]
Add support for scoped IPv6

3 years agoMerge pull request #33 from hreinecke/scanning
Hannes Reinecke [Wed, 6 Oct 2021 14:36:43 +0000 (16:36 +0200)]
Merge pull request #33 from hreinecke/scanning

Scanning fixes

3 years agoMerge pull request #39 from verschwindibussen/fix-shared-build
Hannes Reinecke [Wed, 6 Oct 2021 14:35:33 +0000 (16:35 +0200)]
Merge pull request #39 from verschwindibussen/fix-shared-build

Fix shared build

3 years agoMerge pull request #41 from birkelund/add-cap-css-csi
Keith Busch [Wed, 6 Oct 2021 11:18:25 +0000 (13:18 +0200)]
Merge pull request #41 from birkelund/add-cap-css-csi

types: add NVME_CAP_CSS_CSI

3 years agoMerge pull request #40 from metaspace/fix_csi_create
Keith Busch [Wed, 6 Oct 2021 11:07:23 +0000 (05:07 -0600)]
Merge pull request #40 from metaspace/fix_csi_create

Fix a bug where CSI was not passed to to nvme_ns_mgmt

3 years agotypes: add NVME_CAP_CSS_CSI
Klaus Jensen [Wed, 29 Sep 2021 12:23:02 +0000 (14:23 +0200)]
types: add NVME_CAP_CSS_CSI

Signed-off-by: Klaus Jensen <k.jensen@samsung.com>
3 years agoFix a bug where CSI was not passed to to nvme_ns_mgmt
Andreas Hindborg [Fri, 17 Sep 2021 14:21:28 +0000 (16:21 +0200)]
Fix a bug where CSI was not passed to to nvme_ns_mgmt

Signed-off-by: Andreas Hindborg <andreas.hindborg@wdc.com>