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:
parent
ea6212f0ed
commit
17ce8d3714
@ -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,9 +184,7 @@ 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,56 +268,60 @@ main(int argc, char **argv)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/* for each requested cylinder group ... */
|
if (cfg_lv & 0xf8) {
|
||||||
for (cylno = cg_start; cylno < cg_stop; cylno++) {
|
/* for each requested cylinder group ... */
|
||||||
snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno);
|
for (cylno = cg_start; cylno < cg_stop; cylno++) {
|
||||||
if (cfg_lv & 0x002) {
|
snprintf(dbg_line, sizeof(dbg_line), "cgr %d", cylno);
|
||||||
/* dump the superblock copies */
|
if (cfg_lv & 0x002) {
|
||||||
|
/* dump the superblock copies */
|
||||||
|
if (bread(&disk, fsbtodb(&sblock,
|
||||||
|
cgsblock(&sblock, cylno)),
|
||||||
|
(void *)&osblock, SBLOCKSIZE) == -1)
|
||||||
|
err(1, "bread: %s", disk.d_error);
|
||||||
|
DBG_DUMP_FS(&osblock, dbg_line);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* Read the cylinder group and dump whatever was
|
||||||
|
* requested.
|
||||||
|
*/
|
||||||
if (bread(&disk, fsbtodb(&sblock,
|
if (bread(&disk, fsbtodb(&sblock,
|
||||||
cgsblock(&sblock, cylno)),
|
cgtod(&sblock, cylno)), (void *)&acg,
|
||||||
(void *)&osblock, SBLOCKSIZE) == -1)
|
(size_t)sblock.fs_cgsize) == -1)
|
||||||
err(1, "bread: %s", disk.d_error);
|
err(1, "bread: %s", disk.d_error);
|
||||||
DBG_DUMP_FS(&osblock, dbg_line);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
if (cfg_lv & 0x008)
|
||||||
* Read the cylinder group and dump whatever was
|
DBG_DUMP_CG(&sblock, dbg_line, &acg);
|
||||||
* requested.
|
if (cfg_lv & 0x010)
|
||||||
*/
|
DBG_DUMP_INMAP(&sblock, dbg_line, &acg);
|
||||||
if (bread(&disk, fsbtodb(&sblock,
|
if (cfg_lv & 0x020)
|
||||||
cgtod(&sblock, cylno)), (void *)&acg,
|
DBG_DUMP_FRMAP(&sblock, dbg_line, &acg);
|
||||||
(size_t)sblock.fs_cgsize) == -1)
|
if (cfg_lv & 0x040) {
|
||||||
err(1, "bread: %s", disk.d_error);
|
DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
|
||||||
|
DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
|
||||||
if (cfg_lv & 0x008)
|
}
|
||||||
DBG_DUMP_CG(&sblock, dbg_line, &acg);
|
#ifdef NOT_CURRENTLY
|
||||||
if (cfg_lv & 0x010)
|
/*
|
||||||
DBG_DUMP_INMAP(&sblock, dbg_line, &acg);
|
* See the comment in sbin/growfs/debug.c for why this
|
||||||
if (cfg_lv & 0x020)
|
* is currently disabled, and what needs to be done to
|
||||||
DBG_DUMP_FRMAP(&sblock, dbg_line, &acg);
|
* re-enable it.
|
||||||
if (cfg_lv & 0x040) {
|
*/
|
||||||
DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
|
if (disk.d_ufs == 1 && cfg_lv & 0x080)
|
||||||
DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
|
DBG_DUMP_SPTBL(&sblock, dbg_line, &acg);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
#ifdef NOT_CURRENTLY
|
|
||||||
/*
|
|
||||||
* See the comment in sbin/growfs/debug.c for why this
|
|
||||||
* is currently disabled, and what needs to be done to
|
|
||||||
* re-enable it.
|
|
||||||
*/
|
|
||||||
if (disk.d_ufs == 1 && cfg_lv & 0x080)
|
|
||||||
DBG_DUMP_SPTBL(&sblock, dbg_line, &acg);
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Dump the requested inode(s) */
|
if (cfg_lv & 0x300) {
|
||||||
if (cfg_in != -2)
|
/* Dump the requested inode(s) */
|
||||||
DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
|
if (cfg_in != -2)
|
||||||
else {
|
DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
|
||||||
for (in = cg_start * sblock.fs_ipg;
|
else {
|
||||||
in < (ino_t)cg_stop * sblock.fs_ipg;
|
for (in = cg_start * sblock.fs_ipg;
|
||||||
in++)
|
in < (ino_t)cg_stop * sblock.fs_ipg;
|
||||||
DUMP_WHOLE_INODE(in, cfg_lv);
|
in++)
|
||||||
|
DUMP_WHOLE_INODE(in, cfg_lv);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DBG_CLOSE;
|
DBG_CLOSE;
|
||||||
|
Loading…
Reference in New Issue
Block a user