diff options
author | Ryan Moeller <[email protected]> | 2020-07-06 14:57:24 -0400 |
---|---|---|
committer | GitHub <[email protected]> | 2020-07-06 11:57:24 -0700 |
commit | fb91f0367e91fb74a391f56d80fa3d3a9c6a2902 (patch) | |
tree | 1ca19c49ad65b9bd4db18faa1ab51e14b7f32697 /lib/libzfs | |
parent | cd32b4f5b79c97b293f7be3fe9ddfc9024f7d734 (diff) |
Add zpool_nextboot, move zfs_jail to libzfs.h
FreeBSD has a zfsbootcfg command that wants zpool_nextboot in libzfs.
Add the function to FreeBSD's libzfs_compat.c, and while here move
the prototype for zfs_jail out of param.h in FreeBSD's SPL and into
libzfs.h under an ifdef for FreeBSD, where the prototype for
zpool_nextboot joins it.
Reviewed-by: Brian Behlendorf <[email protected]>
Signed-off-by: Ryan Moeller <[email protected]>
Closes #10524
Diffstat (limited to 'lib/libzfs')
-rw-r--r-- | lib/libzfs/os/freebsd/libzfs_compat.c | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/libzfs/os/freebsd/libzfs_compat.c b/lib/libzfs/os/freebsd/libzfs_compat.c index 5c3ccd28d..50a3c7b77 100644 --- a/lib/libzfs/os/freebsd/libzfs_compat.c +++ b/lib/libzfs/os/freebsd/libzfs_compat.c @@ -275,6 +275,29 @@ zfs_jail(zfs_handle_t *zhp, int jailid, int attach) } /* + * Set loader options for next boot. + */ +int +zpool_nextboot(libzfs_handle_t *hdl, uint64_t pool_guid, uint64_t dev_guid, + const char *command) +{ + zfs_cmd_t zc = { 0 }; + nvlist_t *args; + int error; + + args = fnvlist_alloc(); + fnvlist_add_uint64(args, ZPOOL_CONFIG_POOL_GUID, pool_guid); + fnvlist_add_uint64(args, ZPOOL_CONFIG_GUID, dev_guid); + fnvlist_add_string(args, "command", command); + error = zcmd_write_src_nvlist(hdl, &zc, args); + if (error == 0) + error = ioctl(hdl->libzfs_fd, ZFS_IOC_NEXTBOOT, &zc); + zcmd_free_nvlists(&zc); + nvlist_free(args); + return (error); +} + +/* * Fill given version buffer with zfs kernel version. * Returns 0 on success, and -1 on error (with errno set) */ |