nvme-cli-sys 1.0.0

Low-level Rust bindings for Linux NVMe UAPI structures and ioctls.
Documentation

nvme-cli-sys

FFI binding library for nvme-cli.

Introduction

This repository contains two crates:

  • nvme-cli - Rust library to utilize the nvme-cli tool.
  • nvme-cli-sys - FFI bindings to the nvme-cli header files.

These crates were inspired by linux-nvme-sys which performed the same functionality as nvme-cli-sys. However, that project has not been updated since 2023 and does not provide a "frontend" library for utilizing the functionality in an idiomatic manner.

The nvme-cli-sys crate uses similar struct, const, and type definitions as the linux-nvme-sys source code generated by bindgen, but was done manually to split the content into modules reflecting the C header counterparts.

To use nvme-cli or nvme-cli-sys you will need the libnvme-dev and libjson-c-dev packages to be installed and their .so files to be visible to pkg-config and versions greater than or equal to 1.3.0 and 0.8 respectively.

Binding Generation

Instead of using bindgen on build, this crate generates the bindings statically and pushes them with each release. For library users, to regenerate the bindings you can use the generate_bindings.sh script. Below are commands to execute, assuming the current working directory is the root of the repository.

cd nvme-cli-sys
./util/generate_bindings.sh

This should update the bindings.rs file under nvme-cli-sys/src/bindings.rs.

[!note] This crate uses the nvme-cli-1.x branch from the nvme-cli repository. All bindings and usage of this crate will correspond to the v1.x versions of nvme-cli.