aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/libzfs.h14
-rw-r--r--lib/libspl/include/os/freebsd/sys/param.h6
-rw-r--r--lib/libzfs/os/freebsd/libzfs_compat.c23
3 files changed, 37 insertions, 6 deletions
diff --git a/include/libzfs.h b/include/libzfs.h
index 873e8f304..a93f694a1 100644
--- a/include/libzfs.h
+++ b/include/libzfs.h
@@ -893,6 +893,20 @@ int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, char *);
extern int zpool_enable_datasets(zpool_handle_t *, const char *, int);
extern int zpool_disable_datasets(zpool_handle_t *, boolean_t);
+#ifdef __FreeBSD__
+
+/*
+ * Attach/detach the given filesystem to/from the given jail.
+ */
+extern int zfs_jail(zfs_handle_t *zhp, int jailid, int attach);
+
+/*
+ * Set loader options for next boot.
+ */
+extern int zpool_nextboot(libzfs_handle_t *, uint64_t, uint64_t, const char *);
+
+#endif /* __FreeBSD__ */
+
#ifdef __cplusplus
}
#endif
diff --git a/lib/libspl/include/os/freebsd/sys/param.h b/lib/libspl/include/os/freebsd/sys/param.h
index c0ad8d679..e2abef189 100644
--- a/lib/libspl/include/os/freebsd/sys/param.h
+++ b/lib/libspl/include/os/freebsd/sys/param.h
@@ -61,10 +61,4 @@ extern size_t spl_pagesize(void);
extern int execvpe(const char *name, char * const argv[], char * const envp[]);
-struct zfs_handle;
-/*
- * Attach/detach the given filesystem to/from the given jail.
- */
-extern int zfs_jail(struct zfs_handle *zhp, int jailid, int attach);
-
#endif
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)
*/