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>

Split Close
Expand all
Collapse all
          --- old/usr/src/lib/libzfs/common/libzfs_util.c
          +++ new/usr/src/lib/libzfs/common/libzfs_util.c
↓ open down ↓ 35 lines elided ↑ open up ↑
  36   36  #include <stdlib.h>
  37   37  #include <strings.h>
  38   38  #include <unistd.h>
  39   39  #include <ctype.h>
  40   40  #include <math.h>
  41   41  #include <sys/mnttab.h>
  42   42  #include <sys/mntent.h>
  43   43  #include <sys/types.h>
  44   44  
  45   45  #include <libzfs.h>
       46 +#include <libzfs_core.h>
  46   47  
  47   48  #include "libzfs_impl.h"
  48   49  #include "zfs_prop.h"
  49   50  #include "zfeature_common.h"
  50   51  
  51   52  int
  52   53  libzfs_errno(libzfs_handle_t *hdl)
  53   54  {
  54   55          return (hdl->libzfs_error);
  55   56  }
↓ open down ↓ 567 lines elided ↑ open up ↑
 623  624          }
 624  625  
 625  626          if ((hdl->libzfs_mnttab = fopen(MNTTAB, "r")) == NULL) {
 626  627                  (void) close(hdl->libzfs_fd);
 627  628                  free(hdl);
 628  629                  return (NULL);
 629  630          }
 630  631  
 631  632          hdl->libzfs_sharetab = fopen("/etc/dfs/sharetab", "r");
 632  633  
      634 +        if (libzfs_core_init() != 0) {
      635 +                (void) close(hdl->libzfs_fd);
      636 +                (void) fclose(hdl->libzfs_mnttab);
      637 +                (void) fclose(hdl->libzfs_sharetab);
      638 +                free(hdl);
      639 +                return (NULL);
      640 +        }
      641 +
 633  642          zfs_prop_init();
 634  643          zpool_prop_init();
 635  644          zpool_feature_init();
 636  645          libzfs_mnttab_init(hdl);
 637  646  
 638  647          return (hdl);
 639  648  }
 640  649  
 641  650  void
 642  651  libzfs_fini(libzfs_handle_t *hdl)
 643  652  {
 644  653          (void) close(hdl->libzfs_fd);
 645  654          if (hdl->libzfs_mnttab)
 646  655                  (void) fclose(hdl->libzfs_mnttab);
 647  656          if (hdl->libzfs_sharetab)
 648  657                  (void) fclose(hdl->libzfs_sharetab);
 649  658          zfs_uninit_libshare(hdl);
 650      -        if (hdl->libzfs_log_str)
 651      -                (void) free(hdl->libzfs_log_str);
 652  659          zpool_free_handles(hdl);
 653  660          libzfs_fru_clear(hdl, B_TRUE);
 654  661          namespace_clear(hdl);
 655  662          libzfs_mnttab_fini(hdl);
      663 +        libzfs_core_fini();
 656  664          free(hdl);
 657  665  }
 658  666  
 659  667  libzfs_handle_t *
 660  668  zpool_get_handle(zpool_handle_t *zhp)
 661  669  {
 662  670          return (zhp->zpool_hdl);
 663  671  }
 664  672  
 665  673  libzfs_handle_t *
↓ open down ↓ 141 lines elided ↑ open up ↑
 807  815          if (nvlist_unpack((void *)(uintptr_t)zc->zc_nvlist_dst,
 808  816              zc->zc_nvlist_dst_size, nvlp, 0) != 0)
 809  817                  return (no_memory(hdl));
 810  818  
 811  819          return (0);
 812  820  }
 813  821  
 814  822  int
 815  823  zfs_ioctl(libzfs_handle_t *hdl, int request, zfs_cmd_t *zc)
 816  824  {
 817      -        int error;
 818      -
 819      -        zc->zc_history = (uint64_t)(uintptr_t)hdl->libzfs_log_str;
 820      -        error = ioctl(hdl->libzfs_fd, request, zc);
 821      -        if (hdl->libzfs_log_str) {
 822      -                free(hdl->libzfs_log_str);
 823      -                hdl->libzfs_log_str = NULL;
 824      -        }
 825      -        zc->zc_history = 0;
 826      -
 827      -        return (error);
      825 +        return (ioctl(hdl->libzfs_fd, request, zc));
 828  826  }
 829  827  
 830  828  /*
 831  829   * ================================================================
 832  830   * API shared by zfs and zpool property management
 833  831   * ================================================================
 834  832   */
 835  833  
 836  834  static void
 837  835  zprop_print_headers(zprop_get_cbdata_t *cbp, zfs_type_t type)
↓ open down ↓ 655 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX