aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/zdb
diff options
context:
space:
mode:
authorDon Brady <[email protected]>2018-11-05 12:22:33 -0700
committerBrian Behlendorf <[email protected]>2018-11-05 11:22:33 -0800
commite89f1295d4faa88bb05a62c8dd5f781657db5955 (patch)
tree8e39dfe33c6849e00813e54ec95c09a24448a43a /cmd/zdb
parent6644e5bb6e1a6c25c5006c819abf93c7bb662e80 (diff)
Add libzutil for libzfs or libzpool consumers
Adds a libzutil for utility functions that are common to libzfs and libzpool consumers (most of what was in libzfs_import.c). This removes the need for utilities to link against both libzpool and libzfs. Reviewed-by: Matthew Ahrens <[email protected]> Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Don Brady <[email protected]> Closes #8050
Diffstat (limited to 'cmd/zdb')
-rw-r--r--cmd/zdb/Makefile.am1
-rw-r--r--cmd/zdb/zdb.c13
2 files changed, 5 insertions, 9 deletions
diff --git a/cmd/zdb/Makefile.am b/cmd/zdb/Makefile.am
index 70b60bfaf..1fa7ec651 100644
--- a/cmd/zdb/Makefile.am
+++ b/cmd/zdb/Makefile.am
@@ -16,5 +16,4 @@ zdb_SOURCES = \
zdb_LDADD = \
$(top_builddir)/lib/libnvpair/libnvpair.la \
- $(top_builddir)/lib/libzfs/libzfs.la \
$(top_builddir)/lib/libzpool/libzpool.la
diff --git a/cmd/zdb/zdb.c b/cmd/zdb/zdb.c
index 737217538..52a671557 100644
--- a/cmd/zdb/zdb.c
+++ b/cmd/zdb/zdb.c
@@ -67,7 +67,9 @@
#include <sys/dsl_crypt.h>
#include <sys/dsl_scan.h>
#include <zfs_comutil.h>
-#include <libzfs.h>
+
+#include <libnvpair.h>
+#include <libzutil.h>
#include "zdb.h"
@@ -106,7 +108,6 @@ typedef void object_viewer_t(objset_t *, uint64_t, void *data, size_t size);
uint64_t *zopt_object = NULL;
static unsigned zopt_objects = 0;
-libzfs_handle_t *g_zfs;
uint64_t max_inflight = 1000;
static int leaked_objects = 0;
static range_tree_t *mos_refd_objs;
@@ -5996,10 +5997,6 @@ main(int argc, char **argv)
spa_load_verify_dryrun = B_TRUE;
kernel_init(FREAD);
- if ((g_zfs = libzfs_init()) == NULL) {
- (void) fprintf(stderr, "%s", libzfs_error_init(errno));
- return (1);
- }
if (dump_all)
verbose = MAX(verbose, 1);
@@ -6078,7 +6075,8 @@ main(int argc, char **argv)
args.path = searchdirs;
args.can_be_active = B_TRUE;
- error = zpool_tryimport(g_zfs, target_pool, &cfg, &args);
+ error = zpool_find_config(NULL, target_pool, &cfg, &args,
+ &libzpool_config_ops);
if (error == 0) {
@@ -6228,7 +6226,6 @@ main(int argc, char **argv)
dump_debug_buffer();
- libzfs_fini(g_zfs);
kernel_fini();
return (error);