Re: impossible to use <libzfs.h> out-of-tree
- Reply: Lexi Winter : "Re: impossible to use <libzfs.h> out-of-tree"
- In reply to: Lexi Winter : "impossible to use <libzfs.h> out-of-tree"
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Thu, 12 Jun 2025 03:13:08 UTC
On Wed, Jun 11, 2025 at 8:03 PM Lexi Winter <ivy@freebsd.org> wrote: > hello, > > i'm writing an application which wants to interact with ZFS filesystems, > so i thought i would use libzfs via <libzfs.h>. however, <libzfs.h> > includes <libshare.h>, which exists in src but is not installed. > > this means that nothing can use <libzfs.h>, so it should not be > installed; this is a bug, we should not install <libzfs.h> if it > cannot be used. > > but does this mean we have no way for out-of-tree utilities to interact > with ZFS except by calling "/sbin/zfs" and parsing the output? > > tested on 15.0-CURRENT, commit ~a5fe142e084. > libzfs is unstable, and out-of-tree utilities should avoid using it, if possible. If an out-of-tree utility links to it, then that utility might break as a result of an OS upgrade, even a minor one. But all hope is not lost! libzfs_core is stable, and its use is encouraged. See /usr/include/libzfs_core.h . It can do most of the stuff that libzfs can do, but the API is guaranteed to be stable. You should use that, if possible. If you really must use libzfs.h, then we should install libshare.h. It used to be the case that all of the necessary headers were installed. This is probably a recent regression.