libnvme v2
Daniel Wagner
dwagner at suse.de
Wed Jul 9 06:24:00 PDT 2025
I've started working on v2 of the library. There are several reasons why
I think it's time for a major update.
libnvme added the MI APIs after the initial v1 release. The v1 APIs use
file descriptors as "handles," which do not work for MI (there are no
fds). So, the solution at the time was to duplicate a lot of APIs with a
different kind of "handle." The main issue here is the naming for the
new handle. I went with struct nvme_link, but I'm sure there are better
names. While I'm not keen on renaming (a hell of a lot of hacking), it's
better to have good name [1]. So let's start the bike-shedding.
Another API-breaking change is the introduction of struct nvme_root as
the top-level data structure everywhere. This allows us to store global
data—for example, logging, or the controller list for MI.
Next on the TODO list is changing the error handling. That is, drop the
POSIX-style error handling (return -1 and set errno) and just return the
error code directly.
Anyway, there's a first usable version:
https://github.com/nvme-experiments/libnvme/tree/libnvme2
https://github.com/nvme-experiments/nvme-cli/tree/nvme-cli3
Thanks,
Daniel
[1] https://github.com/linux-nvme/libnvme/issues/448#issuecomment-2915439618
More information about the Linux-nvme
mailing list