Print this page
2882 implement libzfs_core
2883 changing "canmount" property to "on" should not always remount dataset
2900 "zfs snapshot" should be able to create multiple, arbitrary snapshots at once
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Chris Siden <christopher.siden@delphix.com>
Reviewed by: Garrett D'Amore <garrett@damore.org>
Reviewed by: Bill Pijewski <wdp@joyent.com>
Reviewed by: Dan Kruchinin <dan.kruchinin@gmail.com>

@@ -41,10 +41,11 @@
 #include <sys/mnttab.h>
 #include <sys/mntent.h>
 #include <sys/types.h>
 
 #include <libzfs.h>
+#include <libzfs_core.h>
 
 #include "libzfs_impl.h"
 #include "zfs_prop.h"
 #include "zfeature_common.h"
 

@@ -628,10 +629,18 @@
                 return (NULL);
         }
 
         hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "r");
 
+        if (libzfs_core_init() != 0) {
+                (void) close(hdl->libzfs_fd);
+                (void) fclose(hdl->libzfs_mnttab);
+                (void) fclose(hdl->libzfs_sharetab);
+                free(hdl);
+                return (NULL);
+        }
+
         zfs_prop_init();
         zpool_prop_init();
         zpool_feature_init();
         libzfs_mnttab_init(hdl);
 

@@ -645,16 +654,15 @@
         if (hdl->libzfs_mnttab)
                 (void) fclose(hdl->libzfs_mnttab);
         if (hdl->libzfs_sharetab)
                 (void) fclose(hdl->libzfs_sharetab);
         zfs_uninit_libshare(hdl);
-        if (hdl->libzfs_log_str)
-                (void) free(hdl->libzfs_log_str);
         zpool_free_handles(hdl);
         libzfs_fru_clear(hdl, B_TRUE);
         namespace_clear(hdl);
         libzfs_mnttab_fini(hdl);
+        libzfs_core_fini();
         free(hdl);
 }
 
 libzfs_handle_t *
 zpool_get_handle(zpool_handle_t *zhp)

@@ -812,21 +820,11 @@
 }
 
 int
 zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc)
 {
-        int error;
-
-        zc->zc_history = (uint64_t)(uintptr_t)hdl->libzfs_log_str;
-        error = ioctl(hdl->libzfs_fd, request, zc);
-        if (hdl->libzfs_log_str) {
-                free(hdl->libzfs_log_str);
-                hdl->libzfs_log_str = NULL;
-        }
-        zc->zc_history = 0;
-
-        return (error);
+        return (ioctl(hdl->libzfs_fd, request, zc));
 }
 
 /*
  * ================================================================
  * API shared by zfs and zpool property management