Package: libnvme
libnvmeThis is the libnvme development C library. libnvme provides type
definitions for NVMe specification structures, enumerations, and bit
fields, helper functions to construct, dispatch, and decode commands
and payloads, and utilities to connect, scan, and manage nvme devices
on a Linux system.The public specification is the authority to resolve any protocol
discrepancies with this library. For more info on NVM Express, please
see:https://nvmexpress.orgSubscribe tolinux-nvme@lists.infradead.orgfor linux-nvme related
discussions and development for both kernel and userspace. The list is
archived here:https://lists.infradead.org/mailman/listinfo/linux-nvmeLicenseExcept where otherwise stated, all software contained within this repo
is currently licensed LGPL-2.1-or-later, see COPYING for more
information.Keith Busch 2020-02-06Dependencylibnvme depends on minimum Linux kernel version v4.15, which
introduced the /sys/class/nvme-subsystem.Build from sourcePrerequisiteA minimal build depends on a set of build toolsgccninjamesonNot all feature will be present with such configuration, e.g.
the fabrics part of the library wont support authentication or
TLS over the nvme-tcp transport.To enable the optional features install following libraries`/etc/nvme/config.json`` support:json-c (recommend)Authentication and TLS over nvme-tcp:opensslkeyutilsEnd point discovery for MIlibdbusPython bindingsPython 3 interpreterPython 3 development librariesMinimal on embedded buildsThe reference implemention of the Meson specification is in Python 3. Installing
or porting this dependency is not really feasible for embedded project. Though
there are two project which implement the Ninja and the Meson API in pure C99samurai:https://github.com/michaelforney/samurai.gitmuon:https://git.sr.ht/~lattis/muonThe CI build helper scriptscripts/build.shis able to setup and build this
project in a minimal setup using samurai and muon and thus only depending on:gccmakegitscripts/build.sh -m muonTo compile libnvmeToconfigurethe project:meson setup .buildWhich will default to build a shared library. To configure for static libraries callmeson setup --default-library=static .buildOne nice feature of meson is that it doesn't mix build artifacts
(e.g.*.o,*.so, etc.) with source code. In the above example,
".build" is the name of the directory where the build configuration
as well as all the build artifacts will be saved. This directory can
be named anything as long as it's not an existing source directory. To
completely "clean" all the build artifacts, one need only delete the.builddirectory.To compile:meson compile -C .buildTo install libnvmeTo installlibnvme:meson install -C .buildTo run unit testsTo run unit tests:meson test -C .buildTo purge everythingTo completely clean all build artifacts, including the build configuration.rm -rf .buildSupported build optionsA few build options can be specified on the command line when invoking meson.OptionValues [default]Descriptionversion-tagnoneOverwrite the git version string in the binaryhtmldirnoneInstallation directory for the HTML documentationrstdirnoneInstallation directory for the RST documentationdocs[false], html, man, rst, allInstall documentationdocs-build[false], trueEnable build documentationpython[auto], enabled, disabledWhether to build the Python bindings. When set toauto, the default, meson will check for the presence of the  tools and libraries (e.g.swig) required to build the Python bindings. If found, meson will configure the project to build the Python bindings. If a tool or library is missing, then the Python bindings won't be built. Setting this toenabled, forces the Python bindings to be built. When set todisabled, meson will configure the project to not build the Python bindings.Example:meson setup .build -Dpython=disabledopenssl[auto], enabled, disabledEnables OpenSSL dependent features (e.g. TLS over TCP), adds build dependency on OpenSSLlibdbusauto, enabled, [disabled]Enables D-Bus dependent features (libnvme-mi: End point discovery), adds build dependency on libdbusjson-c[auto], enabled, disabled(recommended) Enables JSON-C dependend features (e.g. config.json parsing), adds build depdency on json-ckeyutils[auto], enabled, disabledEnables keyutils dependent features (e.g. authentication), adds build dependency on keyutilsSee the full configuration options withmesonconfigure.buildChanging the build options from the command-line (i.e. w/o modifying any files)To configure a build for debugging purposes (i.e. optimization turned
off and debug symbols enabled):mesonsetup.build--buildtype=debugTo enable address sanitizer (advanced debugging of memory issues):mesonsetup.build-Db_sanitize=addressThis option adds-fsanitize=addressto the gcc options. The tests can then be run normally (meson test -C .build).Note that when using the sanitize feature, the librarylibasan.somust be available and must be the very first library loaded when running an executable. If experiencing linking issues, you can ensure thatlibasan.sogets loaded first with theLD_PRELOADenvironment variable as follows:meson setup .build -Db_sanitize=address && LD_PRELOAD=/lib64/libasan.so.6 ninja -C .build testIt's also possible to enable the undefined behavior sanitizer with-Db_sanitize=undefined. To enable both, use-Db_sanitize=address,undefined.