Hallo, dies ist ein Test.
PWD: /www/data-lst1/unixsoft/unixsoft/kaempfer/.public_html
Running in File Mode
Relative path: ./../../../../../../usr/./include/libzfs.h
Real path: /usr/include/libzfs.h
Zurück
/* * Copyright (c) 2005, 2023, Oracle and/or its affiliates. */ #ifndef _LIBZFS_H #define _LIBZFS_H #include <assert.h> #include <libnvpair.h> #include <sys/mntent.h> #include <sys/mnttab.h> #include <sys/param.h> #include <sys/types.h> #include <sys/varargs.h> #include <sys/fs/zfs.h> #include <sys/avl.h> #include <ucred.h> #include <sys/sa_share.h> #include <sys/list.h> #ifdef __cplusplus extern "C" { #endif /* * Miscellaneous ZFS constants */ #define ZFS_MAXNAMELEN MAXNAMELEN #define ZPOOL_MAXNAMELEN MAXNAMELEN #define ZFS_MAXPROPLEN ZAP_MAXVALUELEN #define ZPOOL_MAXPROPLEN MAXPATHLEN #define ZFS_MOUNTPOINT_NONE "none" #define ZFS_MOUNTPOINT_LEGACY "legacy" #define ZFS_RECV_RENAME_PREFIX "recv-" /* Forward reference */ struct restart_bookmark; /* * libzfs errors */ #define EZFS_MINVAL 2000 enum libzfs_errno { EZFS_NOMEM = EZFS_MINVAL, /* out of memory */ EZFS_BADPROP, /* invalid property value */ EZFS_PROPREADONLY, /* cannot set readonly property */ EZFS_PROPTYPE, /* property does not apply to dataset type */ EZFS_PROPNONINHERIT, /* property is not inheritable */ EZFS_PROPSPACE, /* bad quota or reservation */ EZFS_BADTYPE, /* dataset is not of appropriate type */ EZFS_BUSY, /* pool or dataset is busy */ EZFS_EXISTS, /* pool or dataset already exists */ EZFS_NOENT, /* no such pool or dataset */ EZFS_BADSTREAM, /* bad backup stream */ EZFS_DSREADONLY, /* dataset is readonly */ EZFS_VOLTOOBIG, /* volume is too large for 32-bit system */ EZFS_INVALIDNAME, /* invalid dataset name */ EZFS_BADRESTORE, /* unable to restore to destination */ EZFS_BADBACKUP, /* backup failed */ EZFS_BADTARGET, /* bad attach/detach/replace target */ EZFS_NODEVICE, /* no such device in pool */ EZFS_BADDEV, /* invalid device to add */ EZFS_NOREPLICAS, /* no valid replicas */ EZFS_RESILVERING, /* currently resilvering */ EZFS_BADVERSION, /* unsupported version */ EZFS_POOLUNAVAIL, /* pool is currently unavailable */ EZFS_DEVOVERFLOW, /* too many devices in one vdev */ EZFS_BADPATH, /* must be an absolute path */ EZFS_CROSSTARGET, /* rename or clone across pool or dataset */ EZFS_ZONED, /* used improperly in local zone */ EZFS_MOUNTFAILED, /* failed to mount dataset */ EZFS_MKDIRFAILED, /* failed to create directory for mount */ EZFS_BADSHADOW, /* invalid shadow property */ EZFS_SHADOWMOUNTFAILED, /* failed to mount shadow filesysem */ EZFS_UMOUNTFAILED, /* failed to unmount dataset */ EZFS_UNSHAREFAILED, /* unshare failed */ EZFS_SHAREFAILED, /* share failed */ EZFS_PERM, /* permission denied */ EZFS_NOSPC, /* out of space */ EZFS_FAULT, /* bad address */ EZFS_IO, /* I/O error */ EZFS_INTR, /* signal received */ EZFS_ISSPARE, /* device is a hot spare */ EZFS_INVALCONFIG, /* invalid vdev configuration */ EZFS_RECURSIVE, /* recursive dependency */ EZFS_NOHISTORY, /* no history object */ EZFS_POOLPROPS, /* couldn't retrieve pool props */ EZFS_POOL_NOTSUP, /* ops not supported for this type of pool */ EZFS_POOL_INVALARG, /* invalid argument for this pool operation */ EZFS_NAMETOOLONG, /* dataset name is too long */ EZFS_FILENAMETOOLONG, /* file name is too long */ EZFS_OPENFAILED, /* open of device failed */ EZFS_NOCAP, /* couldn't get capacity */ EZFS_LABELFAILED, /* write of label failed */ EZFS_BADWHO, /* invalid permission who */ EZFS_BADPERM, /* invalid permission */ EZFS_BADPERMSET, /* invalid permission set name */ EZFS_NODELEGATION, /* delegated administration is disabled */ EZFS_BADCACHE, /* bad cache file */ EZFS_ISL2CACHE, /* device is for the level 2 ARC */ EZFS_VDEVNOTSUP, /* unsupported vdev type */ EZFS_NOTSUP, /* ops not supported on this dataset */ EZFS_ACTIVE_SPARE, /* pool has active shared spare devices */ EZFS_UNPLAYED_LOGS, /* log device has unplayed logs */ EZFS_REFTAG_RELE, /* snapshot release: tag not found */ EZFS_REFTAG_HOLD, /* snapshot hold: tag already exists */ EZFS_TAGTOOLONG, /* snapshot hold/rele: tag too long */ EZFS_PIPEFAILED, /* pipe create failed */ EZFS_THREADCREATEFAILED, /* thread create failed */ EZFS_POSTSPLIT_ONLINE, /* onlining a disk after splitting it */ EZFS_SCRUBBING, /* currently scrubbing */ EZFS_NO_SCRUB, /* no active scrub */ EZFS_DIFF, /* general failure of zfs diff */ EZFS_DIFFDATA, /* bad zfs diff data */ EZFS_POOLREADONLY, /* pool is in read-only mode */ EZFS_KEYERR, /* crypto key config or general failure */ EZFS_POOL_INUSE, /* pool already in use */ EZFS_DEV_INUSE, /* device already in use */ EZFS_INVALID_PROPNAME, /* invalid property name */ EZFS_BADSHAREPATH, /* not relative to mountpoint */ EZFS_NOTMOUNTED, /* filesystem not mounted */ EZFS_VOLONLY, /* applies only to zvol */ EZFS_KEY_MISSING, /* could not find the key */ EZFS_KEY_INCORRECT, /* key doesn't decrypt the keychain */ EZFS_KEY_UNUSABLE, /* key found but in an unusable state */ EZFS_KEY_MISMATCH, /* rawcrypto key history mismatch */ EZFS_POOL_NOTHEALTHY, /* pool is not healthy */ EZFS_SEND_COMPLETE, /* nothing to send */ EZFS_HAS_DEPENDENT, /* dataset has a dependent */ EZFS_TIMEOUT, /* command timed out */ EZFS_L2CACHE_EXISTS, /* l2cache devices exist */ EZFS_BAD_ALLOCUNIT, /* smaller allocunit than supported */ EZFS_MIXEDDEVICE, /* mixed top and aux devices */ EZFS_PXFSSYNC, /* failed to sync global file system */ EZFS_SEC_UNCONFIGURED, /* security subsystem unconfigured */ EZFS_RETENTION_OFF, /* retention not enabled */ EZFS_RETENTION_PERIOD_TOOBIG, /* retention period too big */ EZFS_RETENTION_PERIOD_OVERFLOW, /* retention period would overflow */ EZFS_RETENTION_RANGE, /* retention period values are not in order */ EZFS_RETAINED_FILES, /* has retained files */ EZFS_RETAINED_HOLD, /* has onexpiry set to 'hold' */ EZFS_RETENTION_ROLLBACK, /* can't rollback mandatory retention fs */ EZFS_AUTO_RETENTION_ENABLED, /* auto-retention can't be disabled */ EZFS_AUTO_RETENTION_INCREASE, /* can't increase auto-retention grace */ EZFS_NO_REDUNDANCY, /* pool has no redundancy */ EZFS_DETACH_LAST_REDUNDANCY, /* can't detach last submirror */ EZFS_RETENTION_SPLIT, /* can't split pool with mandatory retention */ EZFS_RETENTION_ADD, /* add to pool with mretention bad redundancy */ EZFS_MAND_RETENTION_RECV, /* can't receive into mandatory retention */ EZFS_AUTODELETE_DEFPERIOD_ZERO, /* autodelete requires defperiod >0 */ EZFS_INCOMPAT_FS_VERSION_PROP, /* fs version incompatible with prop */ EZFS_UNKNOWN }; enum zfs_aux_error { EXZFS_NO_AUX_ERROR, EXZFS_DEST_EXISTS, EXZFS_NAME_EXISTS, EXZFS_DEST_HAS_SNAPS, EXZFS_CANT_OVERWRITE_CLONE, EXZFS_INCR_SRCSNAP_NOT_FOUND, EXZFS_SEND_SRC_NOT_FOUND, EXZFS_ZERO_LENGTH_NAME, EXZFS_CANT_GET_VERSION_INFO, EXZFS_CLONE_ORIGIN_NOT_FOUND, EXZFS_DESTDS_NOT_FOUND, EXZFS_PREFIX_DS_NOT_FOUND, EXZFS_TOSNAP_NOT_FOUND, EXZFS_UNKNOWN }; /* * definitions used to control whether a required partition for booting * of the disk should be created when (EFI/GPT) labeling a disk. */ /* do not create any required boot partitions */ #define ZPOOL_LABEL_NOREQ_PART 0 /* create a required boot partition based on system requirement */ #define ZPOOL_LABEL_REQ_PART 1 /* * create required boot partition based on original pool's content, * e.g zpool for attach */ #define ZPOOL_LABEL_MATCH_REQ_PART 2 /* * This is different from checking zfs_type, because it will also catch * snapshots of volumes. */ #define ZFS_HEAD_VOLUME(zhp) (zfs_get_head_type(zhp) == ZFS_TYPE_VOLUME) #define ZFS_HEAD_FILESYSTEM(zhp) (zfs_get_head_type(zhp) == ZFS_TYPE_FILESYSTEM) /* * The following data structures are all part * of the zfs_allow_t data structure which is * used for printing 'allow' permissions. * It is a linked list of zfs_allow_t's which * then contain avl tree's for user/group/sets/... * and each one of the entries in those trees have * avl tree's for the permissions they belong to and * whether they are local,descendent or local+descendent * permissions. The AVL trees are used primarily for * sorting purposes, but also so that we can quickly find * a given user and or permission. */ typedef struct zfs_perm_node { avl_node_t z_node; char z_pname[MAXPATHLEN]; } zfs_perm_node_t; typedef struct zfs_allow_node { avl_node_t z_node; char z_key[MAXPATHLEN]; /* name, such as joe */ avl_tree_t z_localdescend; /* local+descendent perms */ avl_tree_t z_local; /* local permissions */ avl_tree_t z_descend; /* descendent permissions */ } zfs_allow_node_t; typedef struct zfs_allow { struct zfs_allow *z_next; char z_setpoint[MAXPATHLEN]; avl_tree_t z_sets; avl_tree_t z_crperms; avl_tree_t z_user; avl_tree_t z_group; avl_tree_t z_everyone; } zfs_allow_t; /* * Basic handle types */ typedef struct zfs_handle zfs_handle_t; typedef struct zpool_handle zpool_handle_t; typedef struct libzfs_handle libzfs_handle_t; typedef struct libzfs_cro_handle libzfs_cro_handle_t; /* * Library initialization */ extern libzfs_handle_t *libzfs_init(void); extern void libzfs_fini(libzfs_handle_t *); extern libzfs_handle_t *zpool_get_handle(zpool_handle_t *); extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *); extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t); extern void libzfs_abort_on_error(libzfs_handle_t *, int, boolean_t); extern int libzfs_errno(libzfs_handle_t *); extern int libzfs_auxerrno(libzfs_handle_t *); extern const char *libzfs_error_action(libzfs_handle_t *); extern const char *libzfs_error_description(libzfs_handle_t *); extern void libzfs_mnttab_init(libzfs_handle_t *); extern void libzfs_mnttab_fini(libzfs_handle_t *); extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t); extern int libzfs_mnttab_find(libzfs_handle_t *, const char *, struct extmnttab *, boolean_t); extern void libzfs_mnttab_add(libzfs_handle_t *, const char *, const char *, const char *); extern void libzfs_mnttab_remove(libzfs_handle_t *, const char *); extern void libzfs_mnttab_reset(libzfs_handle_t *); extern int libzfs_mnttab_scan(libzfs_handle_t *, dev_t, struct extmnttab *); extern int libzfs_mnttab_scan_path(libzfs_handle_t *, const char *, struct extmnttab *, boolean_t); extern void libzfs_mnttab_update(libzfs_handle_t *); extern libzfs_cro_handle_t *libzfs_get_cro_hdl(libzfs_handle_t *); extern void libzfs_set_automount(libzfs_handle_t *, boolean_t); typedef int (*libzfs_spawn_f)(const char *, char **, void *); extern void libzfs_set_spawn(libzfs_handle_t *, libzfs_spawn_f, void *); extern boolean_t libzfs_globalzone(libzfs_handle_t *); /* * Basic handle functions */ extern zpool_handle_t *zpool_open(libzfs_handle_t *, const char *); extern zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *); extern int zpool_open_quiet(libzfs_handle_t *, const char *, zpool_handle_t **); extern void zpool_close(zpool_handle_t *); extern const char *zpool_get_name(zpool_handle_t *); extern int zpool_get_state(zpool_handle_t *); extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t); extern void zpool_free_handles(libzfs_handle_t *); extern void *zpool_get_old_mon_data(zpool_handle_t *); extern void zpool_add_old_mon_data(zpool_handle_t *, void *); extern void zpool_reopen(libzfs_handle_t *, const char *); /* * Iterate over all active pools in the system. */ typedef int (*zpool_iter_f)(zpool_handle_t *, void *); extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *); /* * Functions to create and destroy pools */ extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *, nvlist_t *, nvlist_t *); extern int zpool_destroy(zpool_handle_t *); extern int zpool_add(zpool_handle_t *, nvlist_t *, nvlist_t *); extern int zpool_retention_destroyable(zpool_handle_t *); extern int zpool_retention_destroyable_byname(libzfs_handle_t *lzhp, const char *pool); extern boolean_t zpool_retention_future(libzfs_handle_t *hdl, uint64_t ts); extern boolean_t zpool_has_redundancy(libzfs_handle_t *hdl, char *pool_name); typedef struct splitflags { /* do not split, but return the config that would be split off */ uint_t dryrun : 1; /* after splitting, import the pool */ uint_t import : 1; } splitflags_t; /* * Functions to manipulate pool and vdev state */ extern int zpool_scan(zpool_handle_t *, pool_scan_func_t); extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *, boolean_t); typedef struct zfs_scan_handle { uint64_t sh_action_handle; int sh_cleanup_fd; } zfs_scan_handle_t; extern int zfs_scan_suspend(zpool_handle_t *, zfs_scan_handle_t *); extern int zfs_scan_resume(zpool_handle_t *, zfs_scan_handle_t *); extern int zpool_vdev_online(zpool_handle_t *, const char *, int, vdev_state_t *); extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); extern int zpool_vdev_attach(zpool_handle_t *, const char *, const char *, nvlist_t *, int); extern int zpool_vdev_detach(zpool_handle_t *, const char *); extern int zpool_vdev_remove_list(zpool_handle_t *, char **, int); extern int zpool_vdev_remove(zpool_handle_t *, const char *); extern int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, nvlist_t *, splitflags_t); extern int zpool_vdev_fault(zpool_handle_t *, uint64_t, void *); extern int zpool_vdev_degrade(zpool_handle_t *, uint64_t, void *); extern int zpool_vdev_clear(zpool_handle_t *, uint64_t); extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *, boolean_t *, boolean_t *, boolean_t *, uint64_t *__ashift); extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *, int, int *); extern nvlist_t *zpool_make_root_vdev(libzfs_handle_t *, zpool_handle_t *, boolean_t, int, boolean_t, boolean_t, int, int, char **); extern nvlist_t *zpool_make_root_vdev_checkboot(libzfs_handle_t *, zpool_handle_t *, boolean_t, int, boolean_t, boolean_t, int, int, char **); extern nvlist_t *zpool_split_root_vdev(zpool_handle_t *, char *, nvlist_t *, splitflags_t, int, char **); extern boolean_t zpool_vdev_is_clearable(libzfs_handle_t *, char *); extern boolean_t zpool_is_removing(nvlist_t *__nvroot); /* * Property management. */ #define ZFS_GET_NCOLS 5 #define ZFS_MAX_HELP_COL 80 typedef enum { GET_COL_NONE, GET_COL_NAME, GET_COL_PROPERTY, GET_COL_VALUE, GET_COL_RECVD, GET_COL_SOURCE } zfs_get_column_t; typedef enum { ZPROP_SHOWTYPE_NONE, /* properties are not displayed */ ZPROP_SHOWTYPE_LIST, /* each property is its own value column */ ZPROP_SHOWTYPE_GET /* properties share a single value column */ } zprop_showtype_t; /* * This property description supports built-in ZFS properties and registered * external properties defined outside of ZFS. */ typedef struct zpropdef { const char *zpd_name; /* property name */ const char *zpd_owner; /* property owner */ void *zpd_opaque; /* property description */ const char *zpd_deleg; /* delegated permission */ int zpd_prop_id; /* -1 if not a property */ int zpd_sublist_id; /* -1 if not a sublist */ /* * NULL if not in a sublist */ const struct zpropdef *zpd_parent_sublist; /* * Bitmask of zfs_type_t values {poo||fs|snap|vol|share} for which this * property is valid. If this entry is a sublist, the bitmask is a * summary (OR'ing together) of the valid types across all properties in * the sublist to any depth. */ int zpd_zfs_types; const char *const *zpd_values_list; /* for error message */ int zpd_nvalues; /* zpd_values_list count */ } zpropdef_t; typedef struct zprop_list { const zpropdef_t *pl_prop; char *pl_user_prop; struct zprop_list *pl_next; struct zprop_list *pl_alias; /* resolution depends on zfs_handle_t */ boolean_t pl_all; boolean_t pl_group; /* requested as part of a sublist */ size_t pl_width; size_t pl_recvd_width; boolean_t pl_fixed; /* fixed width */ zprop_source_t pl_source; int pl_ntimes; /* needed by how many datasets? */ } zprop_list_t; typedef struct zprop_get_cbdata { libzfs_handle_t *cb_hdl; int cb_sources; zfs_get_column_t cb_columns[ZFS_GET_NCOLS]; int cb_colwidths[ZFS_GET_NCOLS + 1]; boolean_t cb_scripted; boolean_t cb_literal; boolean_t cb_first; boolean_t cb_goterror; zprop_list_t *cb_proplist; zfs_type_t cb_type; zfs_type_t cb_visited_types; const char *cb_prefix; int cb_prefixlen; boolean_t cb_expand_sublists; } zprop_get_cbdata_t; typedef enum zprop_spec { ZPROP_PROPERTY, ZPROP_SUBLIST, ZPROP_PROPERTY_OR_SUBLIST, ZPROP_INTERNAL, ZPROP_EXTERNAL } zprop_spec_t; #define ZPROP_IS_SUBLIST(_xpd) ((_xpd) != NULL && (_xpd)->zpd_sublist_id > 0) #define ZPROP_IS_PROPERTY(_xpd) ((_xpd) != NULL && (_xpd)->zpd_prop_id >= 0) /* This is a registered property defined outside of ZFS */ #define ZPROP_IS_EXTERNAL(_xpd) (ZPROP_IS_PROPERTY(_xpd) && \ zprop_propnum(_xpd) == ZPROP_INVAL) /* This is a built-in ZFS property */ #define ZPROP_IS_INTERNAL(_xpd) (ZPROP_IS_PROPERTY(_xpd) && \ zprop_propnum(_xpd) != ZPROP_INVAL) /* * Returned by zprop_func in zfs_prop_iter(). * * ZPROP_STOP: we don't need to iterate any further * ZPROP_ERR: iteration should stop because of an error * ZPROP_CONT: iteration should continue */ #define ZPROP_STOP 0 #define ZPROP_ERR ZPROP_INVAL typedef int zprop_func(const zpropdef_t *, void *); typedef boolean_t zprop_filter_f(zfs_prop_t, const char *, zprop_source_t); /* * These property management functions are layered on top of old style * index-based functions to add support for external properties. * * Property functions specific to zfs. */ extern int zfs_zprop_lookup(libzfs_handle_t *, const char *, zprop_spec_t, const zpropdef_t **); extern int zfs_zprop_iter(libzfs_handle_t *, const char *, boolean_t, zprop_func *, void *); extern int zfs_zprop_count(libzfs_handle_t *, zprop_spec_t); extern int zprop_count(libzfs_handle_t *, zfs_type_t __type, zprop_spec_t); extern const zpropdef_t *zfs_zprop(libzfs_handle_t *, int); extern int zfs_zprop_name_to_id(libzfs_handle_t *, const char *__name); extern const char *zfs_zprop_id_to_name(libzfs_handle_t *, int); extern int zfs_register_default_sublist(libzfs_handle_t *, const char *); extern void zfs_unregister_default_sublist(libzfs_handle_t *, const char *); extern boolean_t zfs_prop_remap_is_valid(zfs_handle_t *, int); extern int zfs_prop_get_unaliased(zfs_handle_t *, zfs_prop_t, char *, size_t, zprop_source_t *, char *, size_t); extern int zfs_prop_set_unaliased(zfs_handle_t *, const char *, const char *, zprop_setflags_t); extern int zfs_zprop_get(zfs_handle_t *, const zpropdef_t *, char *, size_t, zprop_source_t *, char *, size_t, boolean_t); extern void zfs_get_collapsed_sublist(zfs_handle_t *, const zpropdef_t *, char *, size_t, zprop_source_t *, char *, size_t, boolean_t); extern void zfs_get_collapsed_source(zfs_handle_t *, zfs_prop_t *, zprop_source_t *, char *, size_t, zprop_filter_f *); extern void zfs_share_protocols_source(zfs_handle_t *, zprop_source_t *, char *, size_t); /* * Property functions specific to zpool. */ extern const zpropdef_t *zpool_zprop(libzfs_handle_t *, int); /* * Property functions common to zfs and zpool. */ extern int zprop_lookup(libzfs_handle_t *, zfs_type_t, const char *, zprop_spec_t, const zpropdef_t **); extern int zprop_iter(libzfs_handle_t *, zfs_type_t, const char *, boolean_t, zprop_func *, void *); extern const char *zprop_name(const zpropdef_t *); extern int zprop_id(const zpropdef_t *); extern int zprop_propnum(const zpropdef_t *); extern boolean_t zprop_valid_for_type(const zpropdef_t *, zfs_type_t); extern zprop_type_t zprop_type(const zpropdef_t *); extern boolean_t zprop_is_boolean(const zpropdef_t *); extern boolean_t zprop_is_string(const zpropdef_t *); extern const char *zprop_strdefault(const zpropdef_t *); extern uint64_t zprop_numdefault(const zpropdef_t *); extern boolean_t zprop_readonly(const zpropdef_t *); extern boolean_t zprop_inheritable(const zpropdef_t *); extern boolean_t zprop_setonce(const zpropdef_t *); extern boolean_t zprop_readonly(const zpropdef_t *); extern const char *zprop_values(const zpropdef_t *); extern int zprop_nvalues(const zpropdef_t *); extern const char *zprop_value(const zpropdef_t *, int); extern boolean_t zprop_is_size(const zpropdef_t *); extern const char *zprop_deleg(const zpropdef_t *); extern boolean_t zprop_visible(const zpropdef_t *); extern boolean_t zprop_align_right(const zpropdef_t *); extern const char *zprop_column_name(const zpropdef_t *); extern int zprop_source_cmp(zprop_source_t, zprop_source_t); /* * Property list functions. */ extern int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **, zfs_type_t, zprop_showtype_t, boolean_t); extern void zprop_free_list(zprop_list_t *); extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, int, boolean_t, boolean_t, zprop_showtype_t); extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *, nvlist_t *); extern zprop_list_t *zfs_proplist_first(zprop_list_t *); extern zprop_list_t *zfs_proplist_next(zprop_list_t *); extern int zfs_proplist_resolve_alias(zfs_handle_t *, zprop_list_t *, zprop_list_t **); typedef size_t (*zfs_proplist_width_f)(zprop_list_t *, void *); extern size_t zfs_proplist_width(zprop_list_t *, zfs_proplist_width_f, void *); /* * Property list functions specific to zpool. */ extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **, zprop_showtype_t); /* * Property help functions. */ extern void zprop_print_tall(libzfs_handle_t *, zfs_type_t __type, FILE *__fp); extern void zprop_print_list(libzfs_handle_t *, zfs_type_t __type, FILE *__fp, boolean_t __deleg_only); extern void zprop_print_quota(libzfs_handle_t *, FILE *__fp); int zprop_parse_value(libzfs_handle_t *, nvpair_t *, int, zfs_type_t, nvlist_t *, char **, uint64_t *, const char *); extern void zprop_print_one_property(const char *, zprop_get_cbdata_t *, const char *, const char *, zprop_source_t, const char *, const char *); extern void zprop_describe_prop(FILE *, int, zfs_type_t); extern void zprop_describe(FILE *__fp, const zpropdef_t *__zpd); extern void zprop_describe_quota(FILE *, const char *); /* * zfs_valid_proplist() flags */ typedef enum { ZFS_PROPLIST_NOVALIDATE = 0x1, ZFS_PROPLIST_UNMAPPED = 0x2, ZFS_PROPLIST_FROM_CLONE_ORIGIN = 0x4, ZFS_PROPLIST_FORCE = 0x8 } zfs_proplist_flags_t; /* * Property nvlist functions. */ extern int zfs_prop_nvlist_add(libzfs_handle_t *, nvlist_t *, const char *, void *, zprop_source_t, zprop_setflags_t); /* * Old style property management functions use a property index (zfs_prop_t) * into an array of built-in ZFS properties. Some functions are shared with the * kernel and are found in sys/fs/zfs.h. * * Functions that take a string (char *) instead of an index (zfs_prop_t) are * updated to handle external properties and don't need a zfs_zprop_* function * overlay. */ /* * zfs dataset property management */ extern const char *zfs_prop_default_string(zfs_prop_t); extern uint64_t zfs_prop_default_numeric(zfs_prop_t); extern const char *zfs_prop_column_name(zfs_prop_t); extern boolean_t zfs_prop_align_right(zfs_prop_t); extern const char *zfs_prop_to_name(zfs_prop_t); extern int zfs_prop_set(zfs_handle_t *, const char *, const char *); extern int zfs_prop_set_extended(zfs_handle_t *, const char *, const char *, zprop_setflags_t); extern int zfs_prop_set_int(zfs_handle_t *, zfs_prop_t, uint64_t); extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t, zprop_source_t *, char *, size_t, boolean_t); extern int zfs_prop_get_persistent(zfs_handle_t *, zfs_prop_t, char *, size_t, zprop_source_t *, char *, size_t, boolean_t, boolean_t *); extern int zfs_prop_get_recvd(zfs_handle_t *, const char *, char *, size_t, boolean_t); extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *, zprop_source_t *, char *, size_t); extern int zfs_prop_get_userquota_int(zfs_handle_t *__zhp, const char *__propname, uint64_t *__propvalue); extern int zfs_prop_get_userquota(zfs_handle_t *__zhp, const char *__propname, char *__propbuf, int __proplen, boolean_t __literal, zprop_source_t *__sourcetype); extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t); extern boolean_t zfs_prop_is_error(zfs_handle_t *, zfs_prop_t); extern boolean_t zfs_prop_get_error(zfs_handle_t *, zfs_prop_t, int *); extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t); extern int zfs_prop_predict(zfs_handle_t *, const char *, void *, zprop_source_t, zprop_setflags_t, nvlist_t **); extern int zfs_props_predict(zfs_handle_t *, nvlist_t *, zprop_setflags_t, nvlist_t **); extern const char *zfs_prop_values(zfs_prop_t); extern int zfs_prop_is_string(zfs_prop_t __prop); extern nvlist_t *zfs_get_user_props(zfs_handle_t *); extern nvlist_t *zfs_get_recvd_props(zfs_handle_t *); /* * zpool property management */ extern const char *zpool_prop_default_string(zpool_prop_t); extern uint64_t zpool_prop_default_numeric(zpool_prop_t); extern const char *zpool_prop_column_name(zpool_prop_t); extern boolean_t zpool_prop_align_right(zpool_prop_t); extern int zpool_set_prop(zpool_handle_t *, const char *, const char *); extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, size_t __proplen, zprop_source_t *); extern boolean_t zpool_is_bootable(zpool_handle_t *); extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t, zprop_source_t *); extern const char *zpool_prop_to_name(zpool_prop_t); extern const char *zpool_prop_values(zpool_prop_t); /* * Functions shared by zfs and zpool property management. */ extern int zc_prop_iter(zc_prop_func __func, void *__cb, boolean_t __show_all, boolean_t __ordered, zfs_type_t __type); /* * Pool health statistics. */ typedef enum { /* * The following correspond to faults as defined in the (fault.fs.zfs.*) * event namespace. Each is associated with a corresponding message ID * as defined in zfs_msgid_table[] in libzfs_status.c. * The following are pool level failures. */ ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt or outdated cachefile */ ZPOOL_STATUS_BAD_GUID_SUM, /* sum of device guids didn't match */ ZPOOL_STATUS_CORRUPT_POOL, /* pool metadata is corrupted */ ZPOOL_STATUS_CORRUPT_DATA, /* data errors in user (meta)data */ ZPOOL_STATUS_VERSION_NEWER, /* newer on-disk version */ ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */ ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */ ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */ ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */ ZPOOL_STATUS_POOL_GUID_MISMATCH, /* uberblocks overwritten */ /* * The following are device level failures. The original reason for * the failure is available through FMA msgid. */ ZPOOL_STATUS_FAILING_LOG, /* degraded log device */ ZPOOL_STATUS_FAILING_DEV, /* degraded device */ ZPOOL_STATUS_UNUSABLE_DEV_R, /* faulted device with replicas */ ZPOOL_STATUS_UNUSABLE_DEV_NR, /* faulted device with no replicas */ ZPOOL_STATUS_DEGRADED_DEV_DTL, /* degraded device with dtl */ /* * The following are not faults per se, but still an error possibly * requiring administrative attention. There is no corresponding * message ID. */ ZPOOL_STATUS_VERSION_OLDER, /* older on-disk version */ ZPOOL_STATUS_RESILVERING, /* device being resilvered */ ZPOOL_STATUS_OFFLINE_DEV, /* device online */ ZPOOL_STATUS_REMOVED_DEV, /* removed device */ ZPOOL_STATUS_TEMP_IMPORT, /* imported using a temporary name */ ZPOOL_STATUS_CLEARED, /* pool's labels are cleared */ /* * Finally, the following indicates a healthy pool. */ ZPOOL_STATUS_OK } zpool_status_t; extern zpool_status_t zpool_get_status(zpool_handle_t *, char **); extern zpool_status_t zpool_import_status(nvlist_t *, char **); extern void zpool_dump_ddt(const ddt_stat_t *__dds, const ddt_histogram_t *__ddh); /* * Statistics and configuration functions. */ extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **); extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *); extern int zpool_get_errlog(zpool_handle_t *, boolean_t, nvlist_t **); extern int zpool_get_monitor_data(zpool_handle_t *, char *, nvlist_t **); extern int zpool_wait_zombie(zpool_handle_t *, int, int); /* * Import and export functions */ extern int zpool_export(zpool_handle_t *, boolean_t); extern int zpool_export_force(zpool_handle_t *); extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *, char *__altroot); extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *, nvlist_t *, int, nvlist_t **); extern int zpool_evict_data(zpool_handle_t *); /* * Hold and release all datasets in the pool */ extern int zpool_dataset_hold_all(zpool_handle_t *); extern void zpool_dataset_rele_all(int); /* * Search for pools to import */ typedef struct importargs { char **path; /* a list of paths to search */ int paths; /* number of paths to search */ char *poolname; /* name of a pool to find */ uint64_t guid; /* guid of a pool to find */ char *cachefile; /* cachefile to use for import */ uint_t can_be_active : 1; /* can the pool be active? */ uint_t unique : 1; /* does 'poolname' already exist? */ uint_t exists : 1; /* set on return if pool already exists */ uint_t trust_cache : 1; /* can the cachefile be trusted? */ uint_t no_validation : 1; /* do not validate pool config */ uint_t cleared : 1; /* must have cleared label */ } importargs_t; extern int zpool_search_import(libzfs_handle_t *, importargs_t *, nvlist_t **); /* non-pool-specific functions */ extern uint64_t zpool_all_retained_fs_count(libzfs_handle_t *); /* legacy pool search routines and contracted interfaces */ extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **); extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *, char *, uint64_t); extern nvlist_t *zpool_find_import_cluster(libzfs_handle_t *, char *, uint64_t, const char *, boolean_t, char **, int); typedef struct zpool_history { nvlist_t **zh_records; uint_t zh_numrec; uint_t zh_index; uint64_t zh_time; uint64_t zh_hires; uint64_t zh_txg; } zpool_history_t; typedef int (*hist_func)(void *, uint64_t *, uint64_t *, char *, history_object_t); /* * Miscellaneous pool functions */ struct zfs_cmd; extern const zfs_history_event_info_t zfs_history_event_table[LOG_END]; extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, boolean_t __verbose, boolean_t __location); extern char *zpool_vdev_name_impl(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, boolean_t, boolean_t, boolean_t); extern int zpool_validate_path(zpool_handle_t *__zhp, nvlist_t *__nv, char **__pathp); extern int zpool_upgrade(zpool_handle_t *, uint64_t); extern int zpool_reguid_ok(zpool_handle_t *); extern int zpool_print_metaslab_stats(FILE *__fp, zpool_handle_t *__zhp, char *__argv[], int __argc); extern int zpool_get_history(void *, uint64_t *, uint64_t *, char *, history_object_t); extern int zpool_print_history(void *, hist_func, history_flags_t); extern void zpool_set_history_str(const char *__subcommand, int __argc, char **__argv, char *__history_str); extern int zpool_stage_history(libzfs_handle_t *, const char *); extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, size_t __len); extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *); extern int zpool_get_physpath(zpool_handle_t *, char *, size_t); extern void zpool_explain_recover(libzfs_handle_t *, const char *, int, nvlist_t *); extern nvlist_t *zpool_read_cachefile(libzfs_handle_t *, const char *); /* Crypto related functions */ typedef enum { ZFS_CRYPTO_CREATE, ZFS_CRYPTO_PCREATE, ZFS_CRYPTO_CLONE, ZFS_CRYPTO_RECV, ZFS_CRYPTO_KEY_LOAD, ZFS_CRYPTO_KEY_CHANGE, ZFS_CRYPTO_RECV_INCR } zfs_crypto_zckey_t; struct zfs_crypto_keypolicy_cb; typedef int (*zfs_crypto_keys_cb_t)(struct zfs_crypto_keypolicy_cb *, char *keysource); typedef struct zfs_crypto_keypolicy_cb { zfs_crypto_keys_cb_t zckc_keyallowed_cb; void *zckc_data; } zfs_crypto_keypolicy_cb_t; typedef enum { ZFS_RENAME_DISABLE_KEYSOURCE_CHECK = 0x1, ZFS_RENAME_DISABLE_RECURSION_CHECK = 0x2 } zfs_rename_extra_flag_t; extern boolean_t is_crypt_discarded(nvlist_t *); extern boolean_t is_keysource_discarded(nvlist_t *); extern int zfs_crypto_zckey(libzfs_handle_t *, zfs_crypto_zckey_t, nvlist_t *, nvlist_t *, struct zfs_cmd *); extern int zfs_crypto_rename_check(zfs_handle_t *, struct zfs_cmd *, zfs_rename_extra_flag_t); extern boolean_t zfs_valid_keysource(libzfs_handle_t *, char *); extern boolean_t zfs_valid_set_keysource_change(zfs_handle_t *, char *); extern boolean_t zfs_mount_crypto_check(zfs_handle_t *); extern void libzfs_crypto_set_key(libzfs_handle_t *, char *, size_t); extern void zfs_crypto_set_key(zfs_handle_t *, char *, size_t); extern void zfs_crypto_set_clone_newkey(zfs_handle_t *); extern int libzfs_crypto_set_key_policy(libzfs_handle_t *, zfs_crypto_keys_cb_t, void *); extern void libzfs_crypto_unset_key_policy(libzfs_handle_t *); extern void zfs_get_crypto_props(nvlist_t *, uint64_t *, char **); extern int libzfs_crypto_get_key_count(zfs_handle_t *, uint_t *); typedef enum { ZFS_STATE_NORMAL = 0x1, ZFS_STATE_DESTROYING = 0x2, /* In the process of being destroyed */ ZFS_STATE_INCONSISTENT = 0x4, /* Not mountable - could be resumable */ ZFS_STATE_RESUMABLE = 0x8, /* Resumable dataset */ ZFS_STATE_ZOMBIE = 0x10, /* In the zombie queue */ ZFS_STATE_HIDDEN_SNAP = 0x20 /* hidden snap with clone */ } zfs_state_t; /* * Basic handle manipulations. These functions do not create or destroy the * underlying datasets, only the references to them. */ extern zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int); extern zfs_handle_t *zfs_open_quiet(libzfs_handle_t *__hdl, const char *__path, int __types); extern void zfs_close(zfs_handle_t *); extern zfs_type_t zfs_get_type(const zfs_handle_t *); extern zfs_type_t zfs_get_head_type(const zfs_handle_t *); extern zfs_state_t zfs_get_state(const zfs_handle_t *, char *, int); extern const char *zfs_get_name(const zfs_handle_t *); extern boolean_t zfs_is_share(const zfs_handle_t *); extern boolean_t zfs_is_auto_share(const zfs_handle_t *); extern zfs_handle_t *zfs_share_to_fs(const zfs_handle_t *); extern zfs_handle_t *zfs_fs_to_auto_share(const zfs_handle_t *); extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *); struct zfs_handle_cache; /* opaque zfs_handle_t cache */ typedef struct zfs_handle_cache zfs_handle_cache_t; zfs_handle_cache_t *libzfs_get_cache(libzfs_handle_t *); /* * zfs_handle_t cache functions */ extern zfs_handle_cache_t *zfs_cache_open(libzfs_handle_t *); extern void zfs_cache_close(libzfs_handle_t *); extern void zfs_cache_clear(zfs_handle_cache_t *); extern zfs_handle_t *zfs_cache_get(libzfs_handle_t *, const char *, zfs_type_t); extern zfs_handle_t *zfs_cache_get_quiet(libzfs_handle_t *, const char *, zfs_type_t); extern boolean_t zfs_cache_add(zfs_handle_cache_t *, zfs_handle_t *); extern void zfs_cache_remove(zfs_handle_cache_t *, zfs_handle_t *); extern boolean_t zfs_cache_contains(zfs_handle_cache_t *, const char *, zfs_type_t, zfs_handle_t **); extern zfs_handle_cache_t *zfs_get_cache(zfs_handle_t *); extern zfs_handle_cache_t *libzfs_get_cache(libzfs_handle_t *); extern boolean_t libzfs_cache_enable(libzfs_handle_t *); extern void libzfs_cache_disable(libzfs_handle_t *); extern void libzfs_cache_clear(libzfs_handle_t *); extern boolean_t libzfs_is_cache_enabled(libzfs_handle_t *); extern boolean_t zfs_is_cached(zfs_handle_t *); extern void zfs_uncache_and_close(zfs_handle_t *); extern void zfs_close_uncached(zfs_handle_t *); /* * Iterator functions. */ typedef int (*zfs_iter_f)(zfs_handle_t *, void *); extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_children_ex(zfs_handle_t *, zfs_type_t, boolean_t, zfs_iter_f, void *); extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); extern int zfs_iter_dependents_ex(zfs_handle_t *, boolean_t, boolean_t, zfs_iter_f, void *); extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_filesystems_ex(zfs_handle_t *, boolean_t, zfs_iter_f, void *); extern int zfs_iter_snapshots(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_snapshots_ex(zfs_handle_t *, boolean_t, boolean_t, zfs_iter_f, void *); extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); extern int zfs_iter_shares(zfs_handle_t *, zfs_iter_f, void *); extern int zpool_iter_pool_retained_ds(zpool_handle_t *, zfs_iter_f, void *); extern int zfs_cache_iter_filesystems(libzfs_handle_t *, zfs_handle_t *, zfs_iter_f, void *); extern int zfs_cache_iter_shares(libzfs_handle_t *, zfs_handle_t *, zfs_iter_f, void *); extern int zfs_cache_iter_children(libzfs_handle_t *, zfs_handle_t *, zfs_iter_f, void *); extern int zfs_cache_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f __func, void *__data); extern int zfs_cache_iter_dependents_ex(zfs_handle_t *, boolean_t, boolean_t, zfs_iter_f __func, void *__data); extern int zfs_cache_iter_root(libzfs_handle_t *, zfs_iter_f, void *); typedef struct get_all_cb { zfs_handle_t **cb_handles; size_t cb_alloc; size_t cb_used; boolean_t cb_verbose; int (*cb_getone)(zfs_handle_t *, void *); } get_all_cb_t; void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *); int libzfs_dataset_cmp(const void *, const void *); typedef int (*zfs_hold_iter_f)(zfs_handle_t *, const char *, void *); extern int zfs_iter_holds(zfs_handle_t *, zfs_hold_iter_f, void *); struct ofmt_state_s; /* options requested from the CLI */ typedef enum retained_options { RETOPT_PRIVILEGED = 1, RETOPT_MANDATORY = 2, RETOPT_UNEXPIRED = 4, RETOPT_EXPIRED = 8, RETOPT_AUTO = 0x10, RETOPT_NOAUTO = 0x20, RETOPT_FILENAME_ONLY = 0x40, RETOPT_PARSABLE = 0x80, RETOPT_AUDITFMT = 0x100, RETOPT_AUTODELETE = 0x200, RETOPT_HELD = 0x400, RETOPT_AUTODELETED = 0x800 } retained_file_options_t; typedef struct retained_ds { uint64_t rd_obj; char rd_name[MAXPATHLEN+1]; uint64_t rd_rtime; char rd_pool_name[MAXPATHLEN+1]; uint64_t rd_pool_rtime; auto_retention_type_t rd_automatic; boolean_t rd_recurse; boolean_t rd_first; retained_file_options_t rd_options; struct ofmt_state_s *rd_ofmt; retention_onexpiry_t rd_onexpiry; } retained_ds_t; extern int zfs_iter_ds_retained_files(zfs_handle_t *zhp, zfs_iter_f func, void *data); typedef struct retained_file { uint64_t rf_obj; char rf_name[MAXPATHLEN+1]; uid_t rf_uid; gid_t rf_gid; uint64_t rf_mode; uint64_t rf_atime; uint64_t rf_mtime; uint64_t rf_ctime; uint64_t rf_crtime; uint64_t rf_rtime; uint64_t rf_size; uint64_t rf_pflags; uint64_t rf_ds_rtime; struct ofmt_state_s *rf_ofmt; uint64_t rf_nameerr; zfs_retention_policy_t rf_ds_policy; auto_retention_type_t rf_ds_automatic; retention_onexpiry_t rf_ds_onexpiry; boolean_t rf_first; retained_file_options_t rf_options; boolean_t rf_ispool; } retained_file_t; extern int zfs_iter_ds_retained_files(zfs_handle_t *zhp, zfs_iter_f func, void *data); extern const char *zfs_retention_policy(zfs_retention_policy_t policy); extern const char *zfs_retention_onexpiry(retention_onexpiry_t policy); extern int zfs_retention_autodelete(zfs_handle_t *zhp); /* * Functions to create and destroy datasets. */ #define DESTROY_FAIL_TYPE "destroy_fail_type" #define DESTROY_FAIL_LIST "destroy_fail_list" #define DESTROY_FAIL_DSNAME "destroy_fail_dsname" #define DESTROY_FAIL_TYPE_CHILDREN "destroy_fail_type_children" #define DESTROY_FAIL_TYPE_CLONES "destroy_fail_type_clones" extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t, nvlist_t *); extern int zfs_check_parents(libzfs_handle_t *, const char *, uint64_t *, boolean_t, int *); extern int zfs_set_fsid(libzfs_handle_t *, const char *, uint64_t); extern int zfs_reset_fsid(libzfs_handle_t *, const char *, uint64_t); extern int zfs_get_fsid(libzfs_handle_t *, const char *, uint64_t *); extern int zfs_get_mountpoint_dev(libzfs_handle_t *, const char *, uint64_t *); extern int zfs_remove_fsid(libzfs_handle_t *, const char *, uint64_t *); extern int zfs_create_ancestors(libzfs_handle_t *, const char *); extern int zfs_destroy(zfs_handle_t *, uint64_t, nvlist_t **__dfl); extern int zfs_retention_destroyable(zfs_handle_t *zhp, char *offending_fsname); extern int zfs_retention_destroyable_byname(libzfs_handle_t *lzhp, const char *dsname, char *offending_fsname); extern boolean_t zfs_has_resumable(zfs_handle_t *); extern void zfs_destroy_resumable(zfs_handle_t *); extern int zfs_destroy_snaps(zfs_handle_t *, char *, uint64_t); extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); typedef enum snapfilter_action { SNAP_FILTER_EXCLUDE, SNAP_FILTER_INCLUDE, SNAP_FILTER_INCLUDE_DESCENDANTS } snapfilter_action_t; typedef snapfilter_action_t (*snap_filter_f)(libzfs_handle_t *hdl, void *cb_arg, zfs_handle_t *__zhp); extern snapfilter_action_t zfs_snap_recursive_all(libzfs_handle_t *, void *, zfs_handle_t *__zhp); extern snapfilter_action_t zfs_snap_not_recursive(libzfs_handle_t *, void *, zfs_handle_t *__zhp); extern int zfs_snapshot(libzfs_handle_t *, const char *__path, nvlist_t *, snap_filter_f, void *); #define SNAP_RECURSIVE_ALL zfs_snap_recursive_all #define SNAP_NOT_RECURSIVE zfs_snap_not_recursive extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); extern int zfs_rename(zfs_handle_t *, const char *, boolean_t); extern int zfs_rename_ex(zfs_handle_t *, const char *, boolean_t, zfs_rename_extra_flag_t); typedef struct cutoverflags { uint_t recurse : 1; uint_t verbose : 1; uint_t finalpass : 1; } cutoverflags_t; extern int zfs_cutover(zfs_handle_t *, zfs_handle_t *, char *, char *, int, cutoverflags_t); typedef struct sendflags { /* print informational messages (ie, -v was specified) */ uint_t verbose : 1; /* recursive or replication send (ie, -r or -R) */ uint_t replicate : 1; /* for incrementals, do all intermediate snapshots */ uint_t doall : 1; /* (ie, -I or initial -R) */ /* do deduplication */ uint_t dedup : 1; /* send properties (ie, -p) */ uint_t props : 1; /* send received properties (ie, -b) */ uint_t received : 1; /* self-contained (ie, -c) */ uint_t selfcont : 1; /* don't send stream (ie, -n) */ uint_t dryrun : 1; /* output goes to stderr (ie, -s streamsize) */ uint_t streamsize : 1; /* output goes to stderr (ie, -s memsize) */ uint_t memsize : 1; /* output memsize before or after streamsize) */ uint_t memsizefirst : 1; /* suppress warnings about missing snapshots during gather */ uint_t warn_missing_snaps : 1; /* send a raw stream */ uint_t raw : 1; /* Send TOC only: for restartable replication (zfs receive -C) */ uint_t send_toc_only : 1; /* Prevent use of checksum stream format (zfs send -s nocheck) */ uint_t nocheck : 1; /* Return EZFS_SEND_COMPLETE if target has everything it needs */ uint_t noemptystream : 1; /* Non-strict mode allows "broken" sends that target can handle OK. */ uint_t nostrict : 1; /* If using "generic" datasets, avoid collapsing origin into clone */ uint_t generic_datasets : 1; /* raw send crypto with no key needed */ uint_t rawcrypto : 1; } sendflags_t; typedef struct sendstats { uint64_t bytes_logical_estimate; /* estimated logical bytes in stream */ uint64_t bytes_raw_estimate; /* estimated bytes in stream */ uint64_t bytes_refined_estimate; /* estimated bytes in dedup stream */ uint64_t bytes_logical; /* logical stream size sent */ uint64_t bytes_raw; /* stream size sent raw compress */ uint64_t bytes_refined; /* actual stream size sent w/dedup */ uint64_t bytes_from_raw_estimate; /* estimated raw bytes in fromsnap */ uint64_t bytes_from_logical_estimate; /* est log bytes in fromsnap */ uint64_t blks_wire_estimate; /* init estimate # blocks in stream */ uint64_t blks_from_estimate; /* init estimate # blocks in fromsnap */ boolean_t reverted; /* ddsend reverted to non-ddsend */ boolean_t restricted; /* ddsend restricted by memory limit */ uint64_t blks_wire; /* # blks seen during wire bloom pass */ uint64_t bytes_wire; /* # bytes seen during wire bloom pass */ uint64_t blks_from; /* # blks seen during from bloom pass */ uint64_t bytes_from; /* # bytes seen during from bloom pass */ uint64_t blks_total; /* # blks sent on the wire */ uint64_t blks_full; /* # full blks sent on wire; no dups */ uint64_t blks_seminal; /* # full blks sent on wire; with dups */ uint64_t blks_hollow; /* # hollow blks (aka dups) sent on wire */ uint64_t bytes_nomem; /* bytes not hollowed because lack of memory */ uint64_t predict_wire_hollows; /* est # hollow blks using wire sems */ uint64_t predict_wire_bytes_saved; /* est bytes saved using wire sems */ uint64_t predict_from_hollows; /* est # hollow blks using from sems */ uint64_t predict_from_bytes_saved; /* est bytes saved using from sems */ uint64_t recs_total; /* records sent; all types */ uint64_t bytes_sent; /* actual bytes sent; non-hollow blks */ uint64_t bytes_saved; /* actual bytes saved by hollowing */ uint64_t wirebloom_memory; /* wire bloom size */ uint64_t wirebloom_entrylimit; /* # entries limit in wire bloom */ uint64_t wirebloom_entries; /* # entries in wire bloom */ uint64_t wirebloom_rejects; /* # entries attempted over limit */ double wirebloom_bpe_req; /* wirebloom bits per entry requested */ double wirebloom_fpr_req; /* wirebloom false pos rate requested */ uint64_t dupsbloom_memory; /* dups bloom size */ uint64_t dupsbloom_entrylimit; /* # entries limit in dups bloom */ uint64_t dupsbloom_entries; /* # entries in dups bloom */ uint64_t dupsbloom_rejects; /* # entries attempted over limit */ double dupsbloom_bpe_req; /* dupsbloom bits per entry requested */ double dupsbloom_fpr_req; /* dupsbloom false pos rate requested */ uint64_t dupsddt_memory; /* ddt hash table size */ uint64_t dupsddt_entrylimit; /* # entries limit in ddt hash table */ uint64_t dupsddt_entries; /* # entries in ddt hash table */ uint64_t dupsddt_rejects; /* # entries attempted over limit */ uint64_t dupsddt_maxlist; /* max list length of hash buckets */ uint64_t memory_limit_phys; /* physical memory limit */ uint64_t memory_limit; /* initial memory limit, user or phys */ uint64_t memory_min_estimate; /* initial min memory estimate */ uint64_t memory_max_estimate; /* initial max memory estimate */ uint64_t memory_min_tofinish; /* min memory required from pass3 on */ uint64_t memory_max_tofinish; /* max memory required from pass3 on */ uint64_t memory_high; /* high water (used) memory mark */ uint64_t memory_optimal; /* optimal memory: upper bnd or exact */ boolean_t memory_optimal_isexact; /* optimal memory is exactly known */ uint64_t time_wireinit; /* nsec initializing wire bloom */ uint64_t time_wirefini; /* nsec cleaning up wire bloom */ uint64_t time_dupsinit; /* nsec initializing dups bloom */ uint64_t time_dupsfini; /* nsec cleaning up dups bloom */ uint64_t time_ddtinit; /* nsec initializing ddt hash table */ uint64_t time_ddtfini; /* nsec cleaning up ddt hash table */ uint64_t time_estimate; /* nsec estimating blk countm; pass 0 */ uint64_t time_wirebloom; /* nsec building wire bloom; pass 1 */ uint64_t time_frombloom; /* nsec building dups bloom; pass 2 */ uint64_t time_fromddt; /* nsec building ddt hash; pass 3 */ uint64_t time_onwire; /* nsec sending on the wire; pass 4 */ uint64_t time_total; /* total nsec in prep and sending */ } sendstats_t; /* zfs_send callback */ typedef enum zfs_send_cb_op { ZFS_SEND_STREAM_ESTIMATE = 0x01, ZFS_SEND_DATASET_FILTER, ZFS_SEND_SNAPSHOT_FILTER, ZFS_SEND_MEM_ESTIMATE_INITIAL, ZFS_SEND_MEM_ESTIMATE_REFINED, ZFS_SEND_STREAM_ESTIMATE_REFINED, ZFS_SEND_SENDING_DATA } zfs_send_cb_op_t; typedef boolean_t (zfs_send_cb_t)(zfs_handle_t *, const char *, zfs_send_cb_op_t, void *, uint64_t); typedef struct restart_checkpoint { nvlist_t *tgt_hdrnv; avl_tree_t *tgt_fsavlguid; avl_tree_t *tgt_bookmarks_avl; } restart_checkpoint_t; typedef struct zfs_sendrecv_cancel { pthread_mutex_t zcd_lock; uint_t zcd_cancel_magic; boolean_t zcd_cancel_requested; #define NUM_INTERNAL_FDS 2 int zcd_internal_fds[NUM_INTERNAL_FDS]; } sendrecv_cancel_t; typedef struct checkpoint_flags { /* print informational messages (ie, -v was specified) */ uint_t cpf_verbose : 1; /* Live data migration uses flag not_recursive checkpoint */ uint_t cpf_recursive : 1; /* Include rawkeys in checkpoint */ uint_t cpf_rawcrypto : 1; /* Key verify only */ uint_t cpf_key_verify : 1; /* Checkpoint generation on the receive side */ uint_t cpf_isreceive : 1; } checkpoint_flags_t; typedef struct zfs_checkpoint_args { restart_checkpoint_t **zca_restart_checkpoint; checkpoint_flags_t *zca_checkpoint_flags; sendrecv_cancel_t *zca_sendrecv_cancel; } zfs_checkpoint_args_t; extern int zfs_parse_bookmark(char *, struct restart_bookmark *); extern int zfs_send_checkpoint(zfs_handle_t *, int, zfs_checkpoint_args_t *); typedef struct zfs_send_args { const char *zsa_fromsnap; const char *zsa_tosnap; const char *zsa_tgt_ds; sendflags_t zsa_flags; int zsa_outfd; zfs_send_cb_t *zsa_filter_func; void *zsa_cb_arg; nvlist_t **zsa_debugnvp; sendstats_t *zsa_statistics; nvlist_t *zsa_exclusions; const char *zsa_send_tag; restart_checkpoint_t *zsa_tgt_checkpoint; uint64_t zsa_estimated_size; uint64_t zsa_user_memlimit; uint64_t zsa_user_memlimit_enabled; int zsa_trace_fd; sendrecv_cancel_t *zsa_cancel; } zfs_send_args_t; extern int zfs_send(zfs_handle_t *, zfs_send_args_t *); extern int zfs_estimate(libzfs_handle_t *, sendflags_t, const char *, uint64_t *, snap_filter_f, void *); extern void zfs_sendrecv_cancel_init(sendrecv_cancel_t *zcd); extern void zfs_sendrecv_cancel(sendrecv_cancel_t *); extern void zfs_print_sendstats(FILE *, sendstats_t *, boolean_t); extern void zfs_sendstats_to_str(char *, size_t, sendstats_t *, const char *, boolean_t); extern uint64_t zfs_ddsend_max_memory_per_stream(void); extern int zfs_promote(zfs_handle_t *); typedef struct zfs_hold_args { const char *zha_snapname; const char *zha_tag; boolean_t zha_recursive; boolean_t zha_temphold; boolean_t zha_enoent_ok; uint64_t zha_dsobj; uint64_t zha_createtxg; int zha_cleanup_fd; } zfs_hold_args_t; extern int zfs_hold(zfs_handle_t *, zfs_hold_args_t *, void **); extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t, void **); extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *); typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain, uid_t rid, uint64_t space); extern int zfs_userspace(zfs_handle_t *__zhp, zfs_userquota_prop_t __type, zfs_userspace_cb_t __func, void *__arg); typedef struct recvflags { /* print informational messages (ie, -v was specified) */ uint_t verbose : 1; /* the destination is a prefix, not the exact fs (ie, -d) */ uint_t isprefix : 1; /* * Only the tail of the sent snapshot path is appended to the * destination to determine the received snapshot name (ie, -e). */ uint_t istail : 1; /* do not actually do the recv, just check if it would work (ie, -n) */ uint_t dryrun : 1; /* rollback/destroy filesystems as necessary (eg, -F) */ uint_t force : 1; /* set "canmount=off" on all modified filesystems */ uint_t canmountoff : 1; /* do not mount file systems as they are extracted (-u) */ uint_t nomount : 1; /* do not rename snapshots set for deferred destroy */ uint_t nosnaprename : 1; /* do not preserve incomplete datasets to resume them */ uint_t noresume : 1; /* If using "generic" datasets, avoid per-type prop cross check */ uint_t generic_datasets : 1; /* * Internal flags -- callers need not specify */ uint_t byteswap : 1; /* stream has non-native endianness */ uint_t started : 1; /* detect start of stream */ uint_t legacy : 1; /* old stream format with no record cksum */ uint_t recv_toc_only : 1; /* read TOC only (e.g. zfs_receive_toc) */ /* request comes from AK replication */ uint_t akrepl : 1; uint_t key_verify : 1; /* TOC key verification only */ uint_t rawcrypto : 1; /* rawcrypto receive */ } recvflags_t; typedef enum recv_op { ZFS_RECV_SNAPDESTROY = 0x01, ZFS_RECV_SNAPRENAME, ZFS_RECV_START, ZFS_RECV_FINISH, ZFS_RECV_TOP_DS } recv_op_t; typedef struct recv_op_arg { char *roa_dataset_name; char *roa_new_snapname; char *roa_old_snapname; boolean_t roa_unique_name; boolean_t roa_retention; } recv_op_arg_t; typedef boolean_t (*recv_cb_t)(libzfs_handle_t *, void *, recv_op_t, recv_op_arg_t *); typedef struct zfs_recv_args { const char *zsa_tosnap; recvflags_t zsa_flags; nvlist_t *zsa_props; int zsa_infd; recv_cb_t zsa_recv_cb; void *zsa_recv_cb_arg; sendrecv_cancel_t *zsa_cancel; const char *zsa_recv_tag; const char zsa_act_tosnap[ZFS_MAXNAMELEN]; } zfs_recv_args_t; extern int zfs_receive_checkpoint(libzfs_handle_t *, int, zfs_checkpoint_args_t *); extern void zfs_destroy_received_checkpoint(restart_checkpoint_t *); extern int zfs_receive(libzfs_handle_t *, zfs_recv_args_t *); typedef enum diff_flags { ZFS_DIFF_PARSEABLE = 1, ZFS_DIFF_TIMESTAMP = 2, ZFS_DIFF_CLASSIFY = 4, ZFS_DIFF_ENUMERATE = 8, ZFS_DIFF_BASE = 0x10, ZFS_DIFF_FROMNAME = 0x20, ZFS_DIFF_TONAME = 0x40, ZFS_DIFF_RECURSIVE = 0x80, ZFS_DIFF_ADDNEWDS = 0x100, ZFS_DIFF_QUIET = 0x200 } diff_flags_t; #define ZDIFF_ADDED '+' #define ZDIFF_MODIFIED 'M' #define ZDIFF_REMOVED '-' #define ZDIFF_RENAMED 'R' #define ZDIFF_DATASET 'D' struct zfs_stat; /* forward declaration */ typedef void (diff_scan_cb_t)(char *dsmnt, char *ds, uint64_t guid, uint64_t obj, int type, char *fobjname, char *tobjname, struct zfs_stat *fsp, struct zfs_stat *tsp, int delta, void *arg); extern int zfs_scan_diffs(zfs_handle_t *__zhp, const char *__fromsnap, const char *__tosnap, int __flags, diff_scan_cb_t *__cb_func, void *__cb_arg); extern int zfs_show_diffs(zfs_handle_t *__zhp, int __outfd, const char *__fromsnap, const char *__tosnap, struct nvlist *__fields, int __flags); /* * Command processing and help */ typedef struct zfs_command { const char *name; int (*func)(int argc, char **argv); int usage; } zfs_command_t; extern void zfs_command_help(const char *, const char *); extern void zfs_command_list(FILE *, const char *, zfs_command_t *); extern int zfs_command_find(const char *, zfs_command_t *, int *); /* * Miscellaneous functions. */ extern const char *zfs_type_to_name(zfs_type_t); extern void zfs_refresh_properties(zfs_handle_t *); extern int zfs_name_valid(const char *, zfs_type_t); extern zfs_handle_t *zfs_parent_handle(libzfs_handle_t *, struct zfs_cmd *); extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, const char *, zfs_type_t); extern zfs_handle_t *zfs_path_to_zhandle_quiet(libzfs_handle_t *, const char *, zfs_type_t); extern int zfs_path_to_mntpnt(libzfs_handle_t *, const char *, char *, size_t, char *, size_t, char *, size_t); extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *, zfs_type_t); extern uint64_t zfs_spa_version(zfs_handle_t *); extern int zfs_parent_name(const char *, char *, size_t); extern int zfs_throttle_bypass(zfs_handle_t *, void **); extern int zfs_throttle_enable(zfs_handle_t *, void **); extern int zfs_set_throttle(libzfs_handle_t *, zfs_set_knob_type_t, uint64_t, char *); extern void libzfs_set_safe_open(libzfs_handle_t *, boolean_t); extern boolean_t libzfs_get_safe_open(const libzfs_handle_t *); /* * Mount support functions. */ extern boolean_t is_mounted(libzfs_handle_t *, const char *__special, char **); extern boolean_t zfs_is_mounted(zfs_handle_t *, char **); extern int zfs_mount(zfs_handle_t *, const char *, int); extern int zfs_mountall(zfs_handle_t *, int); extern int zfs_unmount(zfs_handle_t *, const char *, int); extern int zfs_unmountall(zfs_handle_t *, int); typedef struct shareflags { uint_t share : 1; /* publish the share */ uint_t validate : 1; /* validate the share */ uint_t received : 1; /* share is received from a ZFS send stream */ } shareflags_t; /* * Share management support functions * These are direct interfaces to corresponding libshare routines. */ extern int zfs_share_validate(zfs_handle_t *, nvlist_t *, uint32_t, char *, int); extern int zfs_share_remove(zfs_handle_t *, const char *); extern int zfs_share_read(zfs_handle_t *, const char *, nvlist_t **); extern int zfs_share_read_init(zfs_handle_t *, boolean_t, void **); extern int zfs_share_read_next(zfs_handle_t *, void *, nvlist_t **); extern void zfs_share_read_fini(zfs_handle_t *, void *); extern int zfs_share_write(zfs_handle_t *, nvlist_t *, boolean_t, boolean_t); extern int zfs_share_parse(zfs_handle_t *, const char *, int, nvlist_t **); extern int zfs_share_merge(zfs_handle_t *, nvlist_t *, nvlist_t *, int); extern libshare_handle_t *libzfs_get_libshare(libzfs_handle_t *); extern void libzfs_set_libshare(libzfs_handle_t *, libshare_handle_t *); extern libshare_handle_t *zfs_get_libshare(zfs_handle_t *); /* * Miscellaneous share routines. */ extern int libzfs_setup_share_handling(libzfs_handle_t *); extern void libzfs_teardown_share_handling(libzfs_handle_t *); extern boolean_t zfs_supports_zfs_shares(zfs_handle_t *, uint64_t); /* * Share support functions. * zfs_main calls these */ extern boolean_t zfs_is_shared(zfs_handle_t *); extern int zfs_share_create(libzfs_handle_t *, const char *, nvlist_t *, shareflags_t); extern int zfs_share(zfs_handle_t *); extern int zfs_unshare(zfs_handle_t *); extern int zfs_share_one(zfs_handle_t *); extern int zfs_unshare_one(zfs_handle_t *); extern boolean_t zfs_is_sharing_requested(zfs_handle_t *); extern int zfs_get_mountpoint(zfs_handle_t *, char *, size_t); extern int zfs_get_sharepoint(zfs_handle_t *, char *, size_t); extern void zfs_disable_auto_share(zfs_handle_t *); /* * Protocol-specific share support functions. */ boolean_t zfs_is_sharing_enabled_mntpnt(zfs_handle_t *, boolean_t *, sa_proto_t *); extern boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **); extern boolean_t zfs_is_shared_smb(zfs_handle_t *, char **); extern int zfs_share_nfs(zfs_handle_t *); extern int zfs_share_smb(zfs_handle_t *); extern int zfs_shareall(zfs_handle_t *); extern int zfs_unshare_nfs(zfs_handle_t *, const char *); extern int zfs_unshare_smb(zfs_handle_t *, const char *); extern int zfs_unshareall_nfs(zfs_handle_t *); extern int zfs_unshareall_smb(zfs_handle_t *); extern int zfs_unshareall_bypath(zfs_handle_t *, const char *); extern int zfs_unshareall(zfs_handle_t *); /* * Share persistence support functions * The libshare_zfs plugin calls these. */ extern int zfssa_share_storage_write(libzfs_handle_t *, nvlist_t *, boolean_t); extern int zfssa_share_storage_read(libzfs_handle_t *, const char *, const char *, nvlist_t **); extern int zfssa_share_storage_read_init(libzfs_handle_t *, const char *, boolean_t, void **); extern int zfssa_share_storage_read_next(void *, nvlist_t **); extern int zfssa_share_storage_read_fini(void *); extern void zfssa_share_notify(zfs_handle_t *, nvlist_t *); extern int zfssa_add_share_notification(zfs_handle_t *, nvlist_t *, const char *, zfs_share_state_t); extern int zfssa_is_sharing_enabled_share(libzfs_handle_t *, const char *, const char *, sa_proto_t *); extern int zfssa_sharing_get_prop(libzfs_handle_t *, const char *, const char *, sa_proto_t, char **); extern int zfssa_sharing_set_prop(libzfs_handle_t *, const char *, const char *, sa_proto_t, const char *); /* * Crypto key functions for datasets */ extern boolean_t zfs_is_encrypted(zfs_handle_t *); extern boolean_t zfs_changing_key(zfs_handle_t *); extern boolean_t zfs_key_is_loaded(zfs_handle_t *); extern int zfs_key_load(zfs_handle_t *, boolean_t, boolean_t, boolean_t); extern int zfs_key_unload(zfs_handle_t *, boolean_t); extern int zfs_key_change(zfs_handle_t *, nvlist_t *); extern int zfs_key_change_without_resumable_key_load(zfs_handle_t *, nvlist_t *); extern void zfs_load_resumable_keys_quiet(zfs_handle_t *); extern int zfs_key_new(zfs_handle_t *); extern int zfs_rawkeys_unwrap(libzfs_handle_t *, char *, uint64_t, uint64_t, char *, uint64_t, nvlist_t *); /* * When dealing with nvlists, verify() is extremely useful */ #ifdef NDEBUG #define verify(EX) ((void)(EX)) #else #define verify(EX) assert(EX) #endif /* * Utility function to convert a number to a human-readable form. */ extern void zfs_nicenum(uint64_t, char *, size_t); extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *); extern void zfs_nicettc(uint64_t, char *, size_t); extern void zfs_nicetime(uint64_t, char *, size_t); extern void zfs_nice_nano_ttc(uint64_t, char *, size_t); extern void zfs_niceseconds(uint64_t, char *, size_t); extern int zfs_nicestrsectonum(libzfs_handle_t *, const char *, uint64_t *); extern void zfs_nice_ctime(time_t time, char *timestr, size_t maxsize); extern void zfs_nice_ctime_retained(time_t time, char *timestr, size_t maxsize); #ifndef IS_EPHEMERAL #define IS_EPHEMERAL(x) ((x) > MAXUID) #endif /* IS_EPHEMERAL */ typedef struct retention_list_cbarg { uint64_t rl_obj; const char *rl_dsname; const char *rl_policy; char *rl_mountpt; const char *rl_filename; uint64_t rl_nameerr; time_t rl_crtime, rl_atime, rl_mtime, rl_ctime, rl_rtime; uint64_t rl_pflags; size_t rl_size; uint64_t rl_uid, rl_gid; uint64_t rl_automatic; mode_t rl_mode; boolean_t rl_expired; } retention_list_cbarg_t; /* utility functions for printing file information */ extern char *zfs_id_str(uid_t who, boolean_t user); extern void zfs_print_id(uid_t who, boolean_t user); extern void zfs_mode_str(int flags, boolean_t acl, char *modestr); extern void zfs_print_mode(int flags, boolean_t acl); extern void zfs_print_8601_time(time_t ts); extern void zfs_print_escaped(const char *str, char delim); extern void zfs_print_obj_file(uint64_t obj, char *buf, int bufsize); extern void zfs_print_filepath(uint64_t obj, const char *dsname, char *mountpt, uint64_t nameerr, char *filename); extern void zfs_print_attrs(uint64_t attr); extern char *zfs_pflags_to_attrs(uint64_t pflags, char *attrs); extern void zfs_print_file_auditfmt(zfs_handle_t *zhp, retained_file_t *retfilep); extern void zfs_print_file_auditfmt_header(void); extern int zfs_retention_list_ofmt_open(char *print_fields, struct ofmt_state_s **oh); extern void zfs_retention_list_cbarg_fill(zfs_handle_t *zhp, retained_file_t *retfilep, retention_list_cbarg_t *rlcp); extern int zfs_retained_file_print(zfs_handle_t *zhp, void *data); /* * Given a device or file, determine if it is part of a pool. */ extern int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **, boolean_t *, boolean_t *); /* * Label manipulation. */ extern int zpool_read_label(int, nvlist_t **); extern int zpool_clear_label(int); extern int zpool_clear_recover(nvlist_t *, int, char *, uint64_t, boolean_t); extern void zpool_xor_label(void *); /* is this zvol valid for use as a dump device? */ extern int zvol_check_dump_config(char *); /* * Management interfaces for SMB/NFS share resource files */ int zfs_share_resource_add(libzfs_handle_t *, char *, char *, char *); int zfs_share_resource_remove(libzfs_handle_t *, char *, char *, char *, boolean_t); int zfs_share_resource_purge(libzfs_handle_t *, char *, char *); int zfs_share_resource_rename(libzfs_handle_t *, char *, char *, char *, char *); int zfs_share_resource_read(libzfs_handle_t *, char *, char *, char *, char *, int); int zfs_share_resource_write(libzfs_handle_t *, char *, char *, char *, char *, int); char *make_share_filename(const char *, const char *); /* * Enable and disable datasets within a pool by mounting/unmounting and * sharing/unsharing them. */ extern int zpool_enable_datasets(zpool_handle_t *, const char *, int); extern int zpool_disable_datasets(zpool_handle_t *, boolean_t); /* * FRU location management. */ extern int zpool_location_set(zpool_handle_t *, uint64_t, const char *, const char *, const char *, const char *); /* * Error handling related fucntions. */ extern boolean_t libzfs_get_ignore_errs(libzfs_handle_t *); extern void libzfs_set_ignore_errs(libzfs_handle_t *, boolean_t); extern const char *zfs_lib_mntopts[]; boolean_t zfs_mntopts_validate(const char **, const char *); #ifdef __cplusplus } #endif #endif /* _LIBZFS_H */