]> www.infradead.org Git - users/sagi/libnvme.git/log
users/sagi/libnvme.git
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 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>
3 years agofabrics: restore hostname traddr support
Sagi Grimberg [Sun, 26 Sep 2021 18:29:32 +0000 (21:29 +0300)]
fabrics: restore hostname traddr support

We used to support hostname passed in traddr, with the move of nvme-cli
to use libnvme we lost this capability, now lets restore it.

Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
3 years agoMakefile: Install log.h header file
Daniel Wagner [Mon, 27 Sep 2021 13:36:58 +0000 (15:36 +0200)]
Makefile: Install log.h header file

Add the missing nvme/log.h header file.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolibnvme.map: Add missing exports for nvme-cli
Daniel Wagner [Mon, 27 Sep 2021 13:29:56 +0000 (15:29 +0200)]
libnvme.map: Add missing exports for nvme-cli

When building nvme-cli with a shared library a few symbols where
missing in the export list. Let's export the missing symbols.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agolibnvme.map: Sort global export section
Daniel Wagner [Mon, 27 Sep 2021 13:27:38 +0000 (15:27 +0200)]
libnvme.map: Sort global export section

Sort the global section so that we when new entries are inserted they
are in the correct position.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #38 from metaspace/nvme-iocs-wrong-cns
Keith Busch [Wed, 22 Sep 2021 21:12:56 +0000 (15:12 -0600)]
Merge pull request #38 from metaspace/nvme-iocs-wrong-cns

Fix bug in `nvme_identify_iocs`

3 years agoFix bug in `nvme_identify_iocs`
Andreas Hindborg [Wed, 22 Sep 2021 11:08:22 +0000 (13:08 +0200)]
Fix bug in `nvme_identify_iocs`

This patch fixes a bug in `nvme_identify_iocs` where the wrong CNS value used in
the Identify Command data structure.

Signed-off-by: Andreas Hindborg <andreas.hindborg@wdc.com>
3 years agoMerge pull request #37 from verschwindibussen/install-pynvme
Keith Busch [Tue, 21 Sep 2021 18:54:04 +0000 (12:54 -0600)]
Merge pull request #37 from verschwindibussen/install-pynvme

pynvme: Add install target to Makefile

3 years agopynvme: Add install target to Makefile
Daniel Wagner [Tue, 21 Sep 2021 11:55:16 +0000 (13:55 +0200)]
pynvme: Add install target to Makefile

Use setup.py to install the binding to the sitearch.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #36 from verschwindibussen/refactor-uuid_from_device_tree
Keith Busch [Tue, 21 Sep 2021 14:41:22 +0000 (08:41 -0600)]
Merge pull request #36 from verschwindibussen/refactor-uuid_from_device_tree

fabrics: Refactor uuid_from_device_tree

3 years agofabrics: Refactor uuid_from_device_tree
Daniel Wagner [Tue, 21 Sep 2021 07:03:06 +0000 (09:03 +0200)]
fabrics: Refactor uuid_from_device_tree

The recently added uuid_from_device_tree function can be refactored by
minimizing use of local variables and early returns in error
handling. No functional change.

Signed-off-by: Daniel Wagner <dwagner@suse.de>
3 years agoMerge pull request #34 from wxiong38/hostnqn_uuid_ibm
Keith Busch [Wed, 15 Sep 2021 17:50:01 +0000 (11:50 -0600)]
Merge pull request #34 from wxiong38/hostnqn_uuid_ibm

nvme-cli: nvme gen-hostnqn use partition UUID on IBM POWER

3 years agonvme-cli: nvme gen-hostnqn use partition UUID on IBM
root [Wed, 15 Sep 2021 15:24:42 +0000 (11:24 -0400)]
nvme-cli: nvme gen-hostnqn use partition UUID on IBM

IBM POWER systems expose a platform created UUID in the device
tree. Use that as the UUID in the host NQN

Signed-Off-by: Wen Xiong <wenxiong@linux.vnet.ibm.com>
Reviewed-by: Brian King <brking@linux.vnet.ibm.com>
3 years agotree: rework ctrl address generation
Hannes Reinecke [Mon, 13 Sep 2021 08:22:15 +0000 (10:22 +0200)]
tree: rework ctrl address generation

Older kernel do not display an 'address' sysfs attribute for pcie
controllers, so we need to infer it from the sysfs path itself.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: set default ANA state to 'optimized'
Hannes Reinecke [Mon, 13 Sep 2021 08:23:53 +0000 (10:23 +0200)]
tree: set default ANA state to 'optimized'

Older kernels do not provide an ANA state attribute, so always display
'optimized' here.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: free 'subsysnqn'
Hannes Reinecke [Mon, 13 Sep 2021 08:24:50 +0000 (10:24 +0200)]
tree: free 'subsysnqn'

Valgrind complained.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: better logging output
Hannes Reinecke [Mon, 13 Sep 2021 08:18:07 +0000 (10:18 +0200)]
tree: better logging output

Add logging messages when scan fails, and remove the logging from
failure to read the individual attributes.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agotree: fixup crash on pcie controller for older kernels
Hannes Reinecke [Fri, 10 Sep 2021 16:06:03 +0000 (18:06 +0200)]
tree: fixup crash on pcie controller for older kernels

Older kernels do not provide an 'address' sysfs entry for 'pcie'
controllers, causing a crash during scanning.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agoexamples,test: depend on libnvme.a
Hannes Reinecke [Fri, 10 Sep 2021 12:50:12 +0000 (14:50 +0200)]
examples,test: depend on libnvme.a

When libnvme is changed we should be rebuilding the example and test
programs, too, to build them against the updated libnvme.

Signed-off-by: Hannes Reinecke <hare@suse.de>
3 years agofix path->nentry bugs
chengjike [Thu, 9 Sep 2021 14:57:09 +0000 (22:57 +0800)]
fix path->nentry bugs

The "path->nentry" is initialized after it is added to the list in
"nvme_subsystem_set_path_ns" function.

Signed-off-by: chengjike <chengjike.cheng@huawei.com>
3 years agoRevert "tree: rework topology for multiple hosts"
Keith Busch [Thu, 2 Sep 2021 16:53:29 +0000 (09:53 -0700)]
Revert "tree: rework topology for multiple hosts"

The hosts check breaks pci

This reverts commit aad3881a446560e6add56202e8029183d5dd825d.

Link: https://github.com/linux-nvme/libnvme/issues/32
Signed-off-by: Keith Busch <kbusch@kernel.org>
3 years agoMerge pull request #31 from martin-belanger/fix-compilation-warning
Keith Busch [Mon, 23 Aug 2021 18:34:41 +0000 (12:34 -0600)]
Merge pull request #31 from martin-belanger/fix-compilation-warning

Allow control objects to be deleted.

3 years agoUn-stub nvme_free_ctrl(). In other words, nvme_free_ctrl() will now properly delete...
Martin Belanger [Mon, 23 Aug 2021 17:52:38 +0000 (13:52 -0400)]
Un-stub nvme_free_ctrl(). In other words, nvme_free_ctrl() will now properly delete ctrl objects

3 years agoMerge pull request #30 from martin-belanger/fix-compilation-warning
Keith Busch [Thu, 19 Aug 2021 21:00:36 +0000 (15:00 -0600)]
Merge pull request #30 from martin-belanger/fix-compilation-warning

Fix memory leaks and double free

3 years agoFix memory leaks and double free
Martin Belanger [Thu, 19 Aug 2021 19:51:34 +0000 (15:51 -0400)]
Fix memory leaks and double free

4 years agoMerge pull request #28 from hreinecke/topology
Keith Busch [Fri, 13 Aug 2021 16:07:04 +0000 (10:07 -0600)]
Merge pull request #28 from hreinecke/topology

tree: rework topology for multiple hosts

4 years agoMerge pull request #29 from martin-belanger/fix-compilation-warning
Keith Busch [Fri, 13 Aug 2021 16:06:21 +0000 (10:06 -0600)]
Merge pull request #29 from martin-belanger/fix-compilation-warning

Fix compiler warning

4 years agoFix compiler warning
Martin Belanger [Fri, 13 Aug 2021 13:08:26 +0000 (09:08 -0400)]
Fix compiler warning

4 years agoprivate.h: drop 'hostid' and 'hostnqn' from nvme_ctrl_t
Hannes Reinecke [Fri, 13 Aug 2021 10:33:17 +0000 (12:33 +0200)]
private.h: drop 'hostid' and 'hostnqn' from nvme_ctrl_t

Never referenced anywhere.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agosrc/Makefile: fixup depencendy for private.h
Hannes Reinecke [Fri, 13 Aug 2021 10:28:27 +0000 (12:28 +0200)]
src/Makefile: fixup depencendy for private.h

The Makefile references 'private.h' as 'libnvme_priv', not
'libnvme_private'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: rework topology for multiple hosts
Hannes Reinecke [Fri, 13 Aug 2021 09:58:08 +0000 (11:58 +0200)]
tree: rework topology for multiple hosts

Our tree structure host->subsys->ctrl doesn't match the underlying
topology; the subsystem actually just a container for controllers,
and the hosts are specified on the controller level, not the subsystem
level.
So to flatten that into our tree structure we need to duplicate the
subsystem objects for each host, and filter out the controllers such
that only the controllers with the correct hostnqn will show up
in our internal tree.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agoMerge pull request #27 from martin-belanger/fix-empty-model
Keith Busch [Thu, 12 Aug 2021 19:58:57 +0000 (13:58 -0600)]
Merge pull request #27 from martin-belanger/fix-empty-model

Default empty model attribute to 'undefined'

4 years agoDefault empty model attribute to 'undefined'
Martin Belanger [Thu, 12 Aug 2021 19:52:30 +0000 (15:52 -0400)]
Default empty model attribute to 'undefined'

4 years agoMerge pull request #26 from hreinecke/discovery-fixes
Keith Busch [Thu, 12 Aug 2021 15:46:12 +0000 (09:46 -0600)]
Merge pull request #26 from hreinecke/discovery-fixes

Discovery fixes

4 years agotree.h: remove stale declaration of nvme_ctrl_get_nqn()
Hannes Reinecke [Thu, 12 Aug 2021 06:26:41 +0000 (08:26 +0200)]
tree.h: remove stale declaration of nvme_ctrl_get_nqn()

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agojson: use nvme_msg() instead of fprintf()
Hannes Reinecke [Wed, 11 Aug 2021 08:59:42 +0000 (10:59 +0200)]
json: use nvme_msg() instead of fprintf()

Use nvme logging to make error output configurable.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: set errno in nvme_create_ctrl()
Hannes Reinecke [Thu, 12 Aug 2021 06:25:45 +0000 (08:25 +0200)]
tree: set errno in nvme_create_ctrl()

There is no reason why we shouldn't be setting errno in
nvme_create_ctrl(); in fact, doing so will help with debugging.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agofabrics: add nvme_host_t as argument to build_options()
Hannes Reinecke [Thu, 12 Aug 2021 09:29:25 +0000 (11:29 +0200)]
fabrics: add nvme_host_t as argument to build_options()

build_options() can be called when the controller hasn't been
instantiated; in that case the 'subsystem' link in the controller
is empty, and there is no host associated with it.
Rather than selecting the default nvme host (and thereby losing
any different hostnqn settings which might have passed in from
the commandline) we should be passing in the nvme host directly
as argument to build_options().

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: avoid crash on unset subsystem in nvme_ctrl_get_host{nqn,id}
Hannes Reinecke [Thu, 12 Aug 2021 09:28:31 +0000 (11:28 +0200)]
tree: avoid crash on unset subsystem in nvme_ctrl_get_host{nqn,id}

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agoMerge pull request #15 from jk-ozlabs/fixes
Keith Busch [Fri, 6 Aug 2021 19:34:08 +0000 (13:34 -0600)]
Merge pull request #15 from jk-ozlabs/fixes

Minor fixes for a couple of compilation failures

4 years agoioctl: Fix incorrect cdw initialisation in nvme_set_features
Jeremy Kerr [Mon, 2 Aug 2021 05:50:16 +0000 (13:50 +0800)]
ioctl: Fix incorrect cdw initialisation in nvme_set_features

We're not currently setting cdw15 in nvme_set_features due to a typo in
the struct initialisation. This change fixes the init.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>
4 years agoBuild c++ objects with c++ compiler
Jeremy Kerr [Thu, 8 Jul 2021 04:46:43 +0000 (12:46 +0800)]
Build c++ objects with c++ compiler

We should use $(CXX) when building objects from .cc sources

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
4 years agoSeparate libs from link flags to fix link-order compile failure
Jeremy Kerr [Thu, 1 Jul 2021 06:26:57 +0000 (14:26 +0800)]
Separate libs from link flags to fix link-order compile failure

Currently, builds fail for me with a link error:

  /usr/bin/ld: ../src//libnvme.a(tree.ol): in function `nvme_ns_get_uuid':
  src/nvme/tree.c:1321: undefined reference to `uuid_copy'
  /usr/bin/ld: ../src//libnvme.a(json.ol): in function `json_read_config':
  src/nvme/json.c:152: undefined reference to `json_object_from_file'

Turns out my linker ("GNU ld (GNU Binutils for Debian) 2.35.2") is
sensitive to object argument order - the dependent libs need to be listed
last.

This change splits the required libraries into a LIBS variable, used
last on the Makefile rules to perform the link.

Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>
4 years agoMerge pull request #24 from tbzatek/docs-updates-2
Keith Busch [Tue, 3 Aug 2021 17:24:18 +0000 (11:24 -0600)]
Merge pull request #24 from tbzatek/docs-updates-2

types: Device self-test doc strings update

4 years agotypes: Device self-test doc strings update
Tomas Bzatek [Tue, 3 Aug 2021 16:29:53 +0000 (18:29 +0200)]
types: Device self-test doc strings update

Doc strings update related to the device self-test log page
retrieval and the self-test command issue.

API changes:
 * renamed NVME_ST_CODE_RESRVED -> NVME_ST_CODE_RESERVED
 * added enum nvme_st_curr_op definiton

4 years agoMerge pull request #21 from martin-belanger/move-python-to-separate-dir
Keith Busch [Fri, 30 Jul 2021 14:52:57 +0000 (08:52 -0600)]
Merge pull request #21 from martin-belanger/move-python-to-separate-dir

Move python bindings to a separate directory (pynvme)

4 years agoMerge latest changes from master branch
Martin Belanger [Fri, 23 Jul 2021 19:39:29 +0000 (15:39 -0400)]
Merge latest changes from master branch

4 years agoBug fix in Python SWIG module
Martin Belanger [Fri, 23 Jul 2021 19:35:17 +0000 (15:35 -0400)]
Bug fix in Python SWIG module

4 years agoMerge pull request #20 from tbzatek/json-c-build-fixes
Keith Busch [Fri, 23 Jul 2021 15:47:31 +0000 (09:47 -0600)]
Merge pull request #20 from tbzatek/json-c-build-fixes

build: Fix build without json-c

4 years agoMerge pull request #19 from tbzatek/status-to-string
Keith Busch [Fri, 23 Jul 2021 15:19:01 +0000 (09:19 -0600)]
Merge pull request #19 from tbzatek/status-to-string

Add new status codes, add nvme_status_to_string()

4 years agobuild: Fix build without json-c
Tomas Bzatek [Fri, 23 Jul 2021 14:16:47 +0000 (16:16 +0200)]
build: Fix build without json-c

4 years agoutil: Add strings for new status codes
Tomas Bzatek [Fri, 23 Jul 2021 14:03:02 +0000 (16:03 +0200)]
util: Add strings for new status codes

4 years agotypes: Add new status codes
Tomas Bzatek [Fri, 23 Jul 2021 14:01:15 +0000 (16:01 +0200)]
types: Add new status codes

Sync with nvme-cli master, doc strings updates.

4 years agoutil: Add nvme_status_to_string()
Tomas Bzatek [Thu, 22 Jul 2021 14:42:51 +0000 (16:42 +0200)]
util: Add nvme_status_to_string()

Taken from nvme-cli/libnvme-int-3.4.2021 branch,
commit 70b9835a9dace56557acc5ed10fd4c77ac063238.

4 years agoadd README file for python bindings
Martin Belanger [Fri, 16 Jul 2021 13:08:31 +0000 (09:08 -0400)]
add README file for python bindings

4 years agoMove 'Python bindings' SWIG and Makefile to 'pynvme' directory
Martin Belanger [Wed, 14 Jul 2021 17:49:59 +0000 (13:49 -0400)]
Move 'Python bindings' SWIG and Makefile to 'pynvme' directory

4 years agorename Python class names using SWIG's %rename
Martin Belanger [Wed, 14 Jul 2021 15:10:47 +0000 (11:10 -0400)]
rename Python class names using SWIG's %rename

4 years agofix memory leak
Martin Belanger [Wed, 14 Jul 2021 14:51:52 +0000 (10:51 -0400)]
fix memory leak

4 years agoMerge branch 'logging.v2' of https://github.com/hreinecke/libnvme
Martin Belanger [Wed, 14 Jul 2021 14:05:04 +0000 (10:05 -0400)]
Merge branch 'logging.v2' of https://github.com/hreinecke/libnvme

4 years agore-arm discovery AEN
Keith Busch [Fri, 9 Jul 2021 15:19:17 +0000 (08:19 -0700)]
re-arm discovery AEN

Ensure that the discovery AEN is unmasked by clearing RAE on the last
read of the full discovery log page.

Link: https://github.com/linux-nvme/libnvme/issues/17
Signed-off-by: Keith Busch <kbusch@kernel.org>
4 years agofabrics: Remove trailing newline from debugging messages
Martin Belanger [Sat, 26 Jun 2021 12:02:25 +0000 (14:02 +0200)]
fabrics: Remove trailing newline from debugging messages

The debugging messages in __nvmf_add_ctrl() contained newlines,
making for an improper formatted message.

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
4 years agoMakefile: fix libnvme_wrap targets
Martin Belanger [Sat, 26 Jun 2021 11:58:41 +0000 (13:58 +0200)]
Makefile: fix libnvme_wrap targets

Signed-off-by: Martin Belanger <martin.belanger@dell.com>
4 years agotree: do not free 'path' in nvme_init_ctrl()
Hannes Reinecke [Sat, 26 Jun 2021 11:46:22 +0000 (13:46 +0200)]
tree: do not free 'path' in nvme_init_ctrl()

After nvme_configure_ctrl() completes successfully we must not
free the 'path' argument as control has been transferred to the
controller structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: implement nvme_deconfigure_ctrl()
Hannes Reinecke [Sat, 26 Jun 2021 11:09:14 +0000 (13:09 +0200)]
tree: implement nvme_deconfigure_ctrl()

Separate out nvme_deconfigure_ctrl() from nvme_disconnect_ctrl()
to make it symmetric with nvme_configure_ctrl().

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: rename __nvme_init_ctrl() to nvme_configure_ctrl()
Hannes Reinecke [Sat, 26 Jun 2021 11:08:29 +0000 (13:08 +0200)]
tree: rename __nvme_init_ctrl() to nvme_configure_ctrl()

To clarify the intent on the function, and reduce confusion between
nvme_ctrl_init() and __nvme_init_ctrl().

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: use 'stat' to lookup nvme controller
Hannes Reinecke [Sat, 26 Jun 2021 11:05:10 +0000 (13:05 +0200)]
tree: use 'stat' to lookup nvme controller

When looking up nvme subsystems for individual controllers we should
be using 'stat()' instead of 'opendir()'; this is less heavy-handed
and provides better error checking.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: add error logging when failing to lookup subsystem name
Hannes Reinecke [Thu, 24 Jun 2021 14:28:52 +0000 (16:28 +0200)]
tree: add error logging when failing to lookup subsystem name

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agolibnvme.i: add a 'log_level' function to nvme_root object
Hannes Reinecke [Thu, 24 Jun 2021 07:20:25 +0000 (09:20 +0200)]
libnvme.i: add a 'log_level' function to nvme_root object

Add a 'log_level' function to the nvme_root object to allow to
increase the logging level of the libnvme library.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agolibnvme.i: display last error message on connect()
Hannes Reinecke [Thu, 24 Jun 2021 06:28:09 +0000 (08:28 +0200)]
libnvme.i: display last error message on connect()

Instead of displaying just a generic 'connect failed' message
we should be using nvme_log_message to display the most recent
failure message to the user.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agolog: export last error message
Hannes Reinecke [Thu, 24 Jun 2021 06:26:46 +0000 (08:26 +0200)]
log: export last error message

Add a static string 'nvme_log_message' containing the last error
message written out by 'nvme_msg'.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agoMerge pull request #14 from hreinecke/realloc
Keith Busch [Wed, 23 Jun 2021 14:16:48 +0000 (08:16 -0600)]
Merge pull request #14 from hreinecke/realloc

Rework tree reallocation

4 years agotree: rework topology deallocation
Hannes Reinecke [Wed, 23 Jun 2021 09:51:10 +0000 (11:51 +0200)]
tree: rework topology deallocation

The original idea of implementing a simple refcount doesn't really
work out, as refcounting is everything but.
And especially when used with the SWIG bindings it's not easy to
figure if and when a refcount needs to be released.
So kill the entire refcounting and free the internal structure
only when calling nvme_free_tree(); the object-dependent functions
like nvme_free_subsystem() etc now merely become stubs for
symmetry and to keep SWIG happy.
That removes the need for refcounting at all as the tree
and its contents will always be available, and a call to
nvme_free_tree() will clear the entire structure.

Signed-off-by: Hannes Reinecke <hare@suse.de>
4 years agotree: initialize all lists
Hannes Reinecke [Wed, 23 Jun 2021 07:43:07 +0000 (09:43 +0200)]
tree: initialize all lists

As otherwise python will crash horribly.

Signed-off-by: Hannes Reinecke <hare@suse.de>