1fa9e4066Sahrens /* 2fa9e4066Sahrens * CDDL HEADER START 3fa9e4066Sahrens * 4fa9e4066Sahrens * The contents of this file are subject to the terms of the 5441d80aaSlling * Common Development and Distribution License (the "License"). 6441d80aaSlling * You may not use this file except in compliance with the License. 7fa9e4066Sahrens * 8fa9e4066Sahrens * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 9fa9e4066Sahrens * or http://www.opensolaris.org/os/licensing. 10fa9e4066Sahrens * See the License for the specific language governing permissions 11fa9e4066Sahrens * and limitations under the License. 12fa9e4066Sahrens * 13fa9e4066Sahrens * When distributing Covered Code, include this CDDL HEADER in each 14fa9e4066Sahrens * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 15fa9e4066Sahrens * If applicable, add the following below this CDDL HEADER, with the 16fa9e4066Sahrens * fields enclosed by brackets "[]" replaced with your own identifying 17fa9e4066Sahrens * information: Portions Copyright [yyyy] [name of copyright owner] 18fa9e4066Sahrens * 19fa9e4066Sahrens * CDDL HEADER END 20fa9e4066Sahrens */ 21f3861e1aSahl 22fa9e4066Sahrens /* 233f9d6ad7SLin Ling * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved. 24*e9103aaeSGarrett D'Amore * Copyright 2011 Nexenta Systems, Inc. All rights reserved. 25*e9103aaeSGarrett D'Amore * Copyright (c) 2011 by Delphix. All rights reserved. 26fa9e4066Sahrens */ 27fa9e4066Sahrens 28fa9e4066Sahrens #ifndef _LIBZFS_H 29fa9e4066Sahrens #define _LIBZFS_H 30fa9e4066Sahrens 31fa9e4066Sahrens #include <assert.h> 32fa9e4066Sahrens #include <libnvpair.h> 33ebedde84SEric Taylor #include <sys/mnttab.h> 34fa9e4066Sahrens #include <sys/param.h> 35fa9e4066Sahrens #include <sys/types.h> 36fa9e4066Sahrens #include <sys/varargs.h> 37fa9e4066Sahrens #include <sys/fs/zfs.h> 38ecd6cf80Smarks #include <sys/avl.h> 39ecd6cf80Smarks #include <ucred.h> 40fa9e4066Sahrens 41fa9e4066Sahrens #ifdef __cplusplus 42fa9e4066Sahrens extern "C" { 43fa9e4066Sahrens #endif 44fa9e4066Sahrens 45fa9e4066Sahrens /* 46fa9e4066Sahrens * Miscellaneous ZFS constants 47fa9e4066Sahrens */ 48fa9e4066Sahrens #define ZFS_MAXNAMELEN MAXNAMELEN 49fa9e4066Sahrens #define ZPOOL_MAXNAMELEN MAXNAMELEN 50fa9e4066Sahrens #define ZFS_MAXPROPLEN MAXPATHLEN 51990b4856Slling #define ZPOOL_MAXPROPLEN MAXPATHLEN 52fa9e4066Sahrens 53fa9e4066Sahrens /* 5499653d4eSeschrock * libzfs errors 5599653d4eSeschrock */ 5699653d4eSeschrock enum { 5799653d4eSeschrock EZFS_NOMEM = 2000, /* out of memory */ 5899653d4eSeschrock EZFS_BADPROP, /* invalid property value */ 5999653d4eSeschrock EZFS_PROPREADONLY, /* cannot set readonly property */ 6099653d4eSeschrock EZFS_PROPTYPE, /* property does not apply to dataset type */ 6199653d4eSeschrock EZFS_PROPNONINHERIT, /* property is not inheritable */ 6299653d4eSeschrock EZFS_PROPSPACE, /* bad quota or reservation */ 6399653d4eSeschrock EZFS_BADTYPE, /* dataset is not of appropriate type */ 6499653d4eSeschrock EZFS_BUSY, /* pool or dataset is busy */ 6599653d4eSeschrock EZFS_EXISTS, /* pool or dataset already exists */ 6699653d4eSeschrock EZFS_NOENT, /* no such pool or dataset */ 6799653d4eSeschrock EZFS_BADSTREAM, /* bad backup stream */ 6899653d4eSeschrock EZFS_DSREADONLY, /* dataset is readonly */ 6999653d4eSeschrock EZFS_VOLTOOBIG, /* volume is too large for 32-bit system */ 7099653d4eSeschrock EZFS_INVALIDNAME, /* invalid dataset name */ 7199653d4eSeschrock EZFS_BADRESTORE, /* unable to restore to destination */ 7299653d4eSeschrock EZFS_BADBACKUP, /* backup failed */ 7399653d4eSeschrock EZFS_BADTARGET, /* bad attach/detach/replace target */ 7499653d4eSeschrock EZFS_NODEVICE, /* no such device in pool */ 7599653d4eSeschrock EZFS_BADDEV, /* invalid device to add */ 7699653d4eSeschrock EZFS_NOREPLICAS, /* no valid replicas */ 7799653d4eSeschrock EZFS_RESILVERING, /* currently resilvering */ 7899653d4eSeschrock EZFS_BADVERSION, /* unsupported version */ 7999653d4eSeschrock EZFS_POOLUNAVAIL, /* pool is currently unavailable */ 8099653d4eSeschrock EZFS_DEVOVERFLOW, /* too many devices in one vdev */ 8199653d4eSeschrock EZFS_BADPATH, /* must be an absolute path */ 8299653d4eSeschrock EZFS_CROSSTARGET, /* rename or clone across pool or dataset */ 8399653d4eSeschrock EZFS_ZONED, /* used improperly in local zone */ 8499653d4eSeschrock EZFS_MOUNTFAILED, /* failed to mount dataset */ 8599653d4eSeschrock EZFS_UMOUNTFAILED, /* failed to unmount dataset */ 86f3861e1aSahl EZFS_UNSHARENFSFAILED, /* unshare(1M) failed */ 87f3861e1aSahl EZFS_SHARENFSFAILED, /* share(1M) failed */ 8899653d4eSeschrock EZFS_PERM, /* permission denied */ 8999653d4eSeschrock EZFS_NOSPC, /* out of space */ 906e27f868SSam Falkner EZFS_FAULT, /* bad address */ 9199653d4eSeschrock EZFS_IO, /* I/O error */ 9299653d4eSeschrock EZFS_INTR, /* signal received */ 9399653d4eSeschrock EZFS_ISSPARE, /* device is a hot spare */ 9499653d4eSeschrock EZFS_INVALCONFIG, /* invalid vdev configuration */ 953bb79becSeschrock EZFS_RECURSIVE, /* recursive dependency */ 9606eeb2adSek110237 EZFS_NOHISTORY, /* no history object */ 97b1b8ab34Slling EZFS_POOLPROPS, /* couldn't retrieve pool props */ 98b1b8ab34Slling EZFS_POOL_NOTSUP, /* ops not supported for this type of pool */ 99b1b8ab34Slling EZFS_POOL_INVALARG, /* invalid argument for this pool operation */ 100b7661cccSmmusante EZFS_NAMETOOLONG, /* dataset name is too long */ 1018488aeb5Staylor EZFS_OPENFAILED, /* open of device failed */ 1028488aeb5Staylor EZFS_NOCAP, /* couldn't get capacity */ 1038488aeb5Staylor EZFS_LABELFAILED, /* write of label failed */ 104ecd6cf80Smarks EZFS_BADWHO, /* invalid permission who */ 105ecd6cf80Smarks EZFS_BADPERM, /* invalid permission */ 106ecd6cf80Smarks EZFS_BADPERMSET, /* invalid permission set name */ 107ecd6cf80Smarks EZFS_NODELEGATION, /* delegated administration is disabled */ 108da6c28aaSamw EZFS_UNSHARESMBFAILED, /* failed to unshare over smb */ 109da6c28aaSamw EZFS_SHARESMBFAILED, /* failed to share over smb */ 1102f8aaab3Seschrock EZFS_BADCACHE, /* bad cache file */ 111fa94a07fSbrendan EZFS_ISL2CACHE, /* device is for the level 2 ARC */ 112e7cbe64fSgw25295 EZFS_VDEVNOTSUP, /* unsupported vdev type */ 11315e6edf1Sgw25295 EZFS_NOTSUP, /* ops not supported on this dataset */ 11489a89ebfSlling EZFS_ACTIVE_SPARE, /* pool has active shared spare devices */ 115e6ca193dSGeorge Wilson EZFS_UNPLAYED_LOGS, /* log device has unplayed logs */ 116842727c2SChris Kirby EZFS_REFTAG_RELE, /* snapshot release: tag not found */ 117842727c2SChris Kirby EZFS_REFTAG_HOLD, /* snapshot hold: tag already exists */ 118ca45db41SChris Kirby EZFS_TAGTOOLONG, /* snapshot hold/rele: tag too long */ 1199e69d7d0SLori Alt EZFS_PIPEFAILED, /* pipe create failed */ 1209e69d7d0SLori Alt EZFS_THREADCREATEFAILED, /* thread create failed */ 1211195e687SMark J Musante EZFS_POSTSPLIT_ONLINE, /* onlining a disk after splitting it */ 1223f9d6ad7SLin Ling EZFS_SCRUBBING, /* currently scrubbing */ 1233f9d6ad7SLin Ling EZFS_NO_SCRUB, /* no active scrub */ 12499d5e173STim Haley EZFS_DIFF, /* general failure of zfs diff */ 12599d5e173STim Haley EZFS_DIFFDATA, /* bad zfs diff data */ 126f9af39baSGeorge Wilson EZFS_POOLREADONLY, /* pool is in read-only mode */ 127b1b8ab34Slling EZFS_UNKNOWN 12899653d4eSeschrock }; 12999653d4eSeschrock 13099653d4eSeschrock /* 131ecd6cf80Smarks * The following data structures are all part 132ecd6cf80Smarks * of the zfs_allow_t data structure which is 133ecd6cf80Smarks * used for printing 'allow' permissions. 134ecd6cf80Smarks * It is a linked list of zfs_allow_t's which 135ecd6cf80Smarks * then contain avl tree's for user/group/sets/... 136ecd6cf80Smarks * and each one of the entries in those trees have 137ecd6cf80Smarks * avl tree's for the permissions they belong to and 138ecd6cf80Smarks * whether they are local,descendent or local+descendent 139ecd6cf80Smarks * permissions. The AVL trees are used primarily for 140ecd6cf80Smarks * sorting purposes, but also so that we can quickly find 141ecd6cf80Smarks * a given user and or permission. 142ecd6cf80Smarks */ 143ecd6cf80Smarks typedef struct zfs_perm_node { 144ecd6cf80Smarks avl_node_t z_node; 145ecd6cf80Smarks char z_pname[MAXPATHLEN]; 146ecd6cf80Smarks } zfs_perm_node_t; 147ecd6cf80Smarks 148ecd6cf80Smarks typedef struct zfs_allow_node { 149ecd6cf80Smarks avl_node_t z_node; 150ecd6cf80Smarks char z_key[MAXPATHLEN]; /* name, such as joe */ 151ecd6cf80Smarks avl_tree_t z_localdescend; /* local+descendent perms */ 152ecd6cf80Smarks avl_tree_t z_local; /* local permissions */ 153ecd6cf80Smarks avl_tree_t z_descend; /* descendent permissions */ 154ecd6cf80Smarks } zfs_allow_node_t; 155ecd6cf80Smarks 156ecd6cf80Smarks typedef struct zfs_allow { 157ecd6cf80Smarks struct zfs_allow *z_next; 158ecd6cf80Smarks char z_setpoint[MAXPATHLEN]; 159ecd6cf80Smarks avl_tree_t z_sets; 160ecd6cf80Smarks avl_tree_t z_crperms; 161ecd6cf80Smarks avl_tree_t z_user; 162ecd6cf80Smarks avl_tree_t z_group; 163ecd6cf80Smarks avl_tree_t z_everyone; 164ecd6cf80Smarks } zfs_allow_t; 165ecd6cf80Smarks 166ecd6cf80Smarks /* 167fa9e4066Sahrens * Basic handle types 168fa9e4066Sahrens */ 169fa9e4066Sahrens typedef struct zfs_handle zfs_handle_t; 170fa9e4066Sahrens typedef struct zpool_handle zpool_handle_t; 17199653d4eSeschrock typedef struct libzfs_handle libzfs_handle_t; 17299653d4eSeschrock 17399653d4eSeschrock /* 17499653d4eSeschrock * Library initialization 17599653d4eSeschrock */ 17699653d4eSeschrock extern libzfs_handle_t *libzfs_init(void); 17799653d4eSeschrock extern void libzfs_fini(libzfs_handle_t *); 17899653d4eSeschrock 17999653d4eSeschrock extern libzfs_handle_t *zpool_get_handle(zpool_handle_t *); 18099653d4eSeschrock extern libzfs_handle_t *zfs_get_handle(zfs_handle_t *); 18199653d4eSeschrock 18299653d4eSeschrock extern void libzfs_print_on_error(libzfs_handle_t *, boolean_t); 18399653d4eSeschrock 18499653d4eSeschrock extern int libzfs_errno(libzfs_handle_t *); 18599653d4eSeschrock extern const char *libzfs_error_action(libzfs_handle_t *); 18699653d4eSeschrock extern const char *libzfs_error_description(libzfs_handle_t *); 187ebedde84SEric Taylor extern void libzfs_mnttab_init(libzfs_handle_t *); 188ebedde84SEric Taylor extern void libzfs_mnttab_fini(libzfs_handle_t *); 189b2634b9cSEric Taylor extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t); 190ebedde84SEric Taylor extern int libzfs_mnttab_find(libzfs_handle_t *, const char *, 191ebedde84SEric Taylor struct mnttab *); 192ebedde84SEric Taylor extern void libzfs_mnttab_add(libzfs_handle_t *, const char *, 193ebedde84SEric Taylor const char *, const char *); 194ebedde84SEric Taylor extern void libzfs_mnttab_remove(libzfs_handle_t *, const char *); 195fa9e4066Sahrens 196fa9e4066Sahrens /* 197fa9e4066Sahrens * Basic handle functions 198fa9e4066Sahrens */ 19999653d4eSeschrock extern zpool_handle_t *zpool_open(libzfs_handle_t *, const char *); 20099653d4eSeschrock extern zpool_handle_t *zpool_open_canfail(libzfs_handle_t *, const char *); 201fa9e4066Sahrens extern void zpool_close(zpool_handle_t *); 202fa9e4066Sahrens extern const char *zpool_get_name(zpool_handle_t *); 203fa9e4066Sahrens extern int zpool_get_state(zpool_handle_t *); 204990b4856Slling extern char *zpool_state_to_name(vdev_state_t, vdev_aux_t); 20529ab75c9Srm160521 extern void zpool_free_handles(libzfs_handle_t *); 206fa9e4066Sahrens 207fa9e4066Sahrens /* 208fa9e4066Sahrens * Iterate over all active pools in the system. 209fa9e4066Sahrens */ 210fa9e4066Sahrens typedef int (*zpool_iter_f)(zpool_handle_t *, void *); 21199653d4eSeschrock extern int zpool_iter(libzfs_handle_t *, zpool_iter_f, void *); 212fa9e4066Sahrens 213fa9e4066Sahrens /* 214fa9e4066Sahrens * Functions to create and destroy pools 215fa9e4066Sahrens */ 21699653d4eSeschrock extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *, 2170a48a24eStimh nvlist_t *, nvlist_t *); 218fa9e4066Sahrens extern int zpool_destroy(zpool_handle_t *); 219fa9e4066Sahrens extern int zpool_add(zpool_handle_t *, nvlist_t *); 220fa9e4066Sahrens 2211195e687SMark J Musante typedef struct splitflags { 2221195e687SMark J Musante /* do not split, but return the config that would be split off */ 2231195e687SMark J Musante int dryrun : 1; 2241195e687SMark J Musante 2251195e687SMark J Musante /* after splitting, import the pool */ 2261195e687SMark J Musante int import : 1; 2271195e687SMark J Musante } splitflags_t; 2281195e687SMark J Musante 229fa9e4066Sahrens /* 230fa9e4066Sahrens * Functions to manipulate pool and vdev state 231fa9e4066Sahrens */ 2323f9d6ad7SLin Ling extern int zpool_scan(zpool_handle_t *, pool_scan_func_t); 233468c413aSTim Haley extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *); 234*e9103aaeSGarrett D'Amore extern int zpool_reguid(zpool_handle_t *); 235fa9e4066Sahrens 2363d7072f8Seschrock extern int zpool_vdev_online(zpool_handle_t *, const char *, int, 2373d7072f8Seschrock vdev_state_t *); 2383d7072f8Seschrock extern int zpool_vdev_offline(zpool_handle_t *, const char *, boolean_t); 2393d7072f8Seschrock extern int zpool_vdev_attach(zpool_handle_t *, const char *, 2403d7072f8Seschrock const char *, nvlist_t *, int); 241fa9e4066Sahrens extern int zpool_vdev_detach(zpool_handle_t *, const char *); 24299653d4eSeschrock extern int zpool_vdev_remove(zpool_handle_t *, const char *); 2431195e687SMark J Musante extern int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, nvlist_t *, 2441195e687SMark J Musante splitflags_t); 2453d7072f8Seschrock 246069f55e2SEric Schrock extern int zpool_vdev_fault(zpool_handle_t *, uint64_t, vdev_aux_t); 247069f55e2SEric Schrock extern int zpool_vdev_degrade(zpool_handle_t *, uint64_t, vdev_aux_t); 2483d7072f8Seschrock extern int zpool_vdev_clear(zpool_handle_t *, uint64_t); 2493d7072f8Seschrock 250fa94a07fSbrendan extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *, 251ee0eb9f2SEric Schrock boolean_t *, boolean_t *); 252573ca77eSGeorge Wilson extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *, 253573ca77eSGeorge Wilson boolean_t *, boolean_t *, boolean_t *); 2548488aeb5Staylor extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *); 255fa9e4066Sahrens 256fa9e4066Sahrens /* 257b1b8ab34Slling * Functions to manage pool properties 258b1b8ab34Slling */ 259b1b8ab34Slling extern int zpool_set_prop(zpool_handle_t *, const char *, const char *); 2603d7072f8Seschrock extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *, 261990b4856Slling size_t proplen, zprop_source_t *); 262990b4856Slling extern uint64_t zpool_get_prop_int(zpool_handle_t *, zpool_prop_t, 263990b4856Slling zprop_source_t *); 264990b4856Slling 265b1b8ab34Slling extern const char *zpool_prop_to_name(zpool_prop_t); 266b1b8ab34Slling extern const char *zpool_prop_values(zpool_prop_t); 267b1b8ab34Slling 268b1b8ab34Slling /* 269fa9e4066Sahrens * Pool health statistics. 270fa9e4066Sahrens */ 271fa9e4066Sahrens typedef enum { 272fa9e4066Sahrens /* 273fa9e4066Sahrens * The following correspond to faults as defined in the (fault.fs.zfs.*) 274b81d61a6Slling * event namespace. Each is associated with a corresponding message ID. 275fa9e4066Sahrens */ 276fa9e4066Sahrens ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt /kernel/drv/zpool.cache */ 277fa9e4066Sahrens ZPOOL_STATUS_MISSING_DEV_R, /* missing device with replicas */ 278fa9e4066Sahrens ZPOOL_STATUS_MISSING_DEV_NR, /* missing device with no replicas */ 279fa9e4066Sahrens ZPOOL_STATUS_CORRUPT_LABEL_R, /* bad device label with replicas */ 280b81d61a6Slling ZPOOL_STATUS_CORRUPT_LABEL_NR, /* bad device label with no replicas */ 281fa9e4066Sahrens ZPOOL_STATUS_BAD_GUID_SUM, /* sum of device guids didn't match */ 282fa9e4066Sahrens ZPOOL_STATUS_CORRUPT_POOL, /* pool metadata is corrupted */ 283fa9e4066Sahrens ZPOOL_STATUS_CORRUPT_DATA, /* data errors in user (meta)data */ 284fa9e4066Sahrens ZPOOL_STATUS_FAILING_DEV, /* device experiencing errors */ 285eaca9bbdSeschrock ZPOOL_STATUS_VERSION_NEWER, /* newer on-disk version */ 28695173954Sek110237 ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */ 28732b87932Sek110237 ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */ 28832b87932Sek110237 ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */ 289f67f35c3SEric Schrock ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */ 290f67f35c3SEric Schrock 291f67f35c3SEric Schrock /* 292f67f35c3SEric Schrock * These faults have no corresponding message ID. At the time we are 293f67f35c3SEric Schrock * checking the status, the original reason for the FMA fault (I/O or 294f67f35c3SEric Schrock * checksum errors) has been lost. 295f67f35c3SEric Schrock */ 2963d7072f8Seschrock ZPOOL_STATUS_FAULTED_DEV_R, /* faulted device with replicas */ 2973d7072f8Seschrock ZPOOL_STATUS_FAULTED_DEV_NR, /* faulted device with no replicas */ 298fa9e4066Sahrens 299fa9e4066Sahrens /* 300fa9e4066Sahrens * The following are not faults per se, but still an error possibly 301b81d61a6Slling * requiring administrative attention. There is no corresponding 302fa9e4066Sahrens * message ID. 303fa9e4066Sahrens */ 304eaca9bbdSeschrock ZPOOL_STATUS_VERSION_OLDER, /* older on-disk version */ 305fa9e4066Sahrens ZPOOL_STATUS_RESILVERING, /* device being resilvered */ 306fa9e4066Sahrens ZPOOL_STATUS_OFFLINE_DEV, /* device online */ 307c25309d4SGeorge Wilson ZPOOL_STATUS_REMOVED_DEV, /* removed device */ 308fa9e4066Sahrens 309fa9e4066Sahrens /* 310fa9e4066Sahrens * Finally, the following indicates a healthy pool. 311fa9e4066Sahrens */ 312fa9e4066Sahrens ZPOOL_STATUS_OK 313fa9e4066Sahrens } zpool_status_t; 314fa9e4066Sahrens 315ea8dc4b6Seschrock extern zpool_status_t zpool_get_status(zpool_handle_t *, char **); 316ea8dc4b6Seschrock extern zpool_status_t zpool_import_status(nvlist_t *, char **); 3179eb19f4dSGeorge Wilson extern void zpool_dump_ddt(const ddt_stat_t *dds, const ddt_histogram_t *ddh); 318fa9e4066Sahrens 319fa9e4066Sahrens /* 320fa9e4066Sahrens * Statistics and configuration functions. 321fa9e4066Sahrens */ 322ea8dc4b6Seschrock extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **); 32394de1d4cSeschrock extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *); 32455434c77Sek110237 extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **); 325ea8dc4b6Seschrock 326fa9e4066Sahrens /* 327fa9e4066Sahrens * Import and export functions 328fa9e4066Sahrens */ 32989a89ebfSlling extern int zpool_export(zpool_handle_t *, boolean_t); 330394ab0cbSGeorge Wilson extern int zpool_export_force(zpool_handle_t *); 33199653d4eSeschrock extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *, 332990b4856Slling char *altroot); 333990b4856Slling extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *, 3344b964adaSGeorge Wilson nvlist_t *, int); 335fa9e4066Sahrens 336fa9e4066Sahrens /* 337fa9e4066Sahrens * Search for pools to import 338fa9e4066Sahrens */ 339d41c4376SMark J Musante 340d41c4376SMark J Musante typedef struct importargs { 341d41c4376SMark J Musante char **path; /* a list of paths to search */ 342d41c4376SMark J Musante int paths; /* number of paths to search */ 343d41c4376SMark J Musante char *poolname; /* name of a pool to find */ 344d41c4376SMark J Musante uint64_t guid; /* guid of a pool to find */ 345d41c4376SMark J Musante char *cachefile; /* cachefile to use for import */ 346d41c4376SMark J Musante int can_be_active : 1; /* can the pool be active? */ 347d41c4376SMark J Musante int unique : 1; /* does 'poolname' already exist? */ 348d41c4376SMark J Musante int exists : 1; /* set on return if pool already exists */ 349d41c4376SMark J Musante } importargs_t; 350d41c4376SMark J Musante 351d41c4376SMark J Musante extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *); 352d41c4376SMark J Musante 353d41c4376SMark J Musante /* legacy pool search routines */ 35424e697d4Sck153898 extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **); 3553a57275aSck153898 extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *, 356e829d913Sck153898 char *, uint64_t); 357fa9e4066Sahrens 358fa9e4066Sahrens /* 359c67d9675Seschrock * Miscellaneous pool functions 360c67d9675Seschrock */ 361ecd6cf80Smarks struct zfs_cmd; 362ecd6cf80Smarks 3633f9d6ad7SLin Ling extern const char *zfs_history_event_names[LOG_END]; 3648f18d1faSGeorge Wilson 36588ecc943SGeorge Wilson extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *, 36688ecc943SGeorge Wilson boolean_t verbose); 367990b4856Slling extern int zpool_upgrade(zpool_handle_t *, uint64_t); 36806eeb2adSek110237 extern int zpool_get_history(zpool_handle_t *, nvlist_t **); 3698f18d1faSGeorge Wilson extern int zpool_history_unpack(char *, uint64_t, uint64_t *, 3708f18d1faSGeorge Wilson nvlist_t ***, uint_t *); 3712a6b87f0Sek110237 extern void zpool_set_history_str(const char *subcommand, int argc, 3722a6b87f0Sek110237 char **argv, char *history_str); 3732a6b87f0Sek110237 extern int zpool_stage_history(libzfs_handle_t *, const char *); 37455434c77Sek110237 extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *, 37555434c77Sek110237 size_t len); 376ecd6cf80Smarks extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *); 377753a6d45SSherry Moore extern int zpool_get_physpath(zpool_handle_t *, char *, size_t); 378468c413aSTim Haley extern void zpool_explain_recover(libzfs_handle_t *, const char *, int, 379468c413aSTim Haley nvlist_t *); 380753a6d45SSherry Moore 381c67d9675Seschrock /* 382fa9e4066Sahrens * Basic handle manipulations. These functions do not create or destroy the 383fa9e4066Sahrens * underlying datasets, only the references to them. 384fa9e4066Sahrens */ 38599653d4eSeschrock extern zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int); 386fa9e4066Sahrens extern void zfs_close(zfs_handle_t *); 387fa9e4066Sahrens extern zfs_type_t zfs_get_type(const zfs_handle_t *); 388fa9e4066Sahrens extern const char *zfs_get_name(const zfs_handle_t *); 389d5b5bb25SRich Morris extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *); 390fa9e4066Sahrens 391fa9e4066Sahrens /* 392fa9e4066Sahrens * Property management functions. Some functions are shared with the kernel, 393b81d61a6Slling * and are found in sys/fs/zfs.h. 394fa9e4066Sahrens */ 395990b4856Slling 396990b4856Slling /* 397990b4856Slling * zfs dataset property management 398990b4856Slling */ 399990b4856Slling extern const char *zfs_prop_default_string(zfs_prop_t); 400e9dbad6fSeschrock extern uint64_t zfs_prop_default_numeric(zfs_prop_t); 401e9dbad6fSeschrock extern const char *zfs_prop_column_name(zfs_prop_t); 402e9dbad6fSeschrock extern boolean_t zfs_prop_align_right(zfs_prop_t); 403e9dbad6fSeschrock 4040a48a24eStimh extern nvlist_t *zfs_valid_proplist(libzfs_handle_t *, zfs_type_t, 4050a48a24eStimh nvlist_t *, uint64_t, zfs_handle_t *, const char *); 4060a48a24eStimh 407990b4856Slling extern const char *zfs_prop_to_name(zfs_prop_t); 408990b4856Slling extern int zfs_prop_set(zfs_handle_t *, const char *, const char *); 409990b4856Slling extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t, 410990b4856Slling zprop_source_t *, char *, size_t, boolean_t); 41192241e0bSTom Erickson extern int zfs_prop_get_recvd(zfs_handle_t *, const char *, char *, size_t, 41292241e0bSTom Erickson boolean_t); 413990b4856Slling extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *, 414990b4856Slling zprop_source_t *, char *, size_t); 415edea4b55SLin Ling extern int zfs_prop_get_userquota_int(zfs_handle_t *zhp, const char *propname, 416edea4b55SLin Ling uint64_t *propvalue); 41714843421SMatthew Ahrens extern int zfs_prop_get_userquota(zfs_handle_t *zhp, const char *propname, 41814843421SMatthew Ahrens char *propbuf, int proplen, boolean_t literal); 419990b4856Slling extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t); 42092241e0bSTom Erickson extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t); 421990b4856Slling extern const char *zfs_prop_values(zfs_prop_t); 422990b4856Slling extern int zfs_prop_is_string(zfs_prop_t prop); 423990b4856Slling extern nvlist_t *zfs_get_user_props(zfs_handle_t *); 42492241e0bSTom Erickson extern nvlist_t *zfs_get_recvd_props(zfs_handle_t *); 425990b4856Slling 426990b4856Slling typedef struct zprop_list { 427990b4856Slling int pl_prop; 428e9dbad6fSeschrock char *pl_user_prop; 429990b4856Slling struct zprop_list *pl_next; 430e9dbad6fSeschrock boolean_t pl_all; 431e9dbad6fSeschrock size_t pl_width; 43292241e0bSTom Erickson size_t pl_recvd_width; 433e9dbad6fSeschrock boolean_t pl_fixed; 434990b4856Slling } zprop_list_t; 435e9dbad6fSeschrock 43692241e0bSTom Erickson extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t); 4372e5e9e19SSanjeev Bagewadi extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *); 438fa9e4066Sahrens 439fa9e4066Sahrens #define ZFS_MOUNTPOINT_NONE "none" 440fa9e4066Sahrens #define ZFS_MOUNTPOINT_LEGACY "legacy" 441fa9e4066Sahrens 442fa9e4066Sahrens /* 443990b4856Slling * zpool property management 444b1b8ab34Slling */ 445990b4856Slling extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **); 446990b4856Slling extern const char *zpool_prop_default_string(zpool_prop_t); 447990b4856Slling extern uint64_t zpool_prop_default_numeric(zpool_prop_t); 448990b4856Slling extern const char *zpool_prop_column_name(zpool_prop_t); 449990b4856Slling extern boolean_t zpool_prop_align_right(zpool_prop_t); 450990b4856Slling 451990b4856Slling /* 452990b4856Slling * Functions shared by zfs and zpool property management. 453990b4856Slling */ 454990b4856Slling extern int zprop_iter(zprop_func func, void *cb, boolean_t show_all, 455990b4856Slling boolean_t ordered, zfs_type_t type); 456990b4856Slling extern int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **, 457990b4856Slling zfs_type_t); 458990b4856Slling extern void zprop_free_list(zprop_list_t *); 459990b4856Slling 46092241e0bSTom Erickson #define ZFS_GET_NCOLS 5 46192241e0bSTom Erickson 46292241e0bSTom Erickson typedef enum { 46392241e0bSTom Erickson GET_COL_NONE, 46492241e0bSTom Erickson GET_COL_NAME, 46592241e0bSTom Erickson GET_COL_PROPERTY, 46692241e0bSTom Erickson GET_COL_VALUE, 46792241e0bSTom Erickson GET_COL_RECVD, 46892241e0bSTom Erickson GET_COL_SOURCE 46992241e0bSTom Erickson } zfs_get_column_t; 47092241e0bSTom Erickson 471990b4856Slling /* 472990b4856Slling * Functions for printing zfs or zpool properties 473990b4856Slling */ 474990b4856Slling typedef struct zprop_get_cbdata { 475b1b8ab34Slling int cb_sources; 47692241e0bSTom Erickson zfs_get_column_t cb_columns[ZFS_GET_NCOLS]; 47792241e0bSTom Erickson int cb_colwidths[ZFS_GET_NCOLS + 1]; 478b1b8ab34Slling boolean_t cb_scripted; 479b1b8ab34Slling boolean_t cb_literal; 480b1b8ab34Slling boolean_t cb_first; 481990b4856Slling zprop_list_t *cb_proplist; 482990b4856Slling zfs_type_t cb_type; 483990b4856Slling } zprop_get_cbdata_t; 484b1b8ab34Slling 485990b4856Slling void zprop_print_one_property(const char *, zprop_get_cbdata_t *, 48692241e0bSTom Erickson const char *, const char *, zprop_source_t, const char *, 48792241e0bSTom Erickson const char *); 488b1b8ab34Slling 489b1b8ab34Slling /* 490fa9e4066Sahrens * Iterator functions. 491fa9e4066Sahrens */ 492fa9e4066Sahrens typedef int (*zfs_iter_f)(zfs_handle_t *, void *); 49399653d4eSeschrock extern int zfs_iter_root(libzfs_handle_t *, zfs_iter_f, void *); 494fa9e4066Sahrens extern int zfs_iter_children(zfs_handle_t *, zfs_iter_f, void *); 4953bb79becSeschrock extern int zfs_iter_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *); 4967f7322feSeschrock extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *); 4977f7322feSeschrock extern int zfs_iter_snapshots(zfs_handle_t *, zfs_iter_f, void *); 498ca45db41SChris Kirby extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *); 499fa9e4066Sahrens 5009d9a58e3SEric Taylor typedef struct get_all_cb { 5019d9a58e3SEric Taylor zfs_handle_t **cb_handles; 5029d9a58e3SEric Taylor size_t cb_alloc; 5039d9a58e3SEric Taylor size_t cb_used; 5049d9a58e3SEric Taylor boolean_t cb_verbose; 5059d9a58e3SEric Taylor int (*cb_getone)(zfs_handle_t *, void *); 5069d9a58e3SEric Taylor } get_all_cb_t; 5079d9a58e3SEric Taylor 5089d9a58e3SEric Taylor void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *); 5099d9a58e3SEric Taylor int libzfs_dataset_cmp(const void *, const void *); 5109d9a58e3SEric Taylor 511fa9e4066Sahrens /* 512fa9e4066Sahrens * Functions to create and destroy datasets. 513fa9e4066Sahrens */ 51499653d4eSeschrock extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t, 515e9dbad6fSeschrock nvlist_t *); 5167f1f55eaSvb160487 extern int zfs_create_ancestors(libzfs_handle_t *, const char *); 517842727c2SChris Kirby extern int zfs_destroy(zfs_handle_t *, boolean_t); 518842727c2SChris Kirby extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t); 519e9dbad6fSeschrock extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *); 520bb0ade09Sahrens extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *); 521c391e322Sahrens extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t); 5227f1f55eaSvb160487 extern int zfs_rename(zfs_handle_t *, const char *, boolean_t); 5239e69d7d0SLori Alt 5249e69d7d0SLori Alt typedef struct sendflags { 5259e69d7d0SLori Alt /* print informational messages (ie, -v was specified) */ 5269e69d7d0SLori Alt int verbose : 1; 5279e69d7d0SLori Alt 52892241e0bSTom Erickson /* recursive send (ie, -R) */ 5299e69d7d0SLori Alt int replicate : 1; 5309e69d7d0SLori Alt 5319e69d7d0SLori Alt /* for incrementals, do all intermediate snapshots */ 53292241e0bSTom Erickson int doall : 1; /* (ie, -I) */ 5339e69d7d0SLori Alt 5349e69d7d0SLori Alt /* if dataset is a clone, do incremental from its origin */ 5359e69d7d0SLori Alt int fromorigin : 1; 5369e69d7d0SLori Alt 5379e69d7d0SLori Alt /* do deduplication */ 5389e69d7d0SLori Alt int dedup : 1; 53992241e0bSTom Erickson 54092241e0bSTom Erickson /* send properties (ie, -p) */ 54192241e0bSTom Erickson int props : 1; 5429e69d7d0SLori Alt } sendflags_t; 5439e69d7d0SLori Alt 5449e69d7d0SLori Alt typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *); 5459e69d7d0SLori Alt 5463f9d6ad7SLin Ling extern int zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap, 5473f9d6ad7SLin Ling sendflags_t flags, int outfd, snapfilter_cb_t filter_func, 5483f9d6ad7SLin Ling void *cb_arg, nvlist_t **debugnvp); 5499e69d7d0SLori Alt 55099653d4eSeschrock extern int zfs_promote(zfs_handle_t *); 551ca45db41SChris Kirby extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t, 552a7f53a56SChris Kirby boolean_t, boolean_t, int, uint64_t, uint64_t); 553842727c2SChris Kirby extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t); 5541af68beaSAlexander Stetsenko extern int zfs_get_holds(zfs_handle_t *, nvlist_t **); 555c1449561SEric Taylor extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *); 556fa9e4066Sahrens 5570aea4b19SMatthew Ahrens typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain, 55814843421SMatthew Ahrens uid_t rid, uint64_t space); 55914843421SMatthew Ahrens 5601af68beaSAlexander Stetsenko extern int zfs_userspace(zfs_handle_t *, zfs_userquota_prop_t, 5611af68beaSAlexander Stetsenko zfs_userspace_cb_t, void *); 5621af68beaSAlexander Stetsenko 5631af68beaSAlexander Stetsenko extern int zfs_get_fsacl(zfs_handle_t *, nvlist_t **); 5641af68beaSAlexander Stetsenko extern int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *); 56514843421SMatthew Ahrens 5663cb34c60Sahrens typedef struct recvflags { 5674ccbb6e7Sahrens /* print informational messages (ie, -v was specified) */ 568c6765aabSeschrock int verbose : 1; 5694ccbb6e7Sahrens 5704ccbb6e7Sahrens /* the destination is a prefix, not the exact fs (ie, -d) */ 571c6765aabSeschrock int isprefix : 1; 5724ccbb6e7Sahrens 573f64930f5STom Erickson /* 574f64930f5STom Erickson * Only the tail of the sent snapshot path is appended to the 575f64930f5STom Erickson * destination to determine the received snapshot name (ie, -e). 576f64930f5STom Erickson */ 577f64930f5STom Erickson int istail : 1; 578f64930f5STom Erickson 5794ccbb6e7Sahrens /* do not actually do the recv, just check if it would work (ie, -n) */ 580c6765aabSeschrock int dryrun : 1; 5814ccbb6e7Sahrens 5824ccbb6e7Sahrens /* rollback/destroy filesystems as necessary (eg, -F) */ 583c6765aabSeschrock int force : 1; 5844ccbb6e7Sahrens 5854ccbb6e7Sahrens /* set "canmount=off" on all modified filesystems */ 586c6765aabSeschrock int canmountoff : 1; 5874ccbb6e7Sahrens 5884ccbb6e7Sahrens /* byteswap flag is used internally; callers need not specify */ 589c6765aabSeschrock int byteswap : 1; 59033408eefSLori Alt 59133408eefSLori Alt /* do not mount file systems as they are extracted (private) */ 59233408eefSLori Alt int nomount : 1; 5933cb34c60Sahrens } recvflags_t; 5943cb34c60Sahrens 5953cb34c60Sahrens extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t, 5963cb34c60Sahrens int, avl_tree_t *); 5973cb34c60Sahrens 59899d5e173STim Haley typedef enum diff_flags { 59999d5e173STim Haley ZFS_DIFF_PARSEABLE = 0x1, 60099d5e173STim Haley ZFS_DIFF_TIMESTAMP = 0x2, 60199d5e173STim Haley ZFS_DIFF_CLASSIFY = 0x4 60299d5e173STim Haley } diff_flags_t; 60399d5e173STim Haley 60499d5e173STim Haley extern int zfs_show_diffs(zfs_handle_t *, int, const char *, const char *, 60599d5e173STim Haley int); 60699d5e173STim Haley 607fa9e4066Sahrens /* 608fa9e4066Sahrens * Miscellaneous functions. 609fa9e4066Sahrens */ 610fa9e4066Sahrens extern const char *zfs_type_to_name(zfs_type_t); 611fa9e4066Sahrens extern void zfs_refresh_properties(zfs_handle_t *); 612fa9e4066Sahrens extern int zfs_name_valid(const char *, zfs_type_t); 6135aba80dbSck153898 extern zfs_handle_t *zfs_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t); 6147f1f55eaSvb160487 extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *, 6157f1f55eaSvb160487 zfs_type_t); 6167b97dc1aSrm160521 extern int zfs_spa_version(zfs_handle_t *, int *); 617fa9e4066Sahrens 618fa9e4066Sahrens /* 619fa9e4066Sahrens * Mount support functions. 620fa9e4066Sahrens */ 62155434c77Sek110237 extern boolean_t is_mounted(libzfs_handle_t *, const char *special, char **); 62299653d4eSeschrock extern boolean_t zfs_is_mounted(zfs_handle_t *, char **); 623fa9e4066Sahrens extern int zfs_mount(zfs_handle_t *, const char *, int); 624fa9e4066Sahrens extern int zfs_unmount(zfs_handle_t *, const char *, int); 625fa9e4066Sahrens extern int zfs_unmountall(zfs_handle_t *, int); 626fa9e4066Sahrens 627fa9e4066Sahrens /* 628fa9e4066Sahrens * Share support functions. 629fa9e4066Sahrens */ 630f3861e1aSahl extern boolean_t zfs_is_shared(zfs_handle_t *); 631fa9e4066Sahrens extern int zfs_share(zfs_handle_t *); 632f3861e1aSahl extern int zfs_unshare(zfs_handle_t *); 633f3861e1aSahl 634f3861e1aSahl /* 6353d7072f8Seschrock * Protocol-specific share support functions. 636f3861e1aSahl */ 637f3861e1aSahl extern boolean_t zfs_is_shared_nfs(zfs_handle_t *, char **); 638da6c28aaSamw extern boolean_t zfs_is_shared_smb(zfs_handle_t *, char **); 639f3861e1aSahl extern int zfs_share_nfs(zfs_handle_t *); 640da6c28aaSamw extern int zfs_share_smb(zfs_handle_t *); 641da6c28aaSamw extern int zfs_shareall(zfs_handle_t *); 642f3861e1aSahl extern int zfs_unshare_nfs(zfs_handle_t *, const char *); 643da6c28aaSamw extern int zfs_unshare_smb(zfs_handle_t *, const char *); 644f3861e1aSahl extern int zfs_unshareall_nfs(zfs_handle_t *); 645da6c28aaSamw extern int zfs_unshareall_smb(zfs_handle_t *); 646da6c28aaSamw extern int zfs_unshareall_bypath(zfs_handle_t *, const char *); 647da6c28aaSamw extern int zfs_unshareall(zfs_handle_t *); 648743a77edSAlan Wright extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *, 649da6c28aaSamw void *, void *, int, zfs_share_op_t); 650fa9e4066Sahrens 651fa9e4066Sahrens /* 652fa9e4066Sahrens * When dealing with nvlists, verify() is extremely useful 653fa9e4066Sahrens */ 654fa9e4066Sahrens #ifdef NDEBUG 655fa9e4066Sahrens #define verify(EX) ((void)(EX)) 656fa9e4066Sahrens #else 657fa9e4066Sahrens #define verify(EX) assert(EX) 658fa9e4066Sahrens #endif 659fa9e4066Sahrens 660fa9e4066Sahrens /* 661fa9e4066Sahrens * Utility function to convert a number to a human-readable form. 662fa9e4066Sahrens */ 663fa9e4066Sahrens extern void zfs_nicenum(uint64_t, char *, size_t); 664e9dbad6fSeschrock extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *); 665fa9e4066Sahrens 666fa9e4066Sahrens /* 667fa9e4066Sahrens * Given a device or file, determine if it is part of a pool. 668fa9e4066Sahrens */ 66999653d4eSeschrock extern int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **, 67099653d4eSeschrock boolean_t *); 671fa9e4066Sahrens 672fa9e4066Sahrens /* 673096d22d4SEric Schrock * Label manipulation. 674fa9e4066Sahrens */ 67599653d4eSeschrock extern int zpool_read_label(int, nvlist_t **); 676096d22d4SEric Schrock extern int zpool_clear_label(int); 677fa9e4066Sahrens 678e7cbe64fSgw25295 /* is this zvol valid for use as a dump device? */ 679e7cbe64fSgw25295 extern int zvol_check_dump_config(char *); 680e7cbe64fSgw25295 6813bb79becSeschrock /* 682743a77edSAlan Wright * Management interfaces for SMB ACL files 683743a77edSAlan Wright */ 684743a77edSAlan Wright 685743a77edSAlan Wright int zfs_smb_acl_add(libzfs_handle_t *, char *, char *, char *); 686743a77edSAlan Wright int zfs_smb_acl_remove(libzfs_handle_t *, char *, char *, char *); 687743a77edSAlan Wright int zfs_smb_acl_purge(libzfs_handle_t *, char *, char *); 688743a77edSAlan Wright int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, char *); 689743a77edSAlan Wright 690743a77edSAlan Wright /* 691f3861e1aSahl * Enable and disable datasets within a pool by mounting/unmounting and 692f3861e1aSahl * sharing/unsharing them. 6933bb79becSeschrock */ 694f3861e1aSahl extern int zpool_enable_datasets(zpool_handle_t *, const char *, int); 695f3861e1aSahl extern int zpool_disable_datasets(zpool_handle_t *, boolean_t); 6963bb79becSeschrock 697069f55e2SEric Schrock /* 698069f55e2SEric Schrock * Mappings between vdev and FRU. 699069f55e2SEric Schrock */ 700069f55e2SEric Schrock extern void libzfs_fru_refresh(libzfs_handle_t *); 701069f55e2SEric Schrock extern const char *libzfs_fru_lookup(libzfs_handle_t *, const char *); 702069f55e2SEric Schrock extern const char *libzfs_fru_devpath(libzfs_handle_t *, const char *); 703069f55e2SEric Schrock extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *, 704069f55e2SEric Schrock const char *); 705069f55e2SEric Schrock extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *); 706069f55e2SEric Schrock extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *); 707069f55e2SEric Schrock 708fa9e4066Sahrens #ifdef __cplusplus 709fa9e4066Sahrens } 710fa9e4066Sahrens #endif 711fa9e4066Sahrens 712fa9e4066Sahrens #endif /* _LIBZFS_H */ 713