Illumos #1644, #1645, #1646, #1647, #1708
[zfs.git] / include / libzfs.h
index 096910b..83e1bee 100644 (file)
@@ -406,6 +406,7 @@ extern void zpool_explain_recover(libzfs_handle_t *, const char *, int,
  * underlying datasets, only the references to them.
  */
 extern zfs_handle_t *zfs_open(libzfs_handle_t *, const char *, int);
+extern zfs_handle_t *zfs_handle_dup(zfs_handle_t *);
 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 *);
@@ -439,6 +440,12 @@ 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);
+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);
+extern int zfs_get_snapused_int(zfs_handle_t *firstsnap, zfs_handle_t *lastsnap,
+    uint64_t *usedp);
 extern uint64_t getprop_uint64(zfs_handle_t *, zfs_prop_t, char **);
 extern uint64_t zfs_prop_get_int(zfs_handle_t *, zfs_prop_t);
 extern int zfs_prop_inherit(zfs_handle_t *, const char *, boolean_t);
@@ -446,6 +453,7 @@ extern const char *zfs_prop_values(zfs_prop_t);
 extern int zfs_prop_is_string(zfs_prop_t prop);
 extern nvlist_t *zfs_get_user_props(zfs_handle_t *);
 extern nvlist_t *zfs_get_recvd_props(zfs_handle_t *);
+extern nvlist_t *zfs_get_clones_nvl(zfs_handle_t *);
 
 typedef struct zprop_list {
        int             pl_prop;
@@ -520,6 +528,7 @@ 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_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 *);
 
 typedef struct get_all_cb {
        zfs_handle_t    **cb_handles;
@@ -540,6 +549,7 @@ extern int zfs_create(libzfs_handle_t *, const char *, zfs_type_t,
 extern int zfs_create_ancestors(libzfs_handle_t *, const char *);
 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(zfs_handle_t *, nvlist_t *, boolean_t);
 extern int zfs_clone(zfs_handle_t *, const char *, nvlist_t *);
 extern int zfs_snapshot(libzfs_handle_t *, const char *, boolean_t, nvlist_t *);
 extern int zfs_rollback(zfs_handle_t *, zfs_handle_t *, boolean_t);
@@ -547,29 +557,34 @@ extern int zfs_rename(zfs_handle_t *, const char *, boolean_t);
 
 typedef struct sendflags {
        /* print informational messages (ie, -v was specified) */
-       int verbose : 1;
+       boolean_t verbose;
 
        /* recursive send  (ie, -R) */
-       int replicate : 1;
+       boolean_t replicate;
 
        /* for incrementals, do all intermediate snapshots */
-       int doall : 1; /* (ie, -I) */
+       boolean_t doall;
 
        /* if dataset is a clone, do incremental from its origin */
-       int fromorigin : 1;
+       boolean_t fromorigin;
 
        /* do deduplication */
-       int dedup : 1;
+       boolean_t dedup;
 
        /* send properties (ie, -p) */
-       int props : 1;
+       boolean_t props;
+
+       /* do not send (no-op, ie. -n) */
+       boolean_t dryrun;
+
+       /* parsable verbose output (ie. -P) */
+       boolean_t parsable;
 } sendflags_t;
 
 typedef boolean_t (snapfilter_cb_t)(zfs_handle_t *, void *);
 
-extern int zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
-    sendflags_t flags, int outfd, snapfilter_cb_t filter_func,
-    void *cb_arg, nvlist_t **debugnvp);
+extern int zfs_send(zfs_handle_t *, const char *, const char *,
+    sendflags_t *, int, snapfilter_cb_t, void *, nvlist_t **);
 
 extern int zfs_promote(zfs_handle_t *);
 extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t,
@@ -589,34 +604,34 @@ extern int zfs_set_fsacl(zfs_handle_t *, boolean_t, nvlist_t *);
 
 typedef struct recvflags {
        /* print informational messages (ie, -v was specified) */
-       int verbose : 1;
+       boolean_t verbose;
 
        /* the destination is a prefix, not the exact fs (ie, -d) */
-       int isprefix : 1;
+       boolean_t isprefix;
 
        /*
         * Only the tail of the sent snapshot path is appended to the
         * destination to determine the received snapshot name (ie, -e).
         */
-       int istail : 1;
+       boolean_t istail;
 
        /* do not actually do the recv, just check if it would work (ie, -n) */
-       int dryrun : 1;
+       boolean_t dryrun;
 
        /* rollback/destroy filesystems as necessary (eg, -F) */
-       int force : 1;
+       boolean_t force;
 
        /* set "canmount=off" on all modified filesystems */
-       int canmountoff : 1;
+       boolean_t canmountoff;
 
        /* byteswap flag is used internally; callers need not specify */
-       int byteswap : 1;
+       boolean_t byteswap;
 
        /* do not mount file systems as they are extracted (private) */
-       int nomount : 1;
+       boolean_t nomount;
 } recvflags_t;
 
-extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t,
+extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t *,
     int, avl_tree_t *);
 
 typedef enum diff_flags {