Fix spl version check
[zfs.git] / lib / libzfs / include / libzfs.h
index 6f7fed6..dcbd283 100644 (file)
@@ -49,6 +49,26 @@ extern "C" {
 #define        ZPOOL_MAXPROPLEN        MAXPATHLEN
 
 /*
+ * Default device paths
+ */
+
+#if defined(__sun__) || defined(__sun)
+#define        DISK_ROOT       "/dev/dsk"
+#define        RDISK_ROOT      "/dev/rdsk"
+#define        UDISK_ROOT      RDISK_ROOT
+#define        FIRST_SLICE     "s0"
+#define        BACKUP_SLICE    "s2"
+#endif
+
+#ifdef __linux__
+#define        DISK_ROOT       "/dev"
+#define        RDISK_ROOT      DISK_ROOT
+#define        UDISK_ROOT      "/dev/disk"
+#define        FIRST_SLICE     "1"
+#define        BACKUP_SLICE    ""
+#endif
+
+/*
  * libzfs errors
  */
 enum {
@@ -103,7 +123,6 @@ enum {
        EZFS_BADPERM,           /* invalid permission */
        EZFS_BADPERMSET,        /* invalid permission set name */
        EZFS_NODELEGATION,      /* delegated administration is disabled */
-       EZFS_PERMRDONLY,        /* pemissions are readonly */
        EZFS_UNSHARESMBFAILED,  /* failed to unshare over smb */
        EZFS_SHARESMBFAILED,    /* failed to share over smb */
        EZFS_BADCACHE,          /* bad cache file */
@@ -120,6 +139,9 @@ enum {
        EZFS_POSTSPLIT_ONLINE,  /* onlining a disk after splitting it */
        EZFS_SCRUBBING,         /* currently scrubbing */
        EZFS_NO_SCRUB,          /* no active scrub */
+       EZFS_DIFF,              /* general failure of zfs diff */
+       EZFS_DIFFDATA,          /* bad zfs diff data */
+       EZFS_POOLREADONLY,      /* pool is in read-only mode */
        EZFS_UNKNOWN
 };
 
@@ -246,6 +268,7 @@ extern nvlist_t *zpool_find_vdev(zpool_handle_t *, const char *, 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_wait(char *, int);
 extern int zpool_label_disk(libzfs_handle_t *, zpool_handle_t *, char *);
 
 /*
@@ -326,7 +349,7 @@ extern int zpool_export_force(zpool_handle_t *);
 extern int zpool_import(libzfs_handle_t *, nvlist_t *, const char *,
     char *altroot);
 extern int zpool_import_props(libzfs_handle_t *, nvlist_t *, const char *,
-    nvlist_t *, boolean_t);
+    nvlist_t *, int);
 
 /*
  * Search for pools to import
@@ -366,6 +389,8 @@ extern int zpool_history_unpack(char *, uint64_t, uint64_t *,
 extern void zpool_set_history_str(const char *subcommand, int argc,
     char **argv, char *history_str);
 extern int zpool_stage_history(libzfs_handle_t *, const char *);
+extern int zpool_events_next(libzfs_handle_t *, nvlist_t **, int *, int, int);
+extern int zpool_events_clear(libzfs_handle_t *, int *);
 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 *);
@@ -492,6 +517,17 @@ extern int zfs_iter_filesystems(zfs_handle_t *, zfs_iter_f, void *);
 extern int zfs_iter_snapshots(zfs_handle_t *, zfs_iter_f, void *);
 extern int zfs_iter_snapshots_sorted(zfs_handle_t *, zfs_iter_f, void *);
 
+typedef struct get_all_cb {
+       zfs_handle_t    **cb_handles;
+       size_t          cb_alloc;
+       size_t          cb_used;
+       boolean_t       cb_verbose;
+       int             (*cb_getone)(zfs_handle_t *, void *);
+} get_all_cb_t;
+
+void libzfs_add_handle(get_all_cb_t *, zfs_handle_t *);
+int libzfs_dataset_cmp(const void *, const void *);
+
 /*
  * Functions to create and destroy datasets.
  */
@@ -533,12 +569,8 @@ extern int zfs_send(zfs_handle_t *zhp, const char *fromsnap, const char *tosnap,
 
 extern int zfs_promote(zfs_handle_t *);
 extern int zfs_hold(zfs_handle_t *, const char *, const char *, boolean_t,
-    boolean_t, boolean_t);
-extern int zfs_hold_range(zfs_handle_t *, const char *, const char *,
-    const char *, boolean_t, boolean_t, snapfilter_cb_t, void *);
+    boolean_t, boolean_t, int, uint64_t, uint64_t);
 extern int zfs_release(zfs_handle_t *, const char *, const char *, boolean_t);
-extern int zfs_release_range(zfs_handle_t *, const char *, const char *,
-    const char *, boolean_t);
 extern uint64_t zvol_volsize_to_reservation(uint64_t, nvlist_t *);
 
 typedef int (*zfs_userspace_cb_t)(void *arg, const char *domain,
@@ -579,6 +611,15 @@ typedef struct recvflags {
 extern int zfs_receive(libzfs_handle_t *, const char *, recvflags_t,
     int, avl_tree_t *);
 
+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);
+
 /*
  * Miscellaneous functions.
  */
@@ -624,15 +665,6 @@ extern int zfs_deleg_share_nfs(libzfs_handle_t *, char *, char *, char *,
     void *, void *, int, zfs_share_op_t);
 
 /*
- * When dealing with nvlists, verify() is extremely useful
- */
-#ifdef NDEBUG
-#define        verify(EX)      ((void)(EX))
-#else
-#define        verify(EX)      assert(EX)
-#endif
-
-/*
  * Utility function to convert a number to a human-readable form.
  */
 extern void zfs_nicenum(uint64_t, char *, size_t);
@@ -650,9 +682,6 @@ extern int zpool_in_use(libzfs_handle_t *, int, pool_state_t *, char **,
 extern int zpool_read_label(int, nvlist_t **);
 extern int zpool_clear_label(int);
 
-/* is this zvol valid for use as a dump device? */
-extern int zvol_check_dump_config(char *);
-
 /*
  * Management interfaces for SMB ACL files
  */