--- old/usr/src/lib/libzfs/common/libzfs.h	Mon Aug  5 17:16:40 2019
+++ new/usr/src/lib/libzfs/common/libzfs.h	Mon Aug  5 17:16:40 2019
@@ -22,11 +22,11 @@
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011 Pawel Jakub Dawidek. All rights reserved.
- * Copyright (c) 2011, 2017 by Delphix. All rights reserved.
+ * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
  * Copyright (c) 2012, Joyent, Inc. All rights reserved.
  * Copyright (c) 2013 Steven Hartland. All rights reserved.
  * Copyright (c) 2014 Integros [integros.com]
- * Copyright 2016 Nexenta Systems, Inc.
+ * Copyright 2017 Nexenta Systems, Inc.
  * Copyright (c) 2017 Datto Inc.
  */
 
@@ -51,7 +51,7 @@
 /*
  * Miscellaneous ZFS constants
  */
-#define	ZFS_MAXPROPLEN		MAXPATHLEN
+#define	ZFS_MAXPROPLEN		(2 * MAXPATHLEN)
 #define	ZPOOL_MAXPROPLEN	MAXPATHLEN
 
 /*
@@ -129,8 +129,16 @@
 	EZFS_DIFF,		/* general failure of zfs diff */
 	EZFS_DIFFDATA,		/* bad zfs diff data */
 	EZFS_POOLREADONLY,	/* pool is in read-only mode */
+	EZFS_PROPNOTSUP,	/* property not supported */
+	EZFS_COSNOTFOUND,	/* no matching CoS descriptor found */
+	EZFS_COSEXIST,		/* CoS descriptor already exists */
+	EZFS_COSREF,		/* CoS descriptor still referenced */
+	EZFS_WBCNOTSUP,		/* 'feature@wbc' is not enabled */
+	EZFS_WBCCHILD,		/* child ds has enabled WBC */
+	EZFS_WBCPARENT,		/* parent ds has enabled WBC */
+	EZFS_WBCALREADY,	/* WBC already enabled or disabled */
+	EZFS_WBCINPROGRESS,	/* WBC is disabling */
 	EZFS_SCRUB_PAUSED,	/* scrub currently paused */
-	EZFS_NO_PENDING,	/* cannot cancel, no operation is pending */
 	EZFS_UNKNOWN
 } zfs_error_t;
 
@@ -227,6 +235,7 @@
 extern const char *zpool_state_to_name(vdev_state_t, vdev_aux_t);
 extern const char *zpool_pool_state_to_name(pool_state_t);
 extern void zpool_free_handles(libzfs_handle_t *);
+extern int zpool_standard_error(libzfs_handle_t *, int, const char *);
 
 /*
  * Iterate over all active pools in the system.
@@ -255,6 +264,7 @@
  * Functions to manipulate pool and vdev state
  */
 extern int zpool_scan(zpool_handle_t *, pool_scan_func_t, pool_scrub_cmd_t);
+extern int zpool_trim(zpool_handle_t *, boolean_t start, uint64_t rate);
 extern int zpool_clear(zpool_handle_t *, const char *, nvlist_t *);
 extern int zpool_reguid(zpool_handle_t *);
 extern int zpool_reopen(zpool_handle_t *);
@@ -266,8 +276,6 @@
     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 *);
-extern int zpool_vdev_remove_cancel(zpool_handle_t *);
-extern int zpool_vdev_indirect_size(zpool_handle_t *, const char *, uint64_t *);
 extern int zpool_vdev_split(zpool_handle_t *, char *, nvlist_t **, nvlist_t *,
     splitflags_t);
 
@@ -276,7 +284,7 @@
 extern int zpool_vdev_clear(zpool_handle_t *, uint64_t);
 
 extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, boolean_t *,
-    boolean_t *, boolean_t *);
+    boolean_t *, boolean_t *, boolean_t *);
 extern nvlist_t *zpool_find_vdev_by_physpath(zpool_handle_t *, const char *,
     boolean_t *, boolean_t *, boolean_t *);
 extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, const char *,
@@ -285,6 +293,7 @@
 /*
  * Functions to manage pool properties
  */
+extern int zpool_set_proplist(zpool_handle_t *, nvlist_t *);
 extern int zpool_set_prop(zpool_handle_t *, const char *, const char *);
 extern int zpool_get_prop(zpool_handle_t *, zpool_prop_t, char *,
     size_t proplen, zprop_source_t *, boolean_t);
@@ -367,8 +376,8 @@
 /*
  * Import and export functions
  */
-extern int zpool_export(zpool_handle_t *, boolean_t, const char *);
-extern int zpool_export_force(zpool_handle_t *, const char *);
+extern int zpool_export(zpool_handle_t *, boolean_t, boolean_t, const char *);
+extern int zpool_export_force(zpool_handle_t *, boolean_t, const char *);
 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 *,
@@ -388,7 +397,6 @@
 	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	*/
-	nvlist_t *policy;	/* rewind policy (rewind txg, etc.)	*/
 } importargs_t;
 
 extern nvlist_t *zpool_search_import(libzfs_handle_t *, importargs_t *);
@@ -411,6 +419,7 @@
 extern int zpool_get_history(zpool_handle_t *, nvlist_t **);
 extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
     nvlist_t ***, uint_t *);
+extern int zpool_stage_history(libzfs_handle_t *, const char *);
 extern void zpool_obj_to_path(zpool_handle_t *, uint64_t, uint64_t, char *,
     size_t len);
 extern int zfs_ioctl(libzfs_handle_t *, int, struct zfs_cmd *);
@@ -510,6 +519,25 @@
 extern boolean_t zpool_prop_align_right(zpool_prop_t);
 
 /*
+ * Functions to manage vdev properties
+ */
+extern int vdev_set_proplist(zpool_handle_t *, const char *, nvlist_t *);
+extern int vdev_get_proplist(libzfs_handle_t *, char *, zprop_list_t **);
+extern int vdev_get_prop(zpool_handle_t *,  const char *, vdev_prop_t,
+    char *, size_t len);
+
+/*
+ * Functions to manage cos properties
+ */
+extern int cos_alloc(zpool_handle_t *, char *, nvlist_t *);
+extern int cos_free(zpool_handle_t *, char *, uint64_t, boolean_t);
+extern int cos_list(zpool_handle_t *, nvlist_t **);
+extern int cos_set_proplist(zpool_handle_t *, const char *, nvlist_t *);
+extern int cos_get_proplist(libzfs_handle_t *, char *, zprop_list_t **);
+extern int cos_get_prop(zpool_handle_t *,  const char *, cos_prop_t, char *,
+    size_t, nvlist_t **);
+
+/*
  * Functions shared by zfs and zpool property management.
  */
 extern int zprop_iter(zprop_func func, void *cb, boolean_t show_all,
@@ -546,6 +574,10 @@
 void zprop_print_one_property(const char *, zprop_get_cbdata_t *,
     const char *, const char *, zprop_source_t, const char *,
     const char *);
+void vdev_print_one_property(const char *, const char *,
+    zprop_get_cbdata_t *, const char *, const char *);
+void cos_print_one_property(const char *, const char *,
+    zprop_get_cbdata_t *, const char *, const char *);
 
 /*
  * Iterator functions.
@@ -555,6 +587,8 @@
 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 *);
+extern int zfs_iter_autosnapshots(zfs_handle_t *, boolean_t, zfs_iter_f,
+    void *);
 extern int zfs_iter_snapshots(zfs_handle_t *, boolean_t, zfs_iter_f, void *);
 extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
 extern int zfs_iter_snapspec(zfs_handle_t *, const char *, zfs_iter_f, void *);
@@ -577,6 +611,8 @@
 extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
     nvlist_t *);
 extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
+extern int zfs_check_krrp(libzfs_handle_t *, const char *);
+extern int zfs_destroy_atomically(zfs_handle_t *, boolean_t);
 extern int zfs_destroy(zfs_handle_t *, boolean_t);
 extern int zfs_destroy_snaps(zfs_handle_t *, char *, boolean_t);
 extern int zfs_destroy_snaps_nvl(libzfs_handle_t *, nvlist_t *, boolean_t);
@@ -609,6 +645,9 @@
 	/* do not send (no-op, ie. -n) */
 	boolean_t dryrun;
 
+	/* do not send (just calculate exact send stream size, ie. -s */
+	boolean_t sendsize;
+
 	/* parsable verbose output (ie. -P) */
 	boolean_t parsable;
 
@@ -671,6 +710,9 @@
 	/* rollback/destroy filesystems as necessary (eg, -F) */
 	boolean_t force;
 
+	/* when force-receiving, do not destroy snapshots (ie, -K) */
+	boolean_t keepsnap;
+
 	/* set "canmount=off" on all modified filesystems */
 	boolean_t canmountoff;
 
@@ -687,8 +729,8 @@
 	boolean_t nomount;
 } recvflags_t;
 
-extern int zfs_receive(libzfs_handle_t *, const char *, nvlist_t *,
-    recvflags_t *, int, avl_tree_t *);
+extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t *,
+    int, nvlist_t *, nvlist_t *, avl_tree_t *);
 
 typedef enum diff_flags {
 	ZFS_DIFF_PARSEABLE = 0x1,
@@ -788,7 +830,9 @@
  * sharing/unsharing them.
  */
 extern int zpool_enable_datasets(zpool_handle_t *, const char *, int);
+extern int zpool_enable_datasets_ex(zpool_handle_t *, const char *, int, int);
 extern int zpool_disable_datasets(zpool_handle_t *, boolean_t);
+extern int zpool_disable_datasets_ex(zpool_handle_t *, boolean_t, int);
 
 /*
  * Mappings between vdev and FRU.
@@ -796,6 +840,9 @@
 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_cmp_enclosure(const char *a, const char *b);
+extern int libzfs_fru_cmp_slot(libzfs_handle_t *, const char *, const char *,
+    size_t);
 extern boolean_t libzfs_fru_compare(libzfs_handle_t *, const char *,
     const char *);
 extern boolean_t libzfs_fru_notself(libzfs_handle_t *, const char *);
@@ -802,7 +849,6 @@
 extern int zpool_fru_set(zpool_handle_t *, uint64_t, const char *);
 
 extern int zfs_get_hole_count(const char *, uint64_t *, uint64_t *);
-extern int zfs_remap_indirects(libzfs_handle_t *hdl, const char *);
 
 /* Allow consumers to initialize libshare externally for optimal performance */
 extern int zfs_init_libshare_arg(libzfs_handle_t *, int, void *);
