summaryrefslogtreecommitdiffstats
path: root/cddl/contrib/opensolaris/cmd
diff options
context:
space:
mode:
authoravg <avg@FreeBSD.org>2017-10-30 08:58:39 +0000
committeravg <avg@FreeBSD.org>2017-10-30 08:58:39 +0000
commitdba756bd969c8233e795c6ca1dc2718e410a1ad2 (patch)
treeaeaab0303383eb5f0748d0f721258ecdd449cdfc /cddl/contrib/opensolaris/cmd
parentd0de92dde7fdc32ad84c6b22c72f85356774f33f (diff)
downloadFreeBSD-src-dba756bd969c8233e795c6ca1dc2718e410a1ad2.zip
FreeBSD-src-dba756bd969c8233e795c6ca1dc2718e410a1ad2.tar.gz
MFC r324344: MFV r316864: 6392 zdb: introduce -V for verbatim import
Diffstat (limited to 'cddl/contrib/opensolaris/cmd')
-rw-r--r--cddl/contrib/opensolaris/cmd/zdb/zdb.c26
1 files changed, 14 insertions, 12 deletions
diff --git a/cddl/contrib/opensolaris/cmd/zdb/zdb.c b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
index 97e47ab..64506d3 100644
--- a/cddl/contrib/opensolaris/cmd/zdb/zdb.c
+++ b/cddl/contrib/opensolaris/cmd/zdb/zdb.c
@@ -121,20 +121,21 @@ static void
usage(void)
{
(void) fprintf(stderr,
- "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-p <path> ...]] "
+ "Usage:\t%s [-AbcdDFGhiLMPsvX] [-e [-V] [-p <path> ...]] "
"[-I <inflight I/Os>]\n"
"\t\t[-o <var>=<value>]... [-t <txg>] [-U <cache>] [-x <dumpdir>]\n"
"\t\t[<poolname> [<object> ...]]\n"
- "\t%s [-AdiPv] [-e [-p <path> ...]] [-U <cache>] <dataset> "
+ "\t%s [-AdiPv] [-e [-V] [-p <path> ...]] [-U <cache>] <dataset> "
"[<object> ...]\n"
"\t%s -C [-A] [-U <cache>]\n"
"\t%s -l [-Aqu] <device>\n"
- "\t%s -m [-AFLPX] [-e [-p <path> ...]] [-t <txg>] [-U <cache>]\n"
- "\t\t<poolname> [<vdev> [<metaslab> ...]]\n"
+ "\t%s -m [-AFLPX] [-e [-V] [-p <path> ...]] [-t <txg>] "
+ "[-U <cache>]\n\t\t<poolname> [<vdev> [<metaslab> ...]]\n"
"\t%s -O <dataset> <path>\n"
- "\t%s -R [-A] [-e [-p <path> ...]] [-U <cache>]\n"
+ "\t%s -R [-A] [-e [-V] [-p <path> ...]] [-U <cache>]\n"
"\t\t<poolname> <vdev>:<offset>:<size>[:<flags>]\n"
- "\t%s -S [-AP] [-e [-p <path> ...]] [-U <cache>] <poolname>\n\n",
+ "\t%s -S [-AP] [-e [-V] [-p <path> ...]] [-U <cache>] "
+ "<poolname>\n\n",
cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname,
cmdname);
@@ -189,6 +190,7 @@ usage(void)
(void) fprintf(stderr, " -u uberblock\n");
(void) fprintf(stderr, " -U <cachefile_path> -- use alternate "
"cachefile\n");
+ (void) fprintf(stderr, " -V do verbatim import\n");
(void) fprintf(stderr, " -x <dumpdir> -- "
"dump all read blocks into specified directory\n");
(void) fprintf(stderr, " -X attempt extreme rewind (does not "
@@ -3749,6 +3751,7 @@ main(int argc, char **argv)
char *target;
nvlist_t *policy = NULL;
uint64_t max_txg = UINT64_MAX;
+ int flags = ZFS_IMPORT_MISSING_LOG;
int rewind = ZPOOL_NEVER_REWIND;
char *spa_config_path_env;
boolean_t target_is_spa = B_TRUE;
@@ -3768,7 +3771,7 @@ main(int argc, char **argv)
spa_config_path = spa_config_path_env;
while ((c = getopt(argc, argv,
- "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vx:X")) != -1) {
+ "AbcCdDeFGhiI:lLmMo:Op:PqRsSt:uU:vVx:X")) != -1) {
switch (c) {
case 'b':
case 'c':
@@ -3842,6 +3845,9 @@ main(int argc, char **argv)
case 'v':
verbose++;
break;
+ case 'V':
+ flags = ZFS_IMPORT_VERBATIM;
+ break;
case 'x':
vn_dumpdir = optarg;
break;
@@ -3942,11 +3948,7 @@ main(int argc, char **argv)
fatal("can't open '%s': %s",
target, strerror(ENOMEM));
}
- if ((error = spa_import(name, cfg, NULL,
- ZFS_IMPORT_MISSING_LOG)) != 0) {
- error = spa_import(name, cfg, NULL,
- ZFS_IMPORT_VERBATIM);
- }
+ error = spa_import(name, cfg, NULL, flags);
}
}
OpenPOWER on IntegriCloud