diff options
author | Brian Behlendorf <[email protected]> | 2016-02-19 15:43:43 -0800 |
---|---|---|
committer | Brian Behlendorf <[email protected]> | 2016-03-09 10:39:22 -0800 |
commit | 7d11e37e5502e4dc473a9fe073779823d6ca2495 (patch) | |
tree | e40580f53ba6d20d3e6b1d063fa59e0fe2956a66 /cmd | |
parent | 048bb5bd4950b9cb5368ed93d273f0f36e439122 (diff) |
Require libblkid
Historically libblkid support was detected as part of configure
and optionally enabled. This was done because at the time support
for detecting ZFS pool vdevs had just be added to libblkid and
those updated packages were not yet part of many distributions.
This is no longer the case and any reasonably current distribution
will ship a version of libblkid which can detect ZFS pool vdevs.
This patch makes libblkid mandatory at build time and libblkid
the preferred method of scanning for ZFS pools. For distributions
which include a modern version of libblkid there is no change in
behavior. Explicitly scanning the default search paths is still
supported and can be enabled with the '-s' command line option.
Additionally making libblkid mandatory means that the 'zpool create'
command can reliably detect if a specified device has an existing
non-ZFS filesystem (ext4, xfs) and print a warning.
Signed-off-by: Brian Behlendorf <[email protected]>
Closes #2448
Diffstat (limited to 'cmd')
-rw-r--r-- | cmd/zpool/zpool_main.c | 10 | ||||
-rw-r--r-- | cmd/zpool/zpool_vdev.c | 11 |
2 files changed, 9 insertions, 12 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index bd7be7246..b74dc219a 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2080,6 +2080,9 @@ do_import(nvlist_t *config, const char *newname, const char *mntopts, * * -o Set property=value and/or temporary mount options (without '='). * + * -s Scan using the default search path, the libblkid cache will + * not be consulted. + * * The import command scans for pools to import, and import pools based on pool * name and GUID. The pool can also be renamed as part of the import process. */ @@ -2109,13 +2112,14 @@ zpool_do_import(int argc, char **argv) boolean_t dryrun = B_FALSE; boolean_t do_rewind = B_FALSE; boolean_t xtreme_rewind = B_FALSE; + boolean_t do_scan = B_FALSE; uint64_t pool_state, txg = -1ULL; char *cachefile = NULL; importargs_t idata = { 0 }; char *endptr; /* check options */ - while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:R:tT:VX")) != -1) { + while ((c = getopt(argc, argv, ":aCc:d:DEfFmnNo:R:stT:VX")) != -1) { switch (c) { case 'a': do_all = B_TRUE; @@ -2173,6 +2177,9 @@ zpool_do_import(int argc, char **argv) ZPOOL_PROP_CACHEFILE), "none", &props, B_TRUE)) goto error; break; + case 's': + do_scan = B_TRUE; + break; case 't': flags |= ZFS_IMPORT_TEMP_NAME; if (add_prop_list_default(zpool_prop_to_name( @@ -2322,6 +2329,7 @@ zpool_do_import(int argc, char **argv) idata.poolname = searchname; idata.guid = searchguid; idata.cachefile = cachefile; + idata.scan = do_scan; pools = zpool_search_import(g_zfs, &idata); diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index cae20147b..54ca1b261 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -78,12 +78,7 @@ #include <sys/vtoc.h> #include <sys/mntent.h> #include <uuid/uuid.h> -#ifdef HAVE_LIBBLKID #include <blkid/blkid.h> -#else -#define blkid_cache void * -#endif /* HAVE_LIBBLKID */ - #include "zpool_util.h" #include <sys/zfs_context.h> @@ -374,7 +369,6 @@ static int check_slice(const char *path, blkid_cache cache, int force, boolean_t isspare) { int err; -#ifdef HAVE_LIBBLKID char *value; /* No valid type detected device is safe to use */ @@ -400,9 +394,6 @@ check_slice(const char *path, blkid_cache cache, int force, boolean_t isspare) } free(value); -#else - err = check_file(path, force, isspare); -#endif /* HAVE_LIBBLKID */ return (err); } @@ -500,7 +491,6 @@ check_device(const char *path, boolean_t force, { static blkid_cache cache = NULL; -#ifdef HAVE_LIBBLKID /* * There is no easy way to add a correct blkid_put_cache() call, * memory will be reclaimed when the command exits. @@ -519,7 +509,6 @@ check_device(const char *path, boolean_t force, return (-1); } } -#endif /* HAVE_LIBBLKID */ return (check_disk(path, cache, force, isspare, iswholedisk)); } |