From 59e10e7b928371d08cb9609b8c0bca864319aaeb Mon Sep 17 00:00:00 2001 From: Christos Longros <98426896+chrislongros@users.noreply.github.com> Date: Tue, 12 May 2026 16:50:33 +0200 Subject: [PATCH] libzfs_pool: document export and initialize functions Add brief docstrings to zpool_export(), zpool_export_force(), zpool_initialize() and zpool_initialize_wait(). Reviewed-by: Brian Behlendorf Signed-off-by: Christos Longros Closes #18514 --- lib/libzfs/libzfs_pool.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index fd957d98313..7c4c081edb4 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -2031,12 +2031,21 @@ zpool_export_common(zpool_handle_t *zhp, boolean_t force, boolean_t hardforce, return (0); } +/* + * Export the pool from the system. Setting force overrides the + * active-shared-spare check. The caller must unmount all datasets + * in the pool first. + */ int zpool_export(zpool_handle_t *zhp, boolean_t force, const char *log_str) { return (zpool_export_common(zhp, force, B_FALSE, log_str)); } +/* + * Force-export the pool: bypasses the active-shared-spare check, and skips + * writing the exported-state labels and updating the cachefile. + */ int zpool_export_force(zpool_handle_t *zhp, const char *log_str) { @@ -2685,6 +2694,10 @@ zpool_initialize_impl(zpool_handle_t *zhp, pool_initialize_func_t cmd_type, return (err == 0 ? 0 : -1); } +/* + * Start (or cancel/suspend/uninit) the initialize operation on the listed + * vdevs. Returns once the new state is committed. + */ int zpool_initialize(zpool_handle_t *zhp, pool_initialize_func_t cmd_type, nvlist_t *vds) @@ -2692,6 +2705,9 @@ zpool_initialize(zpool_handle_t *zhp, pool_initialize_func_t cmd_type, return (zpool_initialize_impl(zhp, cmd_type, vds, B_FALSE)); } +/* + * Like zpool_initialize(), but waits for each listed vdev to finish. + */ int zpool_initialize_wait(zpool_handle_t *zhp, pool_initialize_func_t cmd_type, nvlist_t *vds)