Add "-o ashift" to zpool add and zpool attach
[zfs.git] / cmd / zdb / zdb.c
index 459445b..ce6318e 100644 (file)
@@ -55,7 +55,6 @@
 #include <sys/arc.h>
 #include <sys/ddt.h>
 #undef ZFS_MAXNAMELEN
-#undef verify
 #include <libzfs.h>
 
 #define        ZDB_COMPRESS_NAME(idx) ((idx) < ZIO_COMPRESS_FUNCTIONS ? \
@@ -102,13 +101,16 @@ static void
 usage(void)
 {
        (void) fprintf(stderr,
-           "Usage: %s [-CumdibcsDvhL] poolname [object...]\n"
-           "       %s [-div] dataset [object...]\n"
-           "       %s -m [-L] poolname [vdev [metaslab...]]\n"
-           "       %s -R poolname vdev:offset:size[:flags]\n"
-           "       %s -S poolname\n"
-           "       %s -l [-u] device\n"
-           "       %s -C\n\n",
+           "Usage: %s [-CumdibcsDvhLXFPA] [-t txg] [-e [-p path...]] "
+           "poolname [object...]\n"
+           "       %s [-divPA] [-e -p path...] dataset [object...]\n"
+           "       %s -m [-LXFPA] [-t txg] [-e [-p path...]] "
+           "poolname [vdev [metaslab...]]\n"
+           "       %s -R [-A] [-e [-p path...]] poolname "
+           "vdev:offset:size[:flags]\n"
+           "       %s -S [-PA] [-e [-p path...]] poolname\n"
+           "       %s -l [-uA] device\n"
+           "       %s -C [-A] [-U config]\n\n",
            cmdname, cmdname, cmdname, cmdname, cmdname, cmdname, cmdname);
 
        (void) fprintf(stderr, "    Dataset name must include at least one "
@@ -150,7 +152,7 @@ usage(void)
            "has altroot/not in a cachefile\n");
        (void) fprintf(stderr, "        -p <path> -- use one or more with "
            "-e to specify path to vdev dir\n");
-       (void) fprintf(stderr, "        -P print numbers parsable\n");
+       (void) fprintf(stderr, "        -P print numbers in parseable form\n");
        (void) fprintf(stderr, "        -t <txg> -- highest txg to use when "
            "searching for uberblocks\n");
        (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) "
@@ -696,7 +698,9 @@ dump_ddt(ddt_t *ddt, enum ddt_type type, enum ddt_class class)
                return;
        ASSERT(error == 0);
 
-       if ((count = ddt_object_count(ddt, type, class)) == 0)
+       error = ddt_object_count(ddt, type, class, &count);
+       ASSERT(error == 0);
+       if (count == 0)
                return;
 
        dspace = doi.doi_physical_blocks_512 << 9;
@@ -1804,7 +1808,7 @@ dump_label(const char *dev)
                exit(1);
        }
 
-       if (fstat64(fd, &statbuf) != 0) {
+       if (fstat64_blk(fd, &statbuf) != 0) {
                (void) printf("failed to stat '%s': %s\n", path,
                    strerror(errno));
                free(path);
@@ -1812,14 +1816,6 @@ dump_label(const char *dev)
                exit(1);
        }
 
-       if (S_ISBLK(statbuf.st_mode)) {
-               (void) printf("cannot use '%s': character device required\n",
-                   path);
-               free(path);
-               (void) close(fd);
-               exit(1);
-       }
-
        psize = statbuf.st_size;
        psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t));
 
@@ -3037,8 +3033,8 @@ main(int argc, char **argv)
        }
 
        kernel_init(FREAD);
-       g_zfs = libzfs_init();
-       ASSERT(g_zfs != NULL);
+       if ((g_zfs = libzfs_init()) == NULL)
+               return (1);
 
        if (dump_all)
                verbose = MAX(verbose, 1);