MFC: Default output to stdout as the man page suggests.

Only go through our cylinder group and inode info when we need to.
This commit is contained in:
brian 2007-03-19 19:16:49 +00:00
parent ea6212f0ed
commit 17ce8d3714

View File

@ -141,7 +141,7 @@ main(int argc, char **argv)
cfg_lv = 0xff; cfg_lv = 0xff;
cfg_in = -2; cfg_in = -2;
cfg_cg = -2; cfg_cg = -2;
out_file = NULL; out_file = "-";
while ((ch = getopt(argc, argv, "g:i:l:o:")) != -1) { while ((ch = getopt(argc, argv, "g:i:l:o:")) != -1) {
switch (ch) { switch (ch) {
@ -184,8 +184,6 @@ main(int argc, char **argv)
if (argc != 1) if (argc != 1)
usage(); usage();
device = *argv; device = *argv;
if (out_file == NULL)
errx(1, "out_file not specified");
/* /*
* Now we try to guess the (raw)device name. * Now we try to guess the (raw)device name.
@ -270,6 +268,7 @@ main(int argc, char **argv)
} }
} }
if (cfg_lv & 0xf8) {
/* for each requested cylinder group ... */ /* for each requested cylinder group ... */
for (cylno = cg_start; cylno < cg_stop; cylno++) { for (cylno = cg_start; cylno < cg_stop; cylno++) {
snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno); snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno);
@ -301,7 +300,7 @@ main(int argc, char **argv)
DBG_DUMP_CLMAP(&sblock, dbg_line, &acg); DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
DBG_DUMP_CLSUM(&sblock, dbg_line, &acg); DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
} }
#ifdef NOT_CURRENTLY #ifdef NOT_CURRENTLY
/* /*
* See the comment in sbin/growfs/debug.c for why this * See the comment in sbin/growfs/debug.c for why this
* is currently disabled, and what needs to be done to * is currently disabled, and what needs to be done to
@ -309,9 +308,11 @@ main(int argc, char **argv)
*/ */
if (disk.d_ufs == 1 && cfg_lv & 0x080) if (disk.d_ufs == 1 && cfg_lv & 0x080)
DBG_DUMP_SPTBL(&sblock, dbg_line, &acg); DBG_DUMP_SPTBL(&sblock, dbg_line, &acg);
#endif #endif
}
} }
if (cfg_lv & 0x300) {
/* Dump the requested inode(s) */ /* Dump the requested inode(s) */
if (cfg_in != -2) if (cfg_in != -2)
DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv); DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
@ -321,6 +322,7 @@ main(int argc, char **argv)
in++) in++)
DUMP_WHOLE_INODE(in, cfg_lv); DUMP_WHOLE_INODE(in, cfg_lv);
} }
}
DBG_CLOSE; DBG_CLOSE;
DBG_LEAVE; DBG_LEAVE;