aboutsummaryrefslogtreecommitdiffstats
path: root/cmd/ztest/ztest.c
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/ztest/ztest.c
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/ztest/ztest.c')
-rw-r--r--cmd/ztest/ztest.c8
1 files changed, 3 insertions, 5 deletions
diff --git a/cmd/ztest/ztest.c b/cmd/ztest/ztest.c
index 14e8a5e27..03c62fc6f 100644
--- a/cmd/ztest/ztest.c
+++ b/cmd/ztest/ztest.c
@@ -128,7 +128,7 @@
#include <sys/fs/zfs.h>
#include <zfs_fletcher.h>
#include <libnvpair.h>
-#include <libzfs.h>
+#include <libzutil.h>
#include <sys/crypto/icp.h>
#ifdef __GLIBC__
#include <execinfo.h> /* for backtrace() */
@@ -7065,7 +7065,6 @@ make_random_props(void)
static void
ztest_import(ztest_shared_t *zs)
{
- libzfs_handle_t *hdl;
importargs_t args = { 0 };
spa_t *spa;
nvlist_t *cfg = NULL;
@@ -7080,14 +7079,14 @@ ztest_import(ztest_shared_t *zs)
VERIFY0(pthread_rwlock_init(&ztest_name_lock, NULL));
kernel_init(FREAD | FWRITE);
- hdl = libzfs_init();
searchdirs[0] = ztest_opts.zo_dir;
args.paths = nsearch;
args.path = searchdirs;
args.can_be_active = B_FALSE;
- error = zpool_tryimport(hdl, name, &cfg, &args);
+ error = zpool_find_config(NULL, name, &cfg, &args,
+ &libzpool_config_ops);
if (error)
(void) fatal(0, "No pools found\n");
@@ -7097,7 +7096,6 @@ ztest_import(ztest_shared_t *zs)
1ULL << spa->spa_root_vdev->vdev_child[0]->vdev_ms_shift;
spa_close(spa, FTAG);
- libzfs_fini(hdl);
kernel_fini();
if (!ztest_opts.zo_mmp_test) {