mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2026-05-22 02:27:36 +03:00
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 <mahrens@delphix.com> Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Don Brady <don.brady@delphix.com> Closes #8050
This commit is contained in:
committed by
Brian Behlendorf
parent
6644e5bb6e
commit
e89f1295d4
@@ -20,7 +20,6 @@ ztest_SOURCES = \
|
||||
|
||||
ztest_LDADD = \
|
||||
$(top_builddir)/lib/libnvpair/libnvpair.la \
|
||||
$(top_builddir)/lib/libzfs/libzfs.la \
|
||||
$(top_builddir)/lib/libzpool/libzpool.la
|
||||
|
||||
ztest_LDADD += -lm
|
||||
|
||||
+3
-5
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user