Please can we do something about programmatic interfaces to ZFS?

From: David Chisnall <theraven_at_FreeBSD.org>
Date: Mon, 01 Jul 2024 08:40:15 UTC
Hi,

Since updating to 15-CURRENT, I have been unable to get some existing code that used libzfs_core to take snapshots.  There are a lot of reasons that this could have broken and it’s hard to track it down:

 - We ship both libnv and libnvpair.  These define the same data structure but with different APIs and are incompatible.  I believe libnv can create the serialised data structures that the ZFS ioctls expect.
 - We don’t install headers for libnvpair or libzfs_core (or libzfs) and so any code using these has to either depend on things in the src tree (which depend on OpenSolaris headers that are incompatible with FreeBSD ones, so must be in separate compilation units) or provide its own definitions, which may get out of sync with the libraries.
 - We don’t provide any documentation of the underlying ZFS ioctls (and there is some code that suggests that these vary between platforms), and so the *only* API for interacting with ZFS is libzfs_core.
 - The APIs in libzfs_core are also poorly documented.

This makes it incredibly difficult to interact with ZFS via anything other than the `zfs` command-line tool.  When things break, I have no idea which of these layers caused the breakage.

David