2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* CDDL HEADER START
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the terms of the
|
|
|
|
* Common Development and Distribution License (the "License").
|
|
|
|
* You may not use this file except in compliance with the License.
|
|
|
|
*
|
|
|
|
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
|
|
|
|
* or http://www.opensolaris.org/os/licensing.
|
|
|
|
* See the License for the specific language governing permissions
|
|
|
|
* and limitations under the License.
|
|
|
|
*
|
|
|
|
* When distributing Covered Code, include this CDDL HEADER in each
|
|
|
|
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
|
|
|
|
* If applicable, add the following below this CDDL HEADER, with the
|
|
|
|
* fields enclosed by brackets "[]" replaced with your own identifying
|
|
|
|
* information: Portions Copyright [yyyy] [name of copyright owner]
|
|
|
|
*
|
|
|
|
* CDDL HEADER END
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
2010-05-28 20:45:14 +00:00
|
|
|
* Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
|
2016-01-13 23:05:59 +00:00
|
|
|
* Copyright (c) 2011, 2015 by Delphix. All rights reserved.
|
2012-05-09 22:05:14 +00:00
|
|
|
* Copyright (c) 2012, Joyent, Inc. All rights reserved.
|
2013-05-25 02:06:23 +00:00
|
|
|
* Copyright (c) 2013 Steven Hartland. All rights reserved.
|
2016-03-14 16:04:21 +00:00
|
|
|
* Copyright (c) 2016, Intel Corporation.
|
2017-02-03 21:24:44 +00:00
|
|
|
* Copyright 2016 Nexenta Systems, Inc.
|
2017-05-19 19:33:11 +00:00
|
|
|
* Copyright (c) 2017 Datto Inc.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
|
|
|
|
|
|
|
#ifndef _LIBZFS_H
|
|
|
|
#define _LIBZFS_H
|
|
|
|
|
|
|
|
#include <assert.h>
|
|
|
|
#include <libnvpair.h>
|
2009-01-15 21:59:39 +00:00
|
|
|
#include <sys/mnttab.h>
|
2008-11-20 20:01:55 +00:00
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/varargs.h>
|
|
|
|
#include <sys/fs/zfs.h>
|
|
|
|
#include <sys/avl.h>
|
|
|
|
#include <ucred.h>
|
2014-06-05 21:19:08 +00:00
|
|
|
#include <libzfs_core.h>
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Miscellaneous ZFS constants
|
|
|
|
*/
|
|
|
|
#define ZFS_MAXPROPLEN MAXPATHLEN
|
|
|
|
#define ZPOOL_MAXPROPLEN MAXPATHLEN
|
|
|
|
|
2010-08-26 18:56:53 +00:00
|
|
|
/*
|
|
|
|
* Default device paths
|
|
|
|
*/
|
2012-10-17 23:58:54 +00:00
|
|
|
#define DISK_ROOT "/dev"
|
|
|
|
#define UDISK_ROOT "/dev/disk"
|
2015-07-01 22:23:09 +00:00
|
|
|
#define ZVOL_ROOT "/dev/zvol"
|
2010-08-26 18:56:53 +00:00
|
|
|
|
2013-10-11 21:24:18 +00:00
|
|
|
/*
|
|
|
|
* Default wait time for a device name to be created.
|
|
|
|
*/
|
|
|
|
#define DISK_LABEL_WAIT (30 * 1000) /* 30 seconds */
|
|
|
|
|
2016-11-07 18:28:57 +00:00
|
|
|
#define IMPORT_ORDER_PREFERRED_1 1
|
|
|
|
#define IMPORT_ORDER_PREFERRED_2 2
|
|
|
|
#define IMPORT_ORDER_SCAN_OFFSET 10
|
|
|
|
#define IMPORT_ORDER_DEFAULT 100
|
2016-02-04 21:34:49 +00:00
|
|
|
#define DEFAULT_IMPORT_PATH_SIZE 9
|
2012-10-17 23:58:54 +00:00
|
|
|
extern char *zpool_default_import_path[DEFAULT_IMPORT_PATH_SIZE];
|
2010-08-26 18:56:53 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* libzfs errors
|
|
|
|
*/
|
2013-08-28 11:45:09 +00:00
|
|
|
typedef enum zfs_error {
|
|
|
|
EZFS_SUCCESS = 0, /* no error -- success */
|
2008-11-20 20:01:55 +00:00
|
|
|
EZFS_NOMEM = 2000, /* 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_UMOUNTFAILED, /* failed to unmount dataset */
|
|
|
|
EZFS_UNSHARENFSFAILED, /* unshare(1M) failed */
|
|
|
|
EZFS_SHARENFSFAILED, /* share(1M) failed */
|
|
|
|
EZFS_PERM, /* permission denied */
|
|
|
|
EZFS_NOSPC, /* out of space */
|
2010-05-28 20:45:14 +00:00
|
|
|
EZFS_FAULT, /* bad address */
|
2008-11-20 20:01:55 +00:00
|
|
|
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_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_UNSHARESMBFAILED, /* failed to unshare over smb */
|
|
|
|
EZFS_SHARESMBFAILED, /* failed to share over smb */
|
|
|
|
EZFS_BADCACHE, /* bad cache file */
|
|
|
|
EZFS_ISL2CACHE, /* device is for the level 2 ARC */
|
|
|
|
EZFS_VDEVNOTSUP, /* unsupported vdev type */
|
2008-12-03 20:09:06 +00:00
|
|
|
EZFS_NOTSUP, /* ops not supported on this dataset */
|
|
|
|
EZFS_ACTIVE_SPARE, /* pool has active shared spare devices */
|
2009-07-02 22:44:48 +00:00
|
|
|
EZFS_UNPLAYED_LOGS, /* log device has unplayed logs */
|
2009-08-18 18:43:27 +00:00
|
|
|
EZFS_REFTAG_RELE, /* snapshot release: tag not found */
|
|
|
|
EZFS_REFTAG_HOLD, /* snapshot hold: tag already exists */
|
2010-05-28 20:45:14 +00:00
|
|
|
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 */
|
2010-08-26 21:24:34 +00:00
|
|
|
EZFS_DIFF, /* general failure of zfs diff */
|
|
|
|
EZFS_DIFFDATA, /* bad zfs diff data */
|
|
|
|
EZFS_POOLREADONLY, /* pool is in read-only mode */
|
2017-07-07 05:16:13 +00:00
|
|
|
EZFS_SCRUB_PAUSED, /* scrub currently paused */
|
Multi-modifier protection (MMP)
Add multihost=on|off pool property to control MMP. When enabled
a new thread writes uberblocks to the last slot in each label, at a
set frequency, to indicate to other hosts the pool is actively imported.
These uberblocks are the last synced uberblock with an updated
timestamp. Property defaults to off.
During tryimport, find the "best" uberblock (newest txg and timestamp)
repeatedly, checking for change in the found uberblock. Include the
results of the activity test in the config returned by tryimport.
These results are reported to user in "zpool import".
Allow the user to control the period between MMP writes, and the
duration of the activity test on import, via a new module parameter
zfs_multihost_interval. The period is specified in milliseconds. The
activity test duration is calculated from this value, and from the
mmp_delay in the "best" uberblock found initially.
Add a kstat interface to export statistics about Multiple Modifier
Protection (MMP) updates. Include the last synced txg number, the
timestamp, the delay since the last MMP update, the VDEV GUID, the VDEV
label that received the last MMP update, and the VDEV path. Abbreviated
output below.
$ cat /proc/spl/kstat/zfs/mypool/multihost
31 0 0x01 10 880 105092382393521 105144180101111
txg timestamp mmp_delay vdev_guid vdev_label vdev_path
20468 261337 250274925 68396651780 3 /dev/sda
20468 261339 252023374 6267402363293 1 /dev/sdc
20468 261340 252000858 6698080955233 1 /dev/sdx
20468 261341 251980635 783892869810 2 /dev/sdy
20468 261342 253385953 8923255792467 3 /dev/sdd
20468 261344 253336622 042125143176 0 /dev/sdab
20468 261345 253310522 1200778101278 2 /dev/sde
20468 261346 253286429 0950576198362 2 /dev/sdt
20468 261347 253261545 96209817917 3 /dev/sds
20468 261349 253238188 8555725937673 3 /dev/sdb
Add a new tunable zfs_multihost_history to specify the number of MMP
updates to store history for. By default it is set to zero meaning that
no MMP statistics are stored.
When using ztest to generate activity, for automated tests of the MMP
function, some test functions interfere with the test. For example, the
pool is exported to run zdb and then imported again. Add a new ztest
function, "-M", to alter ztest behavior to prevent this.
Add new tests to verify the new functionality. Tests provided by
Giuseppe Di Natale.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Ned Bass <bass6@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #745
Closes #6279
2017-07-08 03:20:35 +00:00
|
|
|
EZFS_ACTIVE_POOL, /* pool is imported on a different system */
|
2008-11-20 20:01:55 +00:00
|
|
|
EZFS_UNKNOWN
|
2013-08-28 11:45:09 +00:00
|
|
|
} zfs_error_t;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
2013-08-28 11:45:09 +00:00
|
|
|
extern void zfs_save_arguments(int argc, char **, char *, int);
|
|
|
|
extern int zpool_log_history(libzfs_handle_t *, const char *);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int libzfs_errno(libzfs_handle_t *);
|
2015-05-20 21:39:52 +00:00
|
|
|
extern const char *libzfs_error_init(int);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern const char *libzfs_error_action(libzfs_handle_t *);
|
|
|
|
extern const char *libzfs_error_description(libzfs_handle_t *);
|
2013-12-11 22:33:41 +00:00
|
|
|
extern int zfs_standard_error(libzfs_handle_t *, int, const char *);
|
2009-01-15 21:59:39 +00:00
|
|
|
extern void libzfs_mnttab_init(libzfs_handle_t *);
|
|
|
|
extern void libzfs_mnttab_fini(libzfs_handle_t *);
|
2009-07-02 22:44:48 +00:00
|
|
|
extern void libzfs_mnttab_cache(libzfs_handle_t *, boolean_t);
|
2009-01-15 21:59:39 +00:00
|
|
|
extern int libzfs_mnttab_find(libzfs_handle_t *, const char *,
|
|
|
|
struct mnttab *);
|
|
|
|
extern void libzfs_mnttab_add(libzfs_handle_t *, const char *,
|
|
|
|
const char *, const char *);
|
|
|
|
extern void libzfs_mnttab_remove(libzfs_handle_t *, const char *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 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);
|
2013-07-05 11:01:44 +00:00
|
|
|
extern const char *zpool_pool_state_to_name(pool_state_t);
|
2008-12-03 20:09:06 +00:00
|
|
|
extern void zpool_free_handles(libzfs_handle_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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 *);
|
2017-02-03 21:24:44 +00:00
|
|
|
extern boolean_t zpool_skip_pool(const char *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions to create and destroy pools
|
|
|
|
*/
|
|
|
|
extern int zpool_create(libzfs_handle_t *, const char *, nvlist_t *,
|
2008-12-03 20:09:06 +00:00
|
|
|
nvlist_t *, nvlist_t *);
|
2013-08-28 11:45:09 +00:00
|
|
|
extern int zpool_destroy(zpool_handle_t *, const char *);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zpool_add(zpool_handle_t *, nvlist_t *);
|
|
|
|
|
2010-05-28 20:45:14 +00:00
|
|
|
typedef struct splitflags {
|
|
|
|
/* do not split, but return the config that would be split off */
|
|
|
|
int dryrun : 1;
|
|
|
|
|
|
|
|
/* after splitting, import the pool */
|
|
|
|
int import : 1;
|
2013-12-29 18:40:46 +00:00
|
|
|
int name_flags;
|
2010-05-28 20:45:14 +00:00
|
|
|
} splitflags_t;
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Functions to manipulate pool and vdev state
|
|
|
|
*/
|
2017-07-07 05:16:13 +00:00
|
|
|
extern int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
|
2011-11-11 22:07:54 +00:00
|
|
|
extern int zpool_reguid(zpool_handle_t *);
|
2012-01-24 02:43:32 +00:00
|
|
|
extern int zpool_reopen(zpool_handle_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2017-05-19 19:33:11 +00:00
|
|
|
extern int zpool_sync_one(zpool_handle_t *, void *);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
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(zpool_handle_t *, const char *);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, nvlist_t *,
|
|
|
|
splitflags_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zpool_vdev_fault(zpool_handle_t *, uint64_t, vdev_aux_t);
|
|
|
|
extern int zpool_vdev_degrade(zpool_handle_t *, uint64_t, vdev_aux_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zpool_vdev_clear(zpool_handle_t *, uint64_t);
|
|
|
|
|
|
|
|
extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *,
|
2008-12-03 20:09:06 +00:00
|
|
|
boolean_t *, boolean_t *);
|
2009-07-02 22:44:48 +00:00
|
|
|
extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *,
|
|
|
|
boolean_t *, boolean_t *, boolean_t *);
|
2010-08-26 18:56:53 +00:00
|
|
|
extern int zpool_label_disk_wait(char *, int);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *);
|
2017-05-19 19:30:16 +00:00
|
|
|
extern uint64_t zpool_vdev_path_to_guid(zpool_handle_t *zhp, const char *path);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2016-10-24 17:45:59 +00:00
|
|
|
int zfs_dev_is_dm(char *dev_name);
|
2017-01-13 17:25:15 +00:00
|
|
|
int zfs_dev_is_whole_disk(char *dev_name);
|
2016-10-24 17:45:59 +00:00
|
|
|
char *zfs_get_underlying_path(char *dev_name);
|
|
|
|
char *zfs_get_enclosure_sysfs_path(char *dev_name);
|
2016-10-19 19:55:59 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Functions to manage pool properties
|
|
|
|
*/
|
|
|
|
extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
|
|
|
|
extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,
|
2013-10-23 08:33:33 +00:00
|
|
|
size_t proplen, zprop_source_t *, boolean_t literal);
|
2008-11-20 20:01:55 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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.
|
|
|
|
*/
|
|
|
|
ZPOOL_STATUS_CORRUPT_CACHE, /* corrupt /kernel/drv/zpool.cache */
|
|
|
|
ZPOOL_STATUS_MISSING_DEV_R, /* missing device with replicas */
|
|
|
|
ZPOOL_STATUS_MISSING_DEV_NR, /* missing device with no replicas */
|
|
|
|
ZPOOL_STATUS_CORRUPT_LABEL_R, /* bad device label with replicas */
|
|
|
|
ZPOOL_STATUS_CORRUPT_LABEL_NR, /* bad device label with no replicas */
|
|
|
|
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_FAILING_DEV, /* device experiencing errors */
|
|
|
|
ZPOOL_STATUS_VERSION_NEWER, /* newer on-disk version */
|
|
|
|
ZPOOL_STATUS_HOSTID_MISMATCH, /* last accessed by another system */
|
Multi-modifier protection (MMP)
Add multihost=on|off pool property to control MMP. When enabled
a new thread writes uberblocks to the last slot in each label, at a
set frequency, to indicate to other hosts the pool is actively imported.
These uberblocks are the last synced uberblock with an updated
timestamp. Property defaults to off.
During tryimport, find the "best" uberblock (newest txg and timestamp)
repeatedly, checking for change in the found uberblock. Include the
results of the activity test in the config returned by tryimport.
These results are reported to user in "zpool import".
Allow the user to control the period between MMP writes, and the
duration of the activity test on import, via a new module parameter
zfs_multihost_interval. The period is specified in milliseconds. The
activity test duration is calculated from this value, and from the
mmp_delay in the "best" uberblock found initially.
Add a kstat interface to export statistics about Multiple Modifier
Protection (MMP) updates. Include the last synced txg number, the
timestamp, the delay since the last MMP update, the VDEV GUID, the VDEV
label that received the last MMP update, and the VDEV path. Abbreviated
output below.
$ cat /proc/spl/kstat/zfs/mypool/multihost
31 0 0x01 10 880 105092382393521 105144180101111
txg timestamp mmp_delay vdev_guid vdev_label vdev_path
20468 261337 250274925 68396651780 3 /dev/sda
20468 261339 252023374 6267402363293 1 /dev/sdc
20468 261340 252000858 6698080955233 1 /dev/sdx
20468 261341 251980635 783892869810 2 /dev/sdy
20468 261342 253385953 8923255792467 3 /dev/sdd
20468 261344 253336622 042125143176 0 /dev/sdab
20468 261345 253310522 1200778101278 2 /dev/sde
20468 261346 253286429 0950576198362 2 /dev/sdt
20468 261347 253261545 96209817917 3 /dev/sds
20468 261349 253238188 8555725937673 3 /dev/sdb
Add a new tunable zfs_multihost_history to specify the number of MMP
updates to store history for. By default it is set to zero meaning that
no MMP statistics are stored.
When using ztest to generate activity, for automated tests of the MMP
function, some test functions interfere with the test. For example, the
pool is exported to run zdb and then imported again. Add a new ztest
function, "-M", to alter ztest behavior to prevent this.
Add new tests to verify the new functionality. Tests provided by
Giuseppe Di Natale.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Ned Bass <bass6@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #745
Closes #6279
2017-07-08 03:20:35 +00:00
|
|
|
ZPOOL_STATUS_HOSTID_ACTIVE, /* currently active on another system */
|
|
|
|
ZPOOL_STATUS_HOSTID_REQUIRED, /* multihost=on and hostid=0 */
|
2008-12-03 20:09:06 +00:00
|
|
|
ZPOOL_STATUS_IO_FAILURE_WAIT, /* failed I/O, failmode 'wait' */
|
|
|
|
ZPOOL_STATUS_IO_FAILURE_CONTINUE, /* failed I/O, failmode 'continue' */
|
2009-02-18 20:51:31 +00:00
|
|
|
ZPOOL_STATUS_BAD_LOG, /* cannot read log chain(s) */
|
2014-02-21 03:57:17 +00:00
|
|
|
ZPOOL_STATUS_ERRATA, /* informational errata available */
|
2009-02-18 20:51:31 +00:00
|
|
|
|
2012-12-13 23:24:15 +00:00
|
|
|
/*
|
|
|
|
* If the pool has unsupported features but can still be opened in
|
|
|
|
* read-only mode, its status is ZPOOL_STATUS_UNSUP_FEAT_WRITE. If the
|
|
|
|
* pool has unsupported features but cannot be opened at all, its
|
|
|
|
* status is ZPOOL_STATUS_UNSUP_FEAT_READ.
|
|
|
|
*/
|
|
|
|
ZPOOL_STATUS_UNSUP_FEAT_READ, /* unsupported features for read */
|
|
|
|
ZPOOL_STATUS_UNSUP_FEAT_WRITE, /* unsupported features for write */
|
|
|
|
|
2009-02-18 20:51:31 +00:00
|
|
|
/*
|
|
|
|
* These faults have no corresponding message ID. At the time we are
|
|
|
|
* checking the status, the original reason for the FMA fault (I/O or
|
|
|
|
* checksum errors) has been lost.
|
|
|
|
*/
|
2008-11-20 20:01:55 +00:00
|
|
|
ZPOOL_STATUS_FAULTED_DEV_R, /* faulted device with replicas */
|
|
|
|
ZPOOL_STATUS_FAULTED_DEV_NR, /* faulted device with no replicas */
|
|
|
|
|
|
|
|
/*
|
|
|
|
* The following are not faults per se, but still an error possibly
|
|
|
|
* requiring administrative attention. There is no corresponding
|
|
|
|
* message ID.
|
|
|
|
*/
|
2012-12-14 23:00:45 +00:00
|
|
|
ZPOOL_STATUS_VERSION_OLDER, /* older legacy on-disk version */
|
|
|
|
ZPOOL_STATUS_FEAT_DISABLED, /* supported features are disabled */
|
2008-11-20 20:01:55 +00:00
|
|
|
ZPOOL_STATUS_RESILVERING, /* device being resilvered */
|
2016-05-05 16:30:05 +00:00
|
|
|
ZPOOL_STATUS_OFFLINE_DEV, /* device offline */
|
2009-08-18 18:43:27 +00:00
|
|
|
ZPOOL_STATUS_REMOVED_DEV, /* removed device */
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Finally, the following indicates a healthy pool.
|
|
|
|
*/
|
|
|
|
ZPOOL_STATUS_OK
|
|
|
|
} zpool_status_t;
|
|
|
|
|
2015-01-23 08:05:04 +00:00
|
|
|
extern unsigned long get_system_hostid(void);
|
2014-02-21 03:57:17 +00:00
|
|
|
extern zpool_status_t zpool_get_status(zpool_handle_t *, char **,
|
|
|
|
zpool_errata_t *);
|
|
|
|
extern zpool_status_t zpool_import_status(nvlist_t *, char **,
|
|
|
|
zpool_errata_t *);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern void zpool_dump_ddt(const ddt_stat_t *dds, const ddt_histogram_t *ddh);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Statistics and configuration functions.
|
|
|
|
*/
|
|
|
|
extern nvlist_t *zpool_get_config(zpool_handle_t *, nvlist_t **);
|
2012-12-13 23:24:15 +00:00
|
|
|
extern nvlist_t *zpool_get_features(zpool_handle_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zpool_refresh_stats(zpool_handle_t *, boolean_t *);
|
|
|
|
extern int zpool_get_errlog(zpool_handle_t *, nvlist_t **);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Import and export functions
|
|
|
|
*/
|
2013-08-28 11:45:09 +00:00
|
|
|
extern int zpool_export(zpool_handle_t *, boolean_t, const char *);
|
|
|
|
extern int zpool_export_force(zpool_handle_t *, const char *);
|
2008-11-20 20:01:55 +00:00
|
|
|
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 *,
|
2010-08-26 21:24:34 +00:00
|
|
|
nvlist_t *, int);
|
2012-12-13 23:24:15 +00:00
|
|
|
extern void zpool_print_unsup_feat(nvlist_t *config);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Search for pools to import
|
|
|
|
*/
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
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 */
|
|
|
|
int can_be_active : 1; /* can the pool be active? */
|
|
|
|
int unique : 1; /* does 'poolname' already exist? */
|
|
|
|
int exists : 1; /* set on return if pool already exists */
|
2016-02-19 23:43:43 +00:00
|
|
|
int scan : 1; /* prefer scanning to libblkid cache */
|
2010-05-28 20:45:14 +00:00
|
|
|
} importargs_t;
|
|
|
|
|
|
|
|
extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *);
|
Multi-modifier protection (MMP)
Add multihost=on|off pool property to control MMP. When enabled
a new thread writes uberblocks to the last slot in each label, at a
set frequency, to indicate to other hosts the pool is actively imported.
These uberblocks are the last synced uberblock with an updated
timestamp. Property defaults to off.
During tryimport, find the "best" uberblock (newest txg and timestamp)
repeatedly, checking for change in the found uberblock. Include the
results of the activity test in the config returned by tryimport.
These results are reported to user in "zpool import".
Allow the user to control the period between MMP writes, and the
duration of the activity test on import, via a new module parameter
zfs_multihost_interval. The period is specified in milliseconds. The
activity test duration is calculated from this value, and from the
mmp_delay in the "best" uberblock found initially.
Add a kstat interface to export statistics about Multiple Modifier
Protection (MMP) updates. Include the last synced txg number, the
timestamp, the delay since the last MMP update, the VDEV GUID, the VDEV
label that received the last MMP update, and the VDEV path. Abbreviated
output below.
$ cat /proc/spl/kstat/zfs/mypool/multihost
31 0 0x01 10 880 105092382393521 105144180101111
txg timestamp mmp_delay vdev_guid vdev_label vdev_path
20468 261337 250274925 68396651780 3 /dev/sda
20468 261339 252023374 6267402363293 1 /dev/sdc
20468 261340 252000858 6698080955233 1 /dev/sdx
20468 261341 251980635 783892869810 2 /dev/sdy
20468 261342 253385953 8923255792467 3 /dev/sdd
20468 261344 253336622 042125143176 0 /dev/sdab
20468 261345 253310522 1200778101278 2 /dev/sde
20468 261346 253286429 0950576198362 2 /dev/sdt
20468 261347 253261545 96209817917 3 /dev/sds
20468 261349 253238188 8555725937673 3 /dev/sdb
Add a new tunable zfs_multihost_history to specify the number of MMP
updates to store history for. By default it is set to zero meaning that
no MMP statistics are stored.
When using ztest to generate activity, for automated tests of the MMP
function, some test functions interfere with the test. For example, the
pool is exported to run zdb and then imported again. Add a new ztest
function, "-M", to alter ztest behavior to prevent this.
Add new tests to verify the new functionality. Tests provided by
Giuseppe Di Natale.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Ned Bass <bass6@llnl.gov>
Reviewed-by: Andreas Dilger <andreas.dilger@intel.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #745
Closes #6279
2017-07-08 03:20:35 +00:00
|
|
|
extern int zpool_tryimport(libzfs_handle_t *hdl, char *target,
|
|
|
|
nvlist_t **configp, importargs_t *args);
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
/* legacy pool search routines */
|
2008-12-03 20:09:06 +00:00
|
|
|
extern nvlist_t *zpool_find_import(libzfs_handle_t *, int, char **);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern nvlist_t *zpool_find_import_cached(libzfs_handle_t *, const char *,
|
2008-12-03 20:09:06 +00:00
|
|
|
char *, uint64_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Miscellaneous pool functions
|
|
|
|
*/
|
|
|
|
struct zfs_cmd;
|
|
|
|
|
2013-08-28 11:45:09 +00:00
|
|
|
extern const char *zfs_history_event_names[];
|
2010-05-28 20:45:14 +00:00
|
|
|
|
2013-12-29 18:40:46 +00:00
|
|
|
typedef enum {
|
|
|
|
VDEV_NAME_PATH = 1 << 0,
|
|
|
|
VDEV_NAME_GUID = 1 << 1,
|
|
|
|
VDEV_NAME_FOLLOW_LINKS = 1 << 2,
|
|
|
|
VDEV_NAME_TYPE_ID = 1 << 3,
|
|
|
|
} vdev_name_t;
|
|
|
|
|
2010-05-28 20:45:14 +00:00
|
|
|
extern char *zpool_vdev_name(libzfs_handle_t *, zpool_handle_t *, nvlist_t *,
|
2013-12-29 18:40:46 +00:00
|
|
|
int name_flags);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zpool_upgrade(zpool_handle_t *, uint64_t);
|
|
|
|
extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
|
|
|
|
nvlist_t ***, uint_t *);
|
2014-02-12 18:30:18 +00:00
|
|
|
extern int zpool_events_next(libzfs_handle_t *, nvlist_t **, int *, unsigned,
|
|
|
|
int);
|
2010-08-26 18:42:43 +00:00
|
|
|
extern int zpool_events_clear(libzfs_handle_t *, int *);
|
2013-11-22 22:52:16 +00:00
|
|
|
extern int zpool_events_seek(libzfs_handle_t *, uint64_t, int);
|
2008-11-20 20:01:55 +00:00
|
|
|
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 *);
|
2009-07-02 22:44:48 +00:00
|
|
|
extern int zpool_get_physpath(zpool_handle_t *, char *, size_t);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern void zpool_explain_recover(libzfs_handle_t *, const char *, int,
|
|
|
|
nvlist_t *);
|
2009-07-02 22:44:48 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* 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);
|
2011-11-17 18:14:36 +00:00
|
|
|
extern zfs_handle_t *zfs_handle_dup(zfs_handle_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern void zfs_close(zfs_handle_t *);
|
|
|
|
extern zfs_type_t zfs_get_type(const zfs_handle_t *);
|
|
|
|
extern const char *zfs_get_name(const zfs_handle_t *);
|
2008-12-03 20:09:06 +00:00
|
|
|
extern zpool_handle_t *zfs_get_pool_handle(const zfs_handle_t *);
|
2017-02-03 21:24:44 +00:00
|
|
|
extern const char *zfs_get_pool_name(const zfs_handle_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* Property management functions. Some functions are shared with the kernel,
|
|
|
|
* and are found in sys/fs/zfs.h.
|
|
|
|
*/
|
|
|
|
|
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
2008-12-03 20:09:06 +00:00
|
|
|
extern nvlist_t *zfs_valid_proplist(libzfs_handle_t *, zfs_type_t,
|
2016-01-13 23:05:59 +00:00
|
|
|
nvlist_t *, uint64_t, zfs_handle_t *, zpool_handle_t *, const char *);
|
2008-12-03 20:09:06 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
extern const char *zfs_prop_to_name(zfs_prop_t);
|
|
|
|
extern int zfs_prop_set(zfs_handle_t *, const char *, const char *);
|
2015-07-05 23:11:09 +00:00
|
|
|
extern int zfs_prop_set_list(zfs_handle_t *, nvlist_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_prop_get(zfs_handle_t *, zfs_prop_t, char *, size_t,
|
|
|
|
zprop_source_t *, char *, size_t, boolean_t);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zfs_prop_get_recvd(zfs_handle_t *, const char *, char *, size_t,
|
|
|
|
boolean_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_prop_get_numeric(zfs_handle_t *, zfs_prop_t, uint64_t *,
|
|
|
|
zprop_source_t *, char *, size_t);
|
2009-07-02 22:44:48 +00:00
|
|
|
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);
|
2011-11-17 18:14:36 +00:00
|
|
|
extern int zfs_prop_get_written_int(zfs_handle_t *zhp, const char *propname,
|
|
|
|
uint64_t *propvalue);
|
|
|
|
extern int zfs_prop_get_written(zfs_handle_t *zhp, const char *propname,
|
|
|
|
char *propbuf, int proplen, boolean_t literal);
|
2012-12-13 23:24:15 +00:00
|
|
|
extern int zfs_prop_get_feature(zfs_handle_t *zhp, const char *propname,
|
|
|
|
char *buf, size_t len);
|
2011-05-19 18:44:07 +00:00
|
|
|
extern uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
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 *);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern nvlist_t *zfs_get_recvd_props(zfs_handle_t *);
|
2011-11-17 18:14:36 +00:00
|
|
|
extern nvlist_t *zfs_get_clones_nvl(zfs_handle_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
typedef struct zprop_list {
|
|
|
|
int pl_prop;
|
|
|
|
char *pl_user_prop;
|
|
|
|
struct zprop_list *pl_next;
|
|
|
|
boolean_t pl_all;
|
|
|
|
size_t pl_width;
|
2010-05-28 20:45:14 +00:00
|
|
|
size_t pl_recvd_width;
|
2008-11-20 20:01:55 +00:00
|
|
|
boolean_t pl_fixed;
|
|
|
|
} zprop_list_t;
|
|
|
|
|
2013-11-19 15:41:37 +00:00
|
|
|
extern int zfs_expand_proplist(zfs_handle_t *, zprop_list_t **, boolean_t,
|
|
|
|
boolean_t);
|
2009-07-02 22:44:48 +00:00
|
|
|
extern void zfs_prune_proplist(zfs_handle_t *, uint8_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
#define ZFS_MOUNTPOINT_NONE "none"
|
|
|
|
#define ZFS_MOUNTPOINT_LEGACY "legacy"
|
|
|
|
|
2012-12-13 23:24:15 +00:00
|
|
|
#define ZFS_FEATURE_DISABLED "disabled"
|
|
|
|
#define ZFS_FEATURE_ENABLED "enabled"
|
|
|
|
#define ZFS_FEATURE_ACTIVE "active"
|
|
|
|
|
|
|
|
#define ZFS_UNSUPPORTED_INACTIVE "inactive"
|
|
|
|
#define ZFS_UNSUPPORTED_READONLY "readonly"
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* zpool property management
|
|
|
|
*/
|
|
|
|
extern int zpool_expand_proplist(zpool_handle_t *, zprop_list_t **);
|
2012-12-13 23:24:15 +00:00
|
|
|
extern int zpool_prop_get_feature(zpool_handle_t *, const char *, char *,
|
|
|
|
size_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
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);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Functions shared by zfs and zpool property management.
|
|
|
|
*/
|
|
|
|
extern int zprop_iter(zprop_func func, void *cb, boolean_t show_all,
|
|
|
|
boolean_t ordered, zfs_type_t type);
|
|
|
|
extern int zprop_get_list(libzfs_handle_t *, char *, zprop_list_t **,
|
|
|
|
zfs_type_t);
|
|
|
|
extern void zprop_free_list(zprop_list_t *);
|
|
|
|
|
2010-05-28 20:45:14 +00:00
|
|
|
#define ZFS_GET_NCOLS 5
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
GET_COL_NONE,
|
|
|
|
GET_COL_NAME,
|
|
|
|
GET_COL_PROPERTY,
|
|
|
|
GET_COL_VALUE,
|
|
|
|
GET_COL_RECVD,
|
|
|
|
GET_COL_SOURCE
|
|
|
|
} zfs_get_column_t;
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Functions for printing zfs or zpool properties
|
|
|
|
*/
|
|
|
|
typedef struct zprop_get_cbdata {
|
|
|
|
int cb_sources;
|
2010-05-28 20:45:14 +00:00
|
|
|
zfs_get_column_t cb_columns[ZFS_GET_NCOLS];
|
|
|
|
int cb_colwidths[ZFS_GET_NCOLS + 1];
|
2008-11-20 20:01:55 +00:00
|
|
|
boolean_t cb_scripted;
|
|
|
|
boolean_t cb_literal;
|
|
|
|
boolean_t cb_first;
|
|
|
|
zprop_list_t *cb_proplist;
|
|
|
|
zfs_type_t cb_type;
|
|
|
|
} zprop_get_cbdata_t;
|
|
|
|
|
|
|
|
void zprop_print_one_property(const char *, zprop_get_cbdata_t *,
|
2010-05-28 20:45:14 +00:00
|
|
|
const char *, const char *, zprop_source_t, const char *,
|
|
|
|
const char *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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_dependents(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
|
|
|
|
extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
|
2012-05-29 17:50:50 +00:00
|
|
|
extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
|
2011-11-17 18:14:36 +00:00
|
|
|
extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
|
2013-12-11 22:33:41 +00:00
|
|
|
extern int zfs_iter_bookmarks(zfs_handle_t *, zfs_iter_f, void *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2010-08-26 21:24:34 +00:00
|
|
|
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 *);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Functions to create and destroy datasets.
|
|
|
|
*/
|
|
|
|
extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
|
|
|
|
nvlist_t *);
|
|
|
|
extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
|
2009-08-18 18:43:27 +00:00
|
|
|
extern int zfs_destroy(zfs_handle_t *, boolean_t);
|
|
|
|
extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
|
2013-09-04 12:00:57 +00:00
|
|
|
extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
|
2008-12-03 20:09:06 +00:00
|
|
|
extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
|
2013-08-28 11:45:09 +00:00
|
|
|
extern int zfs_snapshot_nvl(libzfs_handle_t *hdl, nvlist_t *snaps,
|
|
|
|
nvlist_t *props);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
|
2012-04-27 18:14:46 +00:00
|
|
|
extern int zfs_rename(zfs_handle_t *, const char *, boolean_t, boolean_t);
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
typedef struct sendflags {
|
|
|
|
/* print informational messages (ie, -v was specified) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t verbose;
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
/* recursive send (ie, -R) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t replicate;
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
/* for incrementals, do all intermediate snapshots */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t doall;
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
/* if dataset is a clone, do incremental from its origin */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t fromorigin;
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
/* do deduplication */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t dedup;
|
2010-05-28 20:45:14 +00:00
|
|
|
|
|
|
|
/* send properties (ie, -p) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t props;
|
|
|
|
|
|
|
|
/* do not send (no-op, ie. -n) */
|
|
|
|
boolean_t dryrun;
|
|
|
|
|
|
|
|
/* parsable verbose output (ie. -P) */
|
|
|
|
boolean_t parsable;
|
2012-05-09 22:05:14 +00:00
|
|
|
|
|
|
|
/* show progress (ie. -v) */
|
|
|
|
boolean_t progress;
|
2014-06-05 21:19:08 +00:00
|
|
|
|
2014-11-03 20:15:08 +00:00
|
|
|
/* large blocks (>128K) are permitted */
|
|
|
|
boolean_t largeblock;
|
|
|
|
|
2014-06-05 21:19:08 +00:00
|
|
|
/* WRITE_EMBEDDED records of type DATA are permitted */
|
|
|
|
boolean_t embed_data;
|
2016-07-11 17:45:52 +00:00
|
|
|
|
|
|
|
/* compressed WRITE records are permitted */
|
|
|
|
boolean_t compress;
|
2010-05-28 20:45:14 +00:00
|
|
|
} sendflags_t;
|
|
|
|
|
|
|
|
typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
|
|
|
|
|
2011-11-17 18:14:36 +00:00
|
|
|
extern int zfs_send(zfs_handle_t *, const char *, const char *,
|
|
|
|
sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);
|
2014-06-05 21:19:08 +00:00
|
|
|
extern int zfs_send_one(zfs_handle_t *, const char *, int, enum lzc_send_flags);
|
2016-01-06 21:22:48 +00:00
|
|
|
extern int zfs_send_resume(libzfs_handle_t *, sendflags_t *, int outfd,
|
|
|
|
const char *);
|
|
|
|
extern nvlist_t *zfs_send_resume_token_to_nvlist(libzfs_handle_t *hdl,
|
|
|
|
const char *token);
|
2010-05-28 20:45:14 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_promote(zfs_handle_t *);
|
2013-09-04 12:00:57 +00:00
|
|
|
extern int zfs_hold(zfs_handle_t *, const char *, const char *,
|
2013-05-25 02:06:23 +00:00
|
|
|
boolean_t, int);
|
|
|
|
extern int zfs_hold_nvl(zfs_handle_t *, int, nvlist_t *);
|
2009-08-18 18:43:27 +00:00
|
|
|
extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
|
2011-07-26 22:44:36 +00:00
|
|
|
extern int zfs_get_holds(zfs_handle_t *, nvlist_t **);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-07-02 22:44:48 +00:00
|
|
|
typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain,
|
|
|
|
uid_t rid, uint64_t space);
|
|
|
|
|
2011-07-26 22:44:36 +00:00
|
|
|
extern int zfs_userspace(zfs_handle_t *, zfs_userquota_prop_t,
|
|
|
|
zfs_userspace_cb_t, void *);
|
|
|
|
|
|
|
|
extern int zfs_get_fsacl(zfs_handle_t *, nvlist_t **);
|
|
|
|
extern int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *);
|
2009-07-02 22:44:48 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
typedef struct recvflags {
|
|
|
|
/* print informational messages (ie, -v was specified) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t verbose;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/* the destination is a prefix, not the exact fs (ie, -d) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t isprefix;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2010-05-28 20:45:14 +00:00
|
|
|
/*
|
|
|
|
* Only the tail of the sent snapshot path is appended to the
|
|
|
|
* destination to determine the received snapshot name (ie, -e).
|
|
|
|
*/
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t istail;
|
2010-05-28 20:45:14 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/* do not actually do the recv, just check if it would work (ie, -n) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t dryrun;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/* rollback/destroy filesystems as necessary (eg, -F) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t force;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/* set "canmount=off" on all modified filesystems */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t canmountoff;
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2016-01-06 21:22:48 +00:00
|
|
|
/*
|
|
|
|
* Mark the file systems as "resumable" and do not destroy them if the
|
|
|
|
* receive is interrupted
|
|
|
|
*/
|
|
|
|
boolean_t resumable;
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/* byteswap flag is used internally; callers need not specify */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t byteswap;
|
2009-02-18 20:51:31 +00:00
|
|
|
|
|
|
|
/* do not mount file systems as they are extracted (private) */
|
2011-11-17 18:14:36 +00:00
|
|
|
boolean_t nomount;
|
2008-11-20 20:01:55 +00:00
|
|
|
} recvflags_t;
|
|
|
|
|
2015-12-22 01:31:57 +00:00
|
|
|
extern int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *,
|
|
|
|
recvflags_t *, int, avl_tree_t *);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2010-08-26 21:24:34 +00:00
|
|
|
typedef enum diff_flags {
|
|
|
|
ZFS_DIFF_PARSEABLE = 0x1,
|
|
|
|
ZFS_DIFF_TIMESTAMP = 0x2,
|
|
|
|
ZFS_DIFF_CLASSIFY = 0x4
|
|
|
|
} diff_flags_t;
|
|
|
|
|
|
|
|
extern int zfs_show_diffs(zfs_handle_t *, int, const char *, const char *,
|
|
|
|
int);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* 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_path_to_zhandle(libzfs_handle_t *, char *, zfs_type_t);
|
|
|
|
extern boolean_t zfs_dataset_exists(libzfs_handle_t *, const char *,
|
|
|
|
zfs_type_t);
|
|
|
|
extern int zfs_spa_version(zfs_handle_t *, int *);
|
2013-12-11 22:33:41 +00:00
|
|
|
extern boolean_t zfs_bookmark_exists(const char *path);
|
2012-10-17 23:58:54 +00:00
|
|
|
extern int zfs_append_partition(char *path, size_t max_len);
|
Add helper functions for manipulating device names
This change adds two helper functions for working with vdev names and paths.
zfs_resolve_shortname() resolves a shorthand vdev name to an absolute path
of a file in /dev, /dev/disk/by-id, /dev/disk/by-label, /dev/disk/by-path,
/dev/disk/by-uuid, /dev/disk/zpool. This was previously done only in the
function is_shorthand_path(), but we need a general helper function to
implement shorthand names for additional zpool subcommands like remove.
is_shorthand_path() is accordingly updated to call the helper function.
There is a minor change in the way zfs_resolve_shortname() tests if a file
exists. is_shorthand_path() effectively used open() and stat64() to test for
file existence, since its scope includes testing if a device is a whole disk
and collecting file status information. zfs_resolve_shortname(), on the other
hand, only uses access() to test for existence and leaves it to the caller to
perform any additional file operations. This seemed like the most general and
lightweight approach, and still preserves the semantics of is_shorthand_path().
zfs_append_partition() appends a partition suffix to a device path. This
should be used to generate the name of a whole disk as it is stored in the vdev
label. The user-visible names of whole disks do not contain the partition
information, while the name in the vdev label does. The code was lifted from
the function make_disks(), which now just calls the helper function. Again,
having a helper function to do this supports general handling of shorthand
names in the user interface.
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
2010-10-13 23:16:25 +00:00
|
|
|
extern int zfs_resolve_shortname(const char *name, char *path, size_t pathlen);
|
2012-10-17 23:58:54 +00:00
|
|
|
extern int zfs_strcmp_pathname(char *name, char *cmp_name, int wholedisk);
|
2016-11-07 18:28:57 +00:00
|
|
|
extern int zfs_path_order(char *path, int *order);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
|
|
|
/*
|
|
|
|
* 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_unmount(zfs_handle_t *, const char *, int);
|
|
|
|
extern int zfs_unmountall(zfs_handle_t *, int);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Share support functions.
|
|
|
|
*/
|
|
|
|
extern boolean_t zfs_is_shared(zfs_handle_t *);
|
|
|
|
extern int zfs_share(zfs_handle_t *);
|
|
|
|
extern int zfs_unshare(zfs_handle_t *);
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Protocol-specific share support functions.
|
|
|
|
*/
|
|
|
|
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 *);
|
2016-11-29 19:22:38 +00:00
|
|
|
extern int zfs_unshareall_bytype(zfs_handle_t *, const char *, const char *);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_unshareall(zfs_handle_t *);
|
2009-07-02 22:44:48 +00:00
|
|
|
extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *,
|
2008-11-20 20:01:55 +00:00
|
|
|
void *, void *, int, zfs_share_op_t);
|
|
|
|
|
2017-06-22 16:39:01 +00:00
|
|
|
/*
|
|
|
|
* Formats for iostat numbers. Examples: "12K", "30ms", "4B", "2321234", "-".
|
|
|
|
*
|
|
|
|
* ZFS_NICENUM_1024: Print kilo, mega, tera, peta, exa..
|
|
|
|
* ZFS_NICENUM_BYTES: Print single bytes ("13B"), kilo, mega, tera...
|
|
|
|
* ZFS_NICENUM_TIME: Print nanosecs, microsecs, millisecs, seconds...
|
|
|
|
* ZFS_NICENUM_RAW: Print the raw number without any formatting
|
|
|
|
* ZFS_NICENUM_RAWTIME: Same as RAW, but print dashes ('-') for zero.
|
|
|
|
*/
|
2016-02-29 18:05:23 +00:00
|
|
|
enum zfs_nicenum_format {
|
|
|
|
ZFS_NICENUM_1024 = 0,
|
2017-05-02 20:43:53 +00:00
|
|
|
ZFS_NICENUM_BYTES = 1,
|
|
|
|
ZFS_NICENUM_TIME = 2,
|
2017-06-22 16:39:01 +00:00
|
|
|
ZFS_NICENUM_RAW = 3,
|
|
|
|
ZFS_NICENUM_RAWTIME = 4
|
2016-02-29 18:05:23 +00:00
|
|
|
};
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* Utility function to convert a number to a human-readable form.
|
|
|
|
*/
|
|
|
|
extern void zfs_nicenum(uint64_t, char *, size_t);
|
2016-02-29 18:05:23 +00:00
|
|
|
extern void zfs_nicenum_format(uint64_t num, char *buf, size_t buflen,
|
|
|
|
enum zfs_nicenum_format type);
|
|
|
|
|
|
|
|
|
|
|
|
extern void zfs_nicetime(uint64_t, char *, size_t);
|
2017-05-02 20:43:53 +00:00
|
|
|
extern void zfs_nicebytes(uint64_t, char *, size_t);
|
2008-11-20 20:01:55 +00:00
|
|
|
extern int zfs_nicestrtonum(libzfs_handle_t *, const char *, uint64_t *);
|
|
|
|
|
2010-12-16 23:47:40 +00:00
|
|
|
/*
|
|
|
|
* Utility functions to run an external process.
|
|
|
|
*/
|
2011-03-07 18:10:20 +00:00
|
|
|
#define STDOUT_VERBOSE 0x01
|
|
|
|
#define STDERR_VERBOSE 0x02
|
2017-04-21 16:27:04 +00:00
|
|
|
#define NO_DEFAULT_PATH 0x04 /* Don't use $PATH to lookup the command */
|
2011-03-07 18:10:20 +00:00
|
|
|
|
|
|
|
int libzfs_run_process(const char *, char **, int flags);
|
2017-04-21 16:27:04 +00:00
|
|
|
int libzfs_run_process_get_stdout(const char *path, char *argv[], char *env[],
|
|
|
|
char **lines[], int *lines_cnt);
|
|
|
|
int libzfs_run_process_get_stdout_nopath(const char *path, char *argv[],
|
|
|
|
char *env[], char **lines[], int *lines_cnt);
|
|
|
|
|
|
|
|
void libzfs_free_str_array(char **strs, int count);
|
|
|
|
|
|
|
|
int libzfs_envvar_is_set(char *envvar);
|
2010-12-16 23:47:40 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* 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 *);
|
|
|
|
|
|
|
|
/*
|
2010-05-28 20:45:14 +00:00
|
|
|
* Label manipulation.
|
2008-11-20 20:01:55 +00:00
|
|
|
*/
|
2015-03-20 22:10:24 +00:00
|
|
|
extern int zpool_read_label(int, nvlist_t **, int *);
|
2010-05-28 20:45:14 +00:00
|
|
|
extern int zpool_clear_label(int);
|
2008-11-20 20:01:55 +00:00
|
|
|
|
2009-07-02 22:44:48 +00:00
|
|
|
/*
|
|
|
|
* Management interfaces for SMB ACL files
|
|
|
|
*/
|
|
|
|
|
|
|
|
int zfs_smb_acl_add(libzfs_handle_t *, char *, char *, char *);
|
|
|
|
int zfs_smb_acl_remove(libzfs_handle_t *, char *, char *, char *);
|
|
|
|
int zfs_smb_acl_purge(libzfs_handle_t *, char *, char *);
|
|
|
|
int zfs_smb_acl_rename(libzfs_handle_t *, char *, char *, char *, char *);
|
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
/*
|
|
|
|
* 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);
|
|
|
|
|
2010-05-28 20:45:14 +00:00
|
|
|
/*
|
|
|
|
* Mappings between vdev and FRU.
|
|
|
|
*/
|
|
|
|
extern void libzfs_fru_refresh(libzfs_handle_t *);
|
|
|
|
extern const char *libzfs_fru_lookup(libzfs_handle_t *, const char *);
|
|
|
|
extern const char *libzfs_fru_devpath(libzfs_handle_t *, const char *);
|
|
|
|
extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *,
|
|
|
|
const char *);
|
|
|
|
extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *);
|
|
|
|
extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *);
|
|
|
|
|
2016-03-14 16:04:21 +00:00
|
|
|
/*
|
|
|
|
* Support for Linux libudev derived persistent device strings
|
|
|
|
*/
|
|
|
|
extern boolean_t is_mpath_whole_disk(const char *);
|
|
|
|
extern void update_vdev_config_dev_strs(nvlist_t *);
|
2016-10-19 19:55:59 +00:00
|
|
|
extern char *zfs_strip_partition(char *);
|
2016-11-29 21:45:38 +00:00
|
|
|
extern char *zfs_strip_partition_path(char *);
|
2016-08-31 21:46:58 +00:00
|
|
|
|
|
|
|
#ifdef HAVE_LIBUDEV
|
|
|
|
struct udev_device;
|
2016-10-19 19:55:59 +00:00
|
|
|
|
|
|
|
extern boolean_t udev_is_mpath(struct udev_device *dev);
|
2016-08-31 21:46:58 +00:00
|
|
|
extern int zfs_device_get_devid(struct udev_device *, char *, size_t);
|
|
|
|
extern int zfs_device_get_physical(struct udev_device *, char *, size_t);
|
|
|
|
#endif
|
2016-03-14 16:04:21 +00:00
|
|
|
|
2008-11-20 20:01:55 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#endif /* _LIBZFS_H */
|