Path: blob/main/sys/contrib/openzfs/include/libzfs.h
48254 views
// SPDX-License-Identifier: CDDL-1.01/*2* CDDL HEADER START3*4* The contents of this file are subject to the terms of the5* Common Development and Distribution License (the "License").6* You may not use this file except in compliance with the License.7*8* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE9* or https://opensource.org/licenses/CDDL-1.0.10* See the License for the specific language governing permissions11* and limitations under the License.12*13* When distributing Covered Code, include this CDDL HEADER in each14* file and include the License file at usr/src/OPENSOLARIS.LICENSE.15* If applicable, add the following below this CDDL HEADER, with the16* fields enclosed by brackets "[]" replaced with your own identifying17* information: Portions Copyright [yyyy] [name of copyright owner]18*19* CDDL HEADER END20*/2122/*23* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.24* Copyright (c) 2011, 2024 by Delphix. All rights reserved.25* Copyright Joyent, Inc.26* Copyright (c) 2013 Steven Hartland. All rights reserved.27* Copyright (c) 2016, Intel Corporation.28* Copyright 2016 Nexenta Systems, Inc.29* Copyright (c) 2017 Open-E, Inc. All Rights Reserved.30* Copyright (c) 2019 Datto Inc.31* Copyright (c) 2021, Colm Buckley <[email protected]>32* Copyright (c) 2025 Hewlett Packard Enterprise Development LP.33*/3435#ifndef _LIBZFS_H36#define _LIBZFS_H extern __attribute__((visibility("default")))3738#include <assert.h>39#include <libshare.h>40#include <libnvpair.h>41#include <sys/mnttab.h>42#include <sys/param.h>43#include <sys/types.h>44#include <sys/fs/zfs.h>45#include <sys/avl.h>46#include <libzfs_core.h>4748#ifdef __cplusplus49extern "C" {50#endif5152/*53* Miscellaneous ZFS constants54*/55#define ZFS_MAXPROPLEN ZAP_MAXVALUELEN56#define ZPOOL_MAXPROPLEN ZAP_MAXVALUELEN5758/*59* libzfs errors60*/61typedef enum zfs_error {62EZFS_SUCCESS = 0, /* no error -- success */63EZFS_NOMEM = 2000, /* out of memory */64EZFS_BADPROP, /* invalid property value */65EZFS_PROPREADONLY, /* cannot set readonly property */66EZFS_PROPTYPE, /* property does not apply to dataset type */67EZFS_PROPNONINHERIT, /* property is not inheritable */68EZFS_PROPSPACE, /* bad quota or reservation */69EZFS_BADTYPE, /* dataset is not of appropriate type */70EZFS_BUSY, /* pool or dataset is busy */71EZFS_EXISTS, /* pool or dataset already exists */72EZFS_NOENT, /* no such pool or dataset */73EZFS_BADSTREAM, /* bad backup stream */74EZFS_DSREADONLY, /* dataset is readonly */75EZFS_VOLTOOBIG, /* volume is too large for 32-bit system */76EZFS_INVALIDNAME, /* invalid dataset name */77EZFS_BADRESTORE, /* unable to restore to destination */78EZFS_BADBACKUP, /* backup failed */79EZFS_BADTARGET, /* bad attach/detach/replace target */80EZFS_NODEVICE, /* no such device in pool */81EZFS_BADDEV, /* invalid device to add */82EZFS_NOREPLICAS, /* no valid replicas */83EZFS_RESILVERING, /* resilvering (healing reconstruction) */84EZFS_BADVERSION, /* unsupported version */85EZFS_POOLUNAVAIL, /* pool is currently unavailable */86EZFS_DEVOVERFLOW, /* too many devices in one vdev */87EZFS_BADPATH, /* must be an absolute path */88EZFS_CROSSTARGET, /* rename or clone across pool or dataset */89EZFS_ZONED, /* used improperly in local zone */90EZFS_MOUNTFAILED, /* failed to mount dataset */91EZFS_UMOUNTFAILED, /* failed to unmount dataset */92EZFS_UNSHARENFSFAILED, /* failed to unshare over nfs */93EZFS_SHARENFSFAILED, /* failed to share over nfs */94EZFS_PERM, /* permission denied */95EZFS_NOSPC, /* out of space */96EZFS_FAULT, /* bad address */97EZFS_IO, /* I/O error */98EZFS_INTR, /* signal received */99EZFS_ISSPARE, /* device is a hot spare */100EZFS_INVALCONFIG, /* invalid vdev configuration */101EZFS_RECURSIVE, /* recursive dependency */102EZFS_NOHISTORY, /* no history object */103EZFS_POOLPROPS, /* couldn't retrieve pool props */104EZFS_POOL_NOTSUP, /* ops not supported for this type of pool */105EZFS_POOL_INVALARG, /* invalid argument for this pool operation */106EZFS_NAMETOOLONG, /* dataset name is too long */107EZFS_OPENFAILED, /* open of device failed */108EZFS_NOCAP, /* couldn't get capacity */109EZFS_LABELFAILED, /* write of label failed */110EZFS_BADWHO, /* invalid permission who */111EZFS_BADPERM, /* invalid permission */112EZFS_BADPERMSET, /* invalid permission set name */113EZFS_NODELEGATION, /* delegated administration is disabled */114EZFS_UNSHARESMBFAILED, /* failed to unshare over smb */115EZFS_SHARESMBFAILED, /* failed to share over smb */116EZFS_BADCACHE, /* bad cache file */117EZFS_ISL2CACHE, /* device is for the level 2 ARC */118EZFS_VDEVNOTSUP, /* unsupported vdev type */119EZFS_NOTSUP, /* ops not supported on this dataset */120EZFS_ACTIVE_SPARE, /* pool has active shared spare devices */121EZFS_UNPLAYED_LOGS, /* log device has unplayed logs */122EZFS_REFTAG_RELE, /* snapshot release: tag not found */123EZFS_REFTAG_HOLD, /* snapshot hold: tag already exists */124EZFS_TAGTOOLONG, /* snapshot hold/rele: tag too long */125EZFS_PIPEFAILED, /* pipe create failed */126EZFS_THREADCREATEFAILED, /* thread create failed */127EZFS_POSTSPLIT_ONLINE, /* onlining a disk after splitting it */128EZFS_SCRUBBING, /* currently scrubbing */129EZFS_ERRORSCRUBBING, /* currently error scrubbing */130EZFS_ERRORSCRUB_PAUSED, /* error scrub currently paused */131EZFS_NO_SCRUB, /* no active scrub */132EZFS_DIFF, /* general failure of zfs diff */133EZFS_DIFFDATA, /* bad zfs diff data */134EZFS_POOLREADONLY, /* pool is in read-only mode */135EZFS_SCRUB_PAUSED, /* scrub currently paused */136EZFS_SCRUB_PAUSED_TO_CANCEL, /* scrub currently paused */137EZFS_ACTIVE_POOL, /* pool is imported on a different system */138EZFS_CRYPTOFAILED, /* failed to setup encryption */139EZFS_NO_PENDING, /* cannot cancel, no operation is pending */140EZFS_CHECKPOINT_EXISTS, /* checkpoint exists */141EZFS_DISCARDING_CHECKPOINT, /* currently discarding a checkpoint */142EZFS_NO_CHECKPOINT, /* pool has no checkpoint */143EZFS_DEVRM_IN_PROGRESS, /* a device is currently being removed */144EZFS_VDEV_TOO_BIG, /* a device is too big to be used */145EZFS_IOC_NOTSUPPORTED, /* operation not supported by zfs module */146EZFS_TOOMANY, /* argument list too long */147EZFS_INITIALIZING, /* currently initializing */148EZFS_NO_INITIALIZE, /* no active initialize */149EZFS_WRONG_PARENT, /* invalid parent dataset (e.g ZVOL) */150EZFS_TRIMMING, /* currently trimming */151EZFS_NO_TRIM, /* no active trim */152EZFS_TRIM_NOTSUP, /* device does not support trim */153EZFS_NO_RESILVER_DEFER, /* pool doesn't support resilver_defer */154EZFS_EXPORT_IN_PROGRESS, /* currently exporting the pool */155EZFS_REBUILDING, /* resilvering (sequential reconstrution) */156EZFS_VDEV_NOTSUP, /* ops not supported for this type of vdev */157EZFS_NOT_USER_NAMESPACE, /* a file is not a user namespace */158EZFS_CKSUM, /* insufficient replicas */159EZFS_RESUME_EXISTS, /* Resume on existing dataset without force */160EZFS_SHAREFAILED, /* filesystem share failed */161EZFS_RAIDZ_EXPAND_IN_PROGRESS, /* a raidz is currently expanding */162EZFS_ASHIFT_MISMATCH, /* can't add vdevs with different ashifts */163EZFS_UNKNOWN164} zfs_error_t;165166/*167* The following data structures are all part168* of the zfs_allow_t data structure which is169* used for printing 'allow' permissions.170* It is a linked list of zfs_allow_t's which171* then contain avl tree's for user/group/sets/...172* and each one of the entries in those trees have173* avl tree's for the permissions they belong to and174* whether they are local,descendent or local+descendent175* permissions. The AVL trees are used primarily for176* sorting purposes, but also so that we can quickly find177* a given user and or permission.178*/179typedef struct zfs_perm_node {180avl_node_t z_node;181char z_pname[MAXPATHLEN];182} zfs_perm_node_t;183184typedef struct zfs_allow_node {185avl_node_t z_node;186char z_key[MAXPATHLEN]; /* name, such as joe */187avl_tree_t z_localdescend; /* local+descendent perms */188avl_tree_t z_local; /* local permissions */189avl_tree_t z_descend; /* descendent permissions */190} zfs_allow_node_t;191192typedef struct zfs_allow {193struct zfs_allow *z_next;194char z_setpoint[MAXPATHLEN];195avl_tree_t z_sets;196avl_tree_t z_crperms;197avl_tree_t z_user;198avl_tree_t z_group;199avl_tree_t z_everyone;200} zfs_allow_t;201202/*203* Basic handle types204*/205typedef struct zfs_handle zfs_handle_t;206typedef struct zpool_handle zpool_handle_t;207typedef struct libzfs_handle libzfs_handle_t;208209_LIBZFS_H int zpool_wait(zpool_handle_t *, zpool_wait_activity_t);210_LIBZFS_H int zpool_wait_status(zpool_handle_t *, zpool_wait_activity_t,211boolean_t *, boolean_t *);212213/*214* Library initialization215*/216_LIBZFS_H libzfs_handle_t *libzfs_init(void);217_LIBZFS_H void libzfs_fini(libzfs_handle_t *);218219_LIBZFS_H libzfs_handle_t *zpool_get_handle(zpool_handle_t *);220_LIBZFS_H libzfs_handle_t *zfs_get_handle(zfs_handle_t *);221222_LIBZFS_H void libzfs_print_on_error(libzfs_handle_t *, boolean_t);223224_LIBZFS_H void zfs_save_arguments(int argc, char **, char *, int);225_LIBZFS_H int zpool_log_history(libzfs_handle_t *, const char *);226227_LIBZFS_H int libzfs_errno(libzfs_handle_t *);228_LIBZFS_H const char *libzfs_error_init(int);229_LIBZFS_H const char *libzfs_error_action(libzfs_handle_t *);230_LIBZFS_H const char *libzfs_error_description(libzfs_handle_t *);231_LIBZFS_H int zfs_standard_error(libzfs_handle_t *, int, const char *);232_LIBZFS_H void libzfs_mnttab_init(libzfs_handle_t *);233_LIBZFS_H void libzfs_mnttab_fini(libzfs_handle_t *);234_LIBZFS_H void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t);235_LIBZFS_H int libzfs_mnttab_find(libzfs_handle_t *, const char *,236struct mnttab *);237_LIBZFS_H void libzfs_mnttab_add(libzfs_handle_t *, const char *,238const char *, const char *);239_LIBZFS_H void libzfs_mnttab_remove(libzfs_handle_t *, const char *);240241/*242* Basic handle functions243*/244_LIBZFS_H zpool_handle_t *zpool_open(libzfs_handle_t *, const char *);245_LIBZFS_H zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *);246_LIBZFS_H void zpool_close(zpool_handle_t *);247_LIBZFS_H const char *zpool_get_name(zpool_handle_t *);248_LIBZFS_H int zpool_get_state(zpool_handle_t *);249_LIBZFS_H const char *zpool_state_to_name(vdev_state_t, vdev_aux_t);250_LIBZFS_H const char *zpool_pool_state_to_name(pool_state_t);251_LIBZFS_H void zpool_free_handles(libzfs_handle_t *);252253/*254* Iterate over all active pools in the system.255*/256typedef int (*zpool_iter_f)(zpool_handle_t *, void *);257_LIBZFS_H int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *);258_LIBZFS_H boolean_t zpool_skip_pool(const char *);259260/*261* Functions to create and destroy pools262*/263_LIBZFS_H int zpool_create(libzfs_handle_t *, const char *, nvlist_t *,264nvlist_t *, nvlist_t *);265_LIBZFS_H int zpool_destroy(zpool_handle_t *, const char *);266_LIBZFS_H int zpool_add(zpool_handle_t *, nvlist_t *, boolean_t check_ashift);267268typedef struct splitflags {269/* do not split, but return the config that would be split off */270unsigned int dryrun : 1;271272/* after splitting, import the pool */273unsigned int import : 1;274int name_flags;275} splitflags_t;276277typedef struct trimflags {278/* requested vdevs are for the entire pool */279boolean_t fullpool;280281/* request a secure trim, requires support from device */282boolean_t secure;283284/* after starting trim, block until trim completes */285boolean_t wait;286287/* trim at the requested rate in bytes/second */288uint64_t rate;289} trimflags_t;290291typedef struct trim_cbdata {292trimflags_t trim_flags;293pool_trim_func_t cmd_type;294} trim_cbdata_t;295296typedef struct initialize_cbdata {297boolean_t wait;298pool_initialize_func_t cmd_type;299} initialize_cbdata_t;300/*301* Functions to manipulate pool and vdev state302*/303_LIBZFS_H int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t);304_LIBZFS_H int zpool_scan_range(zpool_handle_t *, pool_scan_func_t,305pool_scrub_cmd_t, time_t, time_t);306_LIBZFS_H int zpool_initialize_one(zpool_handle_t *, void *);307_LIBZFS_H int zpool_initialize(zpool_handle_t *, pool_initialize_func_t,308nvlist_t *);309_LIBZFS_H int zpool_initialize_wait(zpool_handle_t *, pool_initialize_func_t,310nvlist_t *);311_LIBZFS_H int zpool_trim(zpool_handle_t *, pool_trim_func_t, nvlist_t *,312trimflags_t *);313314_LIBZFS_H int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);315_LIBZFS_H int zpool_reguid(zpool_handle_t *);316_LIBZFS_H int zpool_set_guid(zpool_handle_t *, const uint64_t *);317_LIBZFS_H int zpool_reopen_one(zpool_handle_t *, void *);318319_LIBZFS_H void zpool_collect_leaves(zpool_handle_t *, nvlist_t *, nvlist_t *);320_LIBZFS_H int zpool_sync_one(zpool_handle_t *, void *);321_LIBZFS_H int zpool_trim_one(zpool_handle_t *, void *);322323_LIBZFS_H int zpool_ddt_prune(zpool_handle_t *, zpool_ddt_prune_unit_t,324uint64_t);325326_LIBZFS_H int zpool_vdev_online(zpool_handle_t *, const char *, int,327vdev_state_t *);328_LIBZFS_H int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t);329_LIBZFS_H int zpool_vdev_attach(zpool_handle_t *, const char *,330const char *, nvlist_t *, int, boolean_t);331_LIBZFS_H int zpool_vdev_detach(zpool_handle_t *, const char *);332_LIBZFS_H int zpool_vdev_remove(zpool_handle_t *, const char *);333_LIBZFS_H int zpool_vdev_remove_cancel(zpool_handle_t *);334_LIBZFS_H int zpool_vdev_indirect_size(zpool_handle_t *, const char *,335uint64_t *);336_LIBZFS_H int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **,337nvlist_t *, splitflags_t);338_LIBZFS_H int zpool_vdev_remove_wanted(zpool_handle_t *, const char *);339340_LIBZFS_H int zpool_vdev_fault(zpool_handle_t *, uint64_t, vdev_aux_t);341_LIBZFS_H int zpool_vdev_degrade(zpool_handle_t *, uint64_t, vdev_aux_t);342_LIBZFS_H int zpool_vdev_set_removed_state(zpool_handle_t *, uint64_t,343vdev_aux_t);344345_LIBZFS_H int zpool_vdev_clear(zpool_handle_t *, uint64_t);346347_LIBZFS_H nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *,348boolean_t *, boolean_t *);349_LIBZFS_H nvlist_t *zpool_find_parent_vdev(zpool_handle_t *, const char *,350boolean_t *, boolean_t *, boolean_t *);351_LIBZFS_H nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *,352boolean_t *, boolean_t *, boolean_t *);353_LIBZFS_H int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *,354const char *);355_LIBZFS_H int zpool_prepare_disk(zpool_handle_t *zhp, nvlist_t *vdev_nv,356const char *prepare_str, char **lines[], int *lines_cnt);357_LIBZFS_H int zpool_prepare_and_label_disk(libzfs_handle_t *hdl,358zpool_handle_t *, const char *, nvlist_t *vdev_nv, const char *prepare_str,359char **lines[], int *lines_cnt);360_LIBZFS_H char ** zpool_vdev_script_alloc_env(const char *pool_name,361const char *vdev_path, const char *vdev_upath,362const char *vdev_enc_sysfs_path, const char *opt_key, const char *opt_val);363_LIBZFS_H void zpool_vdev_script_free_env(char **env);364_LIBZFS_H uint64_t zpool_vdev_path_to_guid(zpool_handle_t *zhp,365const char *path);366367_LIBZFS_H const char *zpool_get_state_str(zpool_handle_t *);368369/*370* Functions to manage pool properties371*/372_LIBZFS_H int zpool_set_prop(zpool_handle_t *, const char *, const char *);373_LIBZFS_H int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,374size_t proplen, zprop_source_t *, boolean_t literal);375_LIBZFS_H int zpool_get_userprop(zpool_handle_t *, const char *, char *,376size_t proplen, zprop_source_t *);377_LIBZFS_H uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t,378zprop_source_t *);379_LIBZFS_H int zpool_props_refresh(zpool_handle_t *);380381_LIBZFS_H const char *zpool_prop_to_name(zpool_prop_t);382_LIBZFS_H const char *zpool_prop_values(zpool_prop_t);383384/*385* Functions to manage vdev properties386*/387_LIBZFS_H int zpool_get_vdev_prop_value(nvlist_t *, vdev_prop_t, char *, char *,388size_t, zprop_source_t *, boolean_t);389_LIBZFS_H int zpool_get_vdev_prop(zpool_handle_t *, const char *, vdev_prop_t,390char *, char *, size_t, zprop_source_t *, boolean_t);391_LIBZFS_H int zpool_get_all_vdev_props(zpool_handle_t *, const char *,392nvlist_t **);393_LIBZFS_H int zpool_set_vdev_prop(zpool_handle_t *, const char *, const char *,394const char *);395396_LIBZFS_H const char *vdev_prop_to_name(vdev_prop_t);397_LIBZFS_H const char *vdev_prop_values(vdev_prop_t);398_LIBZFS_H boolean_t vdev_prop_user(const char *name);399_LIBZFS_H const char *vdev_prop_column_name(vdev_prop_t);400_LIBZFS_H boolean_t vdev_prop_align_right(vdev_prop_t);401402/*403* Pool health statistics.404*/405typedef enum {406/*407* The following correspond to faults as defined in the (fault.fs.zfs.*)408* event namespace. Each is associated with a corresponding message ID.409* This must be kept in sync with the zfs_msgid_table in410* lib/libzfs/libzfs_status.c.411*/412ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt /kernel/drv/zpool.cache */413ZPOOL_STATUS_MISSING_DEV_R, /* missing device with replicas */414ZPOOL_STATUS_MISSING_DEV_NR, /* missing device with no replicas */415ZPOOL_STATUS_CORRUPT_LABEL_R, /* bad device label with replicas */416ZPOOL_STATUS_CORRUPT_LABEL_NR, /* bad device label with no replicas */417ZPOOL_STATUS_BAD_GUID_SUM, /* sum of device guids didn't match */418ZPOOL_STATUS_CORRUPT_POOL, /* pool metadata is corrupted */419ZPOOL_STATUS_CORRUPT_DATA, /* data errors in user (meta)data */420ZPOOL_STATUS_FAILING_DEV, /* device experiencing errors */421ZPOOL_STATUS_VERSION_NEWER, /* newer on-disk version */422ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */423ZPOOL_STATUS_HOSTID_ACTIVE, /* currently active on another system */424ZPOOL_STATUS_HOSTID_REQUIRED, /* multihost=on and hostid=0 */425ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */426ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */427ZPOOL_STATUS_IO_FAILURE_MMP, /* failed MMP, failmode not 'panic' */428ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */429ZPOOL_STATUS_ERRATA, /* informational errata available */430431/*432* If the pool has unsupported features but can still be opened in433* read-only mode, its status is ZPOOL_STATUS_UNSUP_FEAT_WRITE. If the434* pool has unsupported features but cannot be opened at all, its435* status is ZPOOL_STATUS_UNSUP_FEAT_READ.436*/437ZPOOL_STATUS_UNSUP_FEAT_READ, /* unsupported features for read */438ZPOOL_STATUS_UNSUP_FEAT_WRITE, /* unsupported features for write */439440/*441* These faults have no corresponding message ID. At the time we are442* checking the status, the original reason for the FMA fault (I/O or443* checksum errors) has been lost.444*/445ZPOOL_STATUS_FAULTED_DEV_R, /* faulted device with replicas */446ZPOOL_STATUS_FAULTED_DEV_NR, /* faulted device with no replicas */447448/*449* The following are not faults per se, but still an error possibly450* requiring administrative attention. There is no corresponding451* message ID.452*/453ZPOOL_STATUS_VERSION_OLDER, /* older legacy on-disk version */454ZPOOL_STATUS_FEAT_DISABLED, /* supported features are disabled */455ZPOOL_STATUS_RESILVERING, /* device being resilvered */456ZPOOL_STATUS_OFFLINE_DEV, /* device offline */457ZPOOL_STATUS_REMOVED_DEV, /* removed device */458ZPOOL_STATUS_REBUILDING, /* device being rebuilt */459ZPOOL_STATUS_REBUILD_SCRUB, /* recommend scrubbing the pool */460ZPOOL_STATUS_NON_NATIVE_ASHIFT, /* (e.g. 512e dev with ashift of 9) */461ZPOOL_STATUS_COMPATIBILITY_ERR, /* bad 'compatibility' property */462ZPOOL_STATUS_INCOMPATIBLE_FEAT, /* feature set outside compatibility */463464/*465* Finally, the following indicates a healthy pool.466*/467ZPOOL_STATUS_OK468} zpool_status_t;469470_LIBZFS_H zpool_status_t zpool_get_status(zpool_handle_t *, const char **,471zpool_errata_t *);472_LIBZFS_H zpool_status_t zpool_import_status(nvlist_t *, const char **,473zpool_errata_t *);474475/*476* Statistics and configuration functions.477*/478_LIBZFS_H nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);479_LIBZFS_H nvlist_t *zpool_get_features(zpool_handle_t *);480_LIBZFS_H int zpool_refresh_stats(zpool_handle_t *, boolean_t *);481_LIBZFS_H void zpool_refresh_stats_from_handle(zpool_handle_t *,482zpool_handle_t *);483_LIBZFS_H int zpool_get_errlog(zpool_handle_t *, nvlist_t **);484_LIBZFS_H void zpool_add_propname(zpool_handle_t *, const char *);485486/*487* Import and export functions488*/489_LIBZFS_H int zpool_export(zpool_handle_t *, boolean_t, const char *);490_LIBZFS_H int zpool_export_force(zpool_handle_t *, const char *);491_LIBZFS_H int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,492char *altroot);493_LIBZFS_H int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,494nvlist_t *, int);495_LIBZFS_H void zpool_collect_unsup_feat(nvlist_t *config, char *buf,496size_t size);497498/*499* Miscellaneous pool functions500*/501struct zfs_cmd;502503_LIBZFS_H const char *const zfs_history_event_names[];504505typedef enum {506VDEV_NAME_PATH = 1 << 0,507VDEV_NAME_GUID = 1 << 1,508VDEV_NAME_FOLLOW_LINKS = 1 << 2,509VDEV_NAME_TYPE_ID = 1 << 3,510} vdev_name_t;511512_LIBZFS_H char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *,513int name_flags);514_LIBZFS_H int zpool_upgrade(zpool_handle_t *, uint64_t);515_LIBZFS_H int zpool_get_history(zpool_handle_t *, nvlist_t **, uint64_t *,516boolean_t *);517_LIBZFS_H int zpool_events_next(libzfs_handle_t *, nvlist_t **, int *, unsigned,518int);519_LIBZFS_H int zpool_events_clear(libzfs_handle_t *, int *);520_LIBZFS_H int zpool_events_seek(libzfs_handle_t *, uint64_t, int);521_LIBZFS_H void zpool_obj_to_path_ds(zpool_handle_t *, uint64_t, uint64_t,522char *, size_t);523_LIBZFS_H void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,524size_t);525_LIBZFS_H int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *);526_LIBZFS_H void zpool_explain_recover(libzfs_handle_t *, const char *, int,527nvlist_t *, char *, size_t);528_LIBZFS_H int zpool_checkpoint(zpool_handle_t *);529_LIBZFS_H int zpool_discard_checkpoint(zpool_handle_t *);530_LIBZFS_H boolean_t zpool_is_draid_spare(const char *);531532_LIBZFS_H int zpool_prefetch(zpool_handle_t *, zpool_prefetch_type_t);533534/*535* Basic handle manipulations. These functions do not create or destroy the536* underlying datasets, only the references to them.537*/538_LIBZFS_H zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int);539_LIBZFS_H zfs_handle_t *zfs_handle_dup(zfs_handle_t *);540_LIBZFS_H void zfs_close(zfs_handle_t *);541_LIBZFS_H zfs_type_t zfs_get_type(const zfs_handle_t *);542_LIBZFS_H zfs_type_t zfs_get_underlying_type(const zfs_handle_t *);543_LIBZFS_H const char *zfs_get_name(const zfs_handle_t *);544_LIBZFS_H zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);545_LIBZFS_H const char *zfs_get_pool_name(const zfs_handle_t *);546547/*548* Property management functions. Some functions are shared with the kernel,549* and are found in sys/fs/zfs.h.550*/551552/*553* zfs dataset property management554*/555_LIBZFS_H const char *zfs_prop_default_string(zfs_prop_t);556_LIBZFS_H uint64_t zfs_prop_default_numeric(zfs_prop_t);557_LIBZFS_H const char *zfs_prop_column_name(zfs_prop_t);558_LIBZFS_H boolean_t zfs_prop_align_right(zfs_prop_t);559560_LIBZFS_H nvlist_t *zfs_valid_proplist(libzfs_handle_t *, zfs_type_t,561nvlist_t *, uint64_t, zfs_handle_t *, zpool_handle_t *, boolean_t,562const char *);563564_LIBZFS_H const char *zfs_prop_to_name(zfs_prop_t);565_LIBZFS_H int zfs_prop_set(zfs_handle_t *, const char *, const char *);566_LIBZFS_H int zfs_prop_set_list(zfs_handle_t *, nvlist_t *);567_LIBZFS_H int zfs_prop_set_list_flags(zfs_handle_t *, nvlist_t *, int);568_LIBZFS_H int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t,569zprop_source_t *, char *, size_t, boolean_t);570_LIBZFS_H int zfs_prop_get_recvd(zfs_handle_t *, const char *, char *, size_t,571boolean_t);572_LIBZFS_H int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *,573zprop_source_t *, char *, size_t);574_LIBZFS_H int zfs_prop_get_userquota_int(zfs_handle_t *zhp,575const char *propname, uint64_t *propvalue);576_LIBZFS_H int zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname,577char *propbuf, int proplen, boolean_t literal);578_LIBZFS_H int zfs_prop_get_written_int(zfs_handle_t *zhp, const char *propname,579uint64_t *propvalue);580_LIBZFS_H int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname,581char *propbuf, int proplen, boolean_t literal);582_LIBZFS_H int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname,583char *buf, size_t len);584_LIBZFS_H uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, const char **);585_LIBZFS_H uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);586_LIBZFS_H int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t);587_LIBZFS_H const char *zfs_prop_values(zfs_prop_t);588_LIBZFS_H int zfs_prop_is_string(zfs_prop_t prop);589_LIBZFS_H nvlist_t *zfs_get_all_props(zfs_handle_t *);590_LIBZFS_H nvlist_t *zfs_get_user_props(zfs_handle_t *);591_LIBZFS_H nvlist_t *zfs_get_recvd_props(zfs_handle_t *);592_LIBZFS_H nvlist_t *zfs_get_clones_nvl(zfs_handle_t *);593594_LIBZFS_H int zfs_wait_status(zfs_handle_t *, zfs_wait_activity_t,595boolean_t *, boolean_t *);596597/*598* zfs encryption management599*/600_LIBZFS_H int zfs_crypto_get_encryption_root(zfs_handle_t *, boolean_t *,601char *);602_LIBZFS_H int zfs_crypto_create(libzfs_handle_t *, char *, nvlist_t *,603nvlist_t *, boolean_t stdin_available, uint8_t **, uint_t *);604_LIBZFS_H int zfs_crypto_clone_check(libzfs_handle_t *, zfs_handle_t *, char *,605nvlist_t *);606_LIBZFS_H int zfs_crypto_attempt_load_keys(libzfs_handle_t *, const char *);607_LIBZFS_H int zfs_crypto_load_key(zfs_handle_t *, boolean_t, const char *);608_LIBZFS_H int zfs_crypto_unload_key(zfs_handle_t *);609_LIBZFS_H int zfs_crypto_rewrap(zfs_handle_t *, nvlist_t *, boolean_t);610_LIBZFS_H boolean_t zfs_is_encrypted(zfs_handle_t *);611612typedef struct zprop_list {613int pl_prop;614char *pl_user_prop;615struct zprop_list *pl_next;616boolean_t pl_all;617size_t pl_width;618size_t pl_recvd_width;619boolean_t pl_fixed;620} zprop_list_t;621622_LIBZFS_H int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t,623boolean_t);624_LIBZFS_H void zfs_prune_proplist(zfs_handle_t *, uint8_t *);625_LIBZFS_H int vdev_expand_proplist(zpool_handle_t *, const char *,626zprop_list_t **);627628#define ZFS_MOUNTPOINT_NONE "none"629#define ZFS_MOUNTPOINT_LEGACY "legacy"630631#define ZFS_FEATURE_DISABLED "disabled"632#define ZFS_FEATURE_ENABLED "enabled"633#define ZFS_FEATURE_ACTIVE "active"634635#define ZFS_UNSUPPORTED_INACTIVE "inactive"636#define ZFS_UNSUPPORTED_READONLY "readonly"637638/*639* zpool property management640*/641_LIBZFS_H int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **,642zfs_type_t, boolean_t);643_LIBZFS_H int zpool_prop_get_feature(zpool_handle_t *, const char *, char *,644size_t);645_LIBZFS_H const char *zpool_prop_default_string(zpool_prop_t);646_LIBZFS_H uint64_t zpool_prop_default_numeric(zpool_prop_t);647_LIBZFS_H const char *zpool_prop_column_name(zpool_prop_t);648_LIBZFS_H boolean_t zpool_prop_align_right(zpool_prop_t);649650/*651* Functions shared by zfs and zpool property management.652*/653_LIBZFS_H int zprop_iter(zprop_func func, void *cb, boolean_t show_all,654boolean_t ordered, zfs_type_t type);655_LIBZFS_H int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **,656zfs_type_t);657_LIBZFS_H void zprop_free_list(zprop_list_t *);658659_LIBZFS_H void zcmd_print_json(nvlist_t *);660661#define ZFS_GET_NCOLS 5662663typedef enum {664GET_COL_NONE,665GET_COL_NAME,666GET_COL_PROPERTY,667GET_COL_VALUE,668GET_COL_RECVD,669GET_COL_SOURCE670} zfs_get_column_t;671672/*673* Functions for printing zfs or zpool properties674*/675typedef struct vdev_cbdata {676int cb_name_flags;677char **cb_names;678unsigned int cb_names_count;679} vdev_cbdata_t;680681typedef struct zprop_get_cbdata {682int cb_sources;683zfs_get_column_t cb_columns[ZFS_GET_NCOLS];684int cb_colwidths[ZFS_GET_NCOLS + 1];685boolean_t cb_scripted;686boolean_t cb_literal;687boolean_t cb_first;688boolean_t cb_json;689zprop_list_t *cb_proplist;690zfs_type_t cb_type;691vdev_cbdata_t cb_vdevs;692nvlist_t *cb_jsobj;693boolean_t cb_json_as_int;694boolean_t cb_json_pool_key_guid;695} zprop_get_cbdata_t;696697#define ZFS_SET_NOMOUNT 1698699typedef struct zprop_set_cbdata {700int cb_flags;701nvlist_t *cb_proplist;702} zprop_set_cbdata_t;703704_LIBZFS_H void zprop_print_one_property(const char *, zprop_get_cbdata_t *,705const char *, const char *, zprop_source_t, const char *,706const char *);707708_LIBZFS_H int zprop_nvlist_one_property(const char *, const char *,709zprop_source_t, const char *, const char *, nvlist_t *, boolean_t);710711_LIBZFS_H int zprop_collect_property(const char *, zprop_get_cbdata_t *,712const char *, const char *, zprop_source_t, const char *,713const char *, nvlist_t *);714715/*716* Iterator functions.717*/718#define ZFS_ITER_RECURSE (1 << 0)719#define ZFS_ITER_ARGS_CAN_BE_PATHS (1 << 1)720#define ZFS_ITER_PROP_LISTSNAPS (1 << 2)721#define ZFS_ITER_DEPTH_LIMIT (1 << 3)722#define ZFS_ITER_RECVD_PROPS (1 << 4)723#define ZFS_ITER_LITERAL_PROPS (1 << 5)724#define ZFS_ITER_SIMPLE (1 << 6)725726typedef int (*zfs_iter_f)(zfs_handle_t *, void *);727_LIBZFS_H int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *);728_LIBZFS_H int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *);729_LIBZFS_H int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f,730void *);731_LIBZFS_H int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);732_LIBZFS_H int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *,733uint64_t, uint64_t);734_LIBZFS_H int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *,735uint64_t, uint64_t);736_LIBZFS_H int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f,737void *);738_LIBZFS_H int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);739740_LIBZFS_H int zfs_iter_children_v2(zfs_handle_t *, int, zfs_iter_f, void *);741_LIBZFS_H int zfs_iter_dependents_v2(zfs_handle_t *, int, boolean_t, zfs_iter_f,742void *);743_LIBZFS_H int zfs_iter_filesystems_v2(zfs_handle_t *, int, zfs_iter_f, void *);744_LIBZFS_H int zfs_iter_snapshots_v2(zfs_handle_t *, int, zfs_iter_f, void *,745uint64_t, uint64_t);746_LIBZFS_H int zfs_iter_snapshots_sorted_v2(zfs_handle_t *, int, zfs_iter_f,747void *, uint64_t, uint64_t);748_LIBZFS_H int zfs_iter_snapspec_v2(zfs_handle_t *, int, const char *,749zfs_iter_f, void *);750_LIBZFS_H int zfs_iter_bookmarks_v2(zfs_handle_t *, int, zfs_iter_f, void *);751_LIBZFS_H int zfs_iter_mounted(zfs_handle_t *, zfs_iter_f, void *);752753typedef struct get_all_cb {754zfs_handle_t **cb_handles;755size_t cb_alloc;756size_t cb_used;757} get_all_cb_t;758759_LIBZFS_H void zfs_foreach_mountpoint(libzfs_handle_t *, zfs_handle_t **,760size_t, zfs_iter_f, void *, uint_t);761_LIBZFS_H void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *);762763/*764* Functions to create and destroy datasets.765*/766_LIBZFS_H int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,767nvlist_t *);768_LIBZFS_H int zfs_create_ancestors(libzfs_handle_t *, const char *);769_LIBZFS_H int zfs_destroy(zfs_handle_t *, boolean_t);770_LIBZFS_H int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);771_LIBZFS_H int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);772_LIBZFS_H int zfs_destroy_snaps_nvl_os(libzfs_handle_t *, nvlist_t *);773_LIBZFS_H int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);774_LIBZFS_H int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t,775nvlist_t *);776_LIBZFS_H int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,777nvlist_t *props);778_LIBZFS_H int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);779780typedef struct renameflags {781/* recursive rename */782unsigned int recursive : 1;783784/* don't unmount file systems */785unsigned int nounmount : 1;786787/* force unmount file systems */788unsigned int forceunmount : 1;789} renameflags_t;790791_LIBZFS_H int zfs_rename(zfs_handle_t *, const char *, renameflags_t);792793typedef struct sendflags {794/* Amount of extra information to print. */795int verbosity;796797/* recursive send (ie, -R) */798boolean_t replicate;799800/* for recursive send, skip sending missing snapshots */801boolean_t skipmissing;802803/* for incrementals, do all intermediate snapshots */804boolean_t doall;805806/* if dataset is a clone, do incremental from its origin */807boolean_t fromorigin;808809/* field no longer used, maintained for backwards compatibility */810boolean_t pad;811812/* send properties (ie, -p) */813boolean_t props;814815/* do not send (no-op, ie. -n) */816boolean_t dryrun;817818/* parsable verbose output (ie. -P) */819boolean_t parsable;820821/* show progress (ie. -v) */822boolean_t progress;823824/* show progress as process title (ie. -V) */825boolean_t progressastitle;826827/* large blocks (>128K) are permitted */828boolean_t largeblock;829830/* WRITE_EMBEDDED records of type DATA are permitted */831boolean_t embed_data;832833/* compressed WRITE records are permitted */834boolean_t compress;835836/* raw encrypted records are permitted */837boolean_t raw;838839/* only send received properties (ie. -b) */840boolean_t backup;841842/* include snapshot holds in send stream */843boolean_t holds;844845/* stream represents a partially received dataset */846boolean_t saved;847} sendflags_t;848849typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);850851_LIBZFS_H int zfs_send(zfs_handle_t *, const char *, const char *,852sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);853_LIBZFS_H int zfs_send_one(zfs_handle_t *, const char *, int, sendflags_t *,854const char *);855_LIBZFS_H int zfs_send_progress(zfs_handle_t *, int, uint64_t *, uint64_t *);856_LIBZFS_H int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd,857const char *);858_LIBZFS_H int zfs_send_saved(zfs_handle_t *, sendflags_t *, int, const char *);859_LIBZFS_H nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl,860const char *token);861862_LIBZFS_H int zfs_promote(zfs_handle_t *);863_LIBZFS_H int zfs_hold(zfs_handle_t *, const char *, const char *,864boolean_t, int);865_LIBZFS_H int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *);866_LIBZFS_H int zfs_release(zfs_handle_t *, const char *, const char *,867boolean_t);868_LIBZFS_H int zfs_get_holds(zfs_handle_t *, nvlist_t **);869_LIBZFS_H uint64_t zvol_volsize_to_reservation(zpool_handle_t *, uint64_t,870nvlist_t *);871872typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain,873uid_t rid, uint64_t space, uint64_t default_quota);874875_LIBZFS_H int zfs_userspace(zfs_handle_t *, zfs_userquota_prop_t,876zfs_userspace_cb_t, void *);877878_LIBZFS_H int zfs_get_fsacl(zfs_handle_t *, nvlist_t **);879_LIBZFS_H int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *);880881typedef struct recvflags {882/* print informational messages (ie, -v was specified) */883boolean_t verbose;884885/* the destination is a prefix, not the exact fs (ie, -d) */886boolean_t isprefix;887888/*889* Only the tail of the sent snapshot path is appended to the890* destination to determine the received snapshot name (ie, -e).891*/892boolean_t istail;893894/* do not actually do the recv, just check if it would work (ie, -n) */895boolean_t dryrun;896897/* rollback/destroy filesystems as necessary (eg, -F) */898boolean_t force;899900/* set "canmount=off" on all modified filesystems */901boolean_t canmountoff;902903/*904* Mark the file systems as "resumable" and do not destroy them if the905* receive is interrupted906*/907boolean_t resumable;908909/* byteswap flag is used internally; callers need not specify */910boolean_t byteswap;911912/* do not mount file systems as they are extracted (private) */913boolean_t nomount;914915/* Was holds flag set in the compound header? */916boolean_t holds;917918/* skip receive of snapshot holds */919boolean_t skipholds;920921/* mount the filesystem unless nomount is specified */922boolean_t domount;923924/* force unmount while recv snapshot (private) */925boolean_t forceunmount;926927/* use this recv to check (and heal if needed) an existing snapshot */928boolean_t heal;929} recvflags_t;930931_LIBZFS_H int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *,932recvflags_t *, int, avl_tree_t *);933934typedef enum diff_flags {935ZFS_DIFF_PARSEABLE = 1 << 0,936ZFS_DIFF_TIMESTAMP = 1 << 1,937ZFS_DIFF_CLASSIFY = 1 << 2,938ZFS_DIFF_NO_MANGLE = 1 << 3939} diff_flags_t;940941_LIBZFS_H int zfs_show_diffs(zfs_handle_t *, int, const char *, const char *,942int);943944/*945* Miscellaneous functions.946*/947_LIBZFS_H const char *zfs_type_to_name(zfs_type_t);948_LIBZFS_H void zfs_refresh_properties(zfs_handle_t *);949_LIBZFS_H int zfs_name_valid(const char *, zfs_type_t);950_LIBZFS_H zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, const char *,951zfs_type_t);952_LIBZFS_H int zfs_parent_name(zfs_handle_t *, char *, size_t);953_LIBZFS_H boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,954zfs_type_t);955_LIBZFS_H int zfs_spa_version(zfs_handle_t *, int *);956_LIBZFS_H boolean_t zfs_bookmark_exists(const char *path);957958/*959* Mount support functions.960*/961_LIBZFS_H boolean_t is_mounted(libzfs_handle_t *, const char *special, char **);962_LIBZFS_H boolean_t zfs_is_mounted(zfs_handle_t *, char **);963_LIBZFS_H int zfs_mount(zfs_handle_t *, const char *, int);964_LIBZFS_H int zfs_mount_at(zfs_handle_t *, const char *, int, const char *);965_LIBZFS_H int zfs_unmount(zfs_handle_t *, const char *, int);966_LIBZFS_H int zfs_unmountall(zfs_handle_t *, int);967_LIBZFS_H int zfs_mount_delegation_check(void);968969#if defined(__linux__) || defined(__APPLE__)970_LIBZFS_H int zfs_parse_mount_options(const char *mntopts,971unsigned long *mntflags, unsigned long *zfsflags, int sloppy, char *badopt,972char *mtabopt);973_LIBZFS_H void zfs_adjust_mount_options(zfs_handle_t *zhp, const char *mntpoint,974char *mntopts, char *mtabopt);975#endif976977/*978* Share support functions.979*980* enum sa_protocol * lists are terminated with SA_NO_PROTOCOL,981* NULL means "all/any known to this libzfs".982*/983#define SA_NO_PROTOCOL -1984985_LIBZFS_H boolean_t zfs_is_shared(zfs_handle_t *zhp, char **where,986const enum sa_protocol *proto);987_LIBZFS_H int zfs_share(zfs_handle_t *zhp, const enum sa_protocol *proto);988_LIBZFS_H int zfs_unshare(zfs_handle_t *zhp, const char *mountpoint,989const enum sa_protocol *proto);990_LIBZFS_H int zfs_unshareall(zfs_handle_t *zhp,991const enum sa_protocol *proto);992_LIBZFS_H void zfs_commit_shares(const enum sa_protocol *proto);993_LIBZFS_H void zfs_truncate_shares(const enum sa_protocol *proto);994995_LIBZFS_H int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *);996997/*998* Utility functions to run an external process.999*/1000#define STDOUT_VERBOSE 0x011001#define STDERR_VERBOSE 0x021002#define NO_DEFAULT_PATH 0x04 /* Don't use $PATH to lookup the command */10031004_LIBZFS_H int libzfs_run_process(const char *, char **, int);1005_LIBZFS_H int libzfs_run_process_get_stdout(const char *, char *[], char *[],1006char **[], int *);1007_LIBZFS_H int libzfs_run_process_get_stdout_nopath(const char *, char *[],1008char *[], char **[], int *);10091010_LIBZFS_H void libzfs_free_str_array(char **, int);10111012_LIBZFS_H boolean_t libzfs_envvar_is_set(const char *);10131014/*1015* Utility functions for zfs version1016*/1017_LIBZFS_H const char *zfs_version_userland(void);1018_LIBZFS_H char *zfs_version_kernel(void);1019_LIBZFS_H int zfs_version_print(void);1020_LIBZFS_H nvlist_t *zfs_version_nvlist(void);10211022/*1023* Given a device or file, determine if it is part of a pool.1024*/1025_LIBZFS_H int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **,1026boolean_t *);10271028/*1029* Label manipulation.1030*/1031_LIBZFS_H int zpool_clear_label(int);1032_LIBZFS_H int zpool_set_bootenv(zpool_handle_t *, const nvlist_t *);1033_LIBZFS_H int zpool_get_bootenv(zpool_handle_t *, nvlist_t **);10341035/*1036* Management interfaces for SMB ACL files1037*/10381039_LIBZFS_H int zfs_smb_acl_add(libzfs_handle_t *, char *, char *, char *);1040_LIBZFS_H int zfs_smb_acl_remove(libzfs_handle_t *, char *, char *, char *);1041_LIBZFS_H int zfs_smb_acl_purge(libzfs_handle_t *, char *, char *);1042_LIBZFS_H int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *,1043char *);10441045/*1046* Enable and disable datasets within a pool by mounting/unmounting and1047* sharing/unsharing them.1048*/1049_LIBZFS_H int zpool_enable_datasets(zpool_handle_t *, const char *, int,1050uint_t);1051_LIBZFS_H int zpool_disable_datasets(zpool_handle_t *, boolean_t);1052_LIBZFS_H void zpool_disable_datasets_os(zpool_handle_t *, boolean_t);1053_LIBZFS_H void zpool_disable_volume_os(const char *);10541055/*1056* Parse a features file for -o compatibility1057*/1058typedef enum {1059ZPOOL_COMPATIBILITY_OK,1060ZPOOL_COMPATIBILITY_WARNTOKEN,1061ZPOOL_COMPATIBILITY_BADTOKEN,1062ZPOOL_COMPATIBILITY_BADFILE,1063ZPOOL_COMPATIBILITY_NOFILES1064} zpool_compat_status_t;10651066_LIBZFS_H zpool_compat_status_t zpool_load_compat(const char *,1067boolean_t *, char *, size_t);10681069#ifdef __FreeBSD__10701071/*1072* Attach/detach the given filesystem to/from the given jail.1073*/1074_LIBZFS_H int zfs_jail(zfs_handle_t *zhp, int jailid, int attach);10751076/*1077* Set loader options for next boot.1078*/1079_LIBZFS_H int zpool_nextboot(libzfs_handle_t *, uint64_t, uint64_t,1080const char *);10811082#endif /* __FreeBSD__ */10831084#ifdef __linux__10851086/*1087* Add or delete the given filesystem to/from the given user namespace.1088*/1089_LIBZFS_H int zfs_userns(zfs_handle_t *zhp, const char *nspath, int attach);10901091#endif10921093#ifdef __cplusplus1094}1095#endif10961097#endif /* _LIBZFS_H */109810991100