Make growfs(8) mostly style compliant. No functional changes,
verified with MD5.
This commit is contained in:
parent
5fe0ebe46a
commit
aba698f9de
@ -44,7 +44,6 @@ static const char rcsid[] =
|
||||
"$FreeBSD$";
|
||||
#endif /* not lint */
|
||||
|
||||
/* ********************************************************** INCLUDES ***** */
|
||||
#include <sys/param.h>
|
||||
|
||||
#include <limits.h>
|
||||
@ -57,7 +56,6 @@ static const char rcsid[] =
|
||||
|
||||
#ifdef FS_DEBUG
|
||||
|
||||
/* *********************************************************** GLOBALS ***** */
|
||||
static FILE *dbg_log = NULL;
|
||||
static unsigned int indent = 0;
|
||||
|
||||
@ -65,7 +63,6 @@ static unsigned int indent=0;
|
||||
* prototypes not done here, as they come with debug.h
|
||||
*/
|
||||
|
||||
/* ********************************************************** dbg_open ***** */
|
||||
/*
|
||||
* Open the filehandle where all debug output has to go.
|
||||
*/
|
||||
@ -81,7 +78,6 @@ dbg_open(const char *fn)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ********************************************************* dbg_close ***** */
|
||||
/*
|
||||
* Close the filehandle where all debug output went to.
|
||||
*/
|
||||
@ -97,7 +93,6 @@ dbg_close(void)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ****************************************************** dbg_dump_hex ***** */
|
||||
/*
|
||||
* Dump out a full file system block in hex.
|
||||
*/
|
||||
@ -106,17 +101,16 @@ dbg_dump_hex(struct fs *sb, const char *comment, unsigned char *mem)
|
||||
{
|
||||
int i, j, k;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START HEXDUMP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)mem, comment);
|
||||
indent++;
|
||||
for (i = 0; i < sb->fs_bsize; i += 24) {
|
||||
for (j = 0; j < 3; j++) {
|
||||
for (k=0; k<8; k++) {
|
||||
for (k = 0; k < 8; k++)
|
||||
fprintf(dbg_log, "%02x ", *mem++);
|
||||
}
|
||||
fprintf(dbg_log, " ");
|
||||
}
|
||||
fprintf(dbg_log, "\n");
|
||||
@ -127,7 +121,6 @@ dbg_dump_hex(struct fs *sb, const char *comment, unsigned char *mem)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ******************************************************* dbg_dump_fs ***** */
|
||||
/*
|
||||
* Dump the superblock.
|
||||
*/
|
||||
@ -138,9 +131,8 @@ dbg_dump_fs(struct fs *sb, const char *comment)
|
||||
int j;
|
||||
#endif /* FSMAXSNAP */
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START SUPERBLOCK =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)sb, comment);
|
||||
@ -356,7 +348,6 @@ dbg_dump_fs(struct fs *sb, const char *comment)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ******************************************************* dbg_dump_cg ***** */
|
||||
/*
|
||||
* Dump a cylinder group.
|
||||
*/
|
||||
@ -365,9 +356,8 @@ dbg_dump_cg(const char *comment, struct cg *cgr)
|
||||
{
|
||||
int j;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START CYLINDER GROUP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
|
||||
@ -411,7 +401,6 @@ dbg_dump_cg(const char *comment, struct cg *cgr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ***************************************************** dbg_dump_csum ***** */
|
||||
/*
|
||||
* Dump a cylinder summary.
|
||||
*/
|
||||
@ -419,9 +408,8 @@ void
|
||||
dbg_dump_csum(const char *comment, struct csum *cs)
|
||||
{
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START CYLINDER SUMMARY =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment);
|
||||
@ -438,7 +426,6 @@ dbg_dump_csum(const char *comment, struct csum *cs)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ************************************************ dbg_dump_csum_total ***** */
|
||||
/*
|
||||
* Dump a cylinder summary.
|
||||
*/
|
||||
@ -446,9 +433,8 @@ void
|
||||
dbg_dump_csum_total(const char *comment, struct csum_total *cs)
|
||||
{
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START CYLINDER SUMMARY TOTAL =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment);
|
||||
@ -475,7 +461,6 @@ dbg_dump_csum_total(const char *comment, struct csum_total *cs)
|
||||
|
||||
return;
|
||||
}
|
||||
/* **************************************************** dbg_dump_inmap ***** */
|
||||
/*
|
||||
* Dump the inode allocation map in one cylinder group.
|
||||
*/
|
||||
@ -485,9 +470,8 @@ dbg_dump_inmap(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
int j,k,l,e;
|
||||
unsigned char *cp;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START INODE ALLOCATION MAP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
|
||||
@ -520,7 +504,6 @@ dbg_dump_inmap(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
}
|
||||
|
||||
|
||||
/* **************************************************** dbg_dump_frmap ***** */
|
||||
/*
|
||||
* Dump the fragment allocation map in one cylinder group.
|
||||
*/
|
||||
@ -530,9 +513,8 @@ dbg_dump_frmap(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
int j,k,l,e;
|
||||
unsigned char *cp;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START FRAGMENT ALLOCATION MAP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
|
||||
@ -567,7 +549,6 @@ dbg_dump_frmap(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* **************************************************** dbg_dump_clmap ***** */
|
||||
/*
|
||||
* Dump the cluster allocation map in one cylinder group.
|
||||
*/
|
||||
@ -577,9 +558,8 @@ dbg_dump_clmap(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
int j,k,l,e;
|
||||
unsigned char *cp;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START CLUSTER ALLOCATION MAP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
|
||||
@ -614,7 +594,6 @@ dbg_dump_clmap(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
return;
|
||||
}
|
||||
|
||||
/* **************************************************** dbg_dump_clsum ***** */
|
||||
/*
|
||||
* Dump the cluster availability summary of one cylinder group.
|
||||
*/
|
||||
@ -624,9 +603,8 @@ dbg_dump_clsum(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
int j;
|
||||
int *ip;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START CLUSTER SUMMARY =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
|
||||
@ -651,7 +629,6 @@ dbg_dump_clsum(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
* will leave it disabled for now; it should probably be re-enabled
|
||||
* specifically for UFS1.
|
||||
*/
|
||||
/* **************************************************** dbg_dump_sptbl ***** */
|
||||
/*
|
||||
* Dump the block summary, and the rotational layout table.
|
||||
*/
|
||||
@ -661,9 +638,8 @@ dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
int j,k;
|
||||
int *ip;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log,
|
||||
"===== START BLOCK SUMMARY AND POSITION TABLE =====\n");
|
||||
@ -675,10 +651,9 @@ dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
fprintf(dbg_log, "%2d: %5d = ", j, *ip++);
|
||||
for (k = 0; k < sb->fs_old_nrpos; k++) {
|
||||
fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]);
|
||||
if(k<sb->fs_old_nrpos-1) {
|
||||
if (k < sb->fs_old_nrpos - 1)
|
||||
fprintf(dbg_log, " + ");
|
||||
}
|
||||
}
|
||||
fprintf(dbg_log, "\n");
|
||||
}
|
||||
|
||||
@ -689,7 +664,6 @@ dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
|
||||
}
|
||||
#endif
|
||||
|
||||
/* ************************************************** dbg_dump_ufs1_ino ***** */
|
||||
/*
|
||||
* Dump a UFS1 inode structure.
|
||||
*/
|
||||
@ -699,9 +673,8 @@ dbg_dump_ufs1_ino(struct fs *sb, const char *comment, struct ufs1_dinode *ino)
|
||||
int ictr;
|
||||
int remaining_blocks;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START UFS1 INODE DUMP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
|
||||
@ -758,7 +731,6 @@ dbg_dump_ufs1_ino(struct fs *sb, const char *comment, struct ufs1_dinode *ino)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ************************************************** dbg_dump_ufs2_ino ***** */
|
||||
/*
|
||||
* Dump a UFS2 inode structure.
|
||||
*/
|
||||
@ -768,9 +740,8 @@ dbg_dump_ufs2_ino(struct fs *sb, const char *comment, struct ufs2_dinode *ino)
|
||||
int ictr;
|
||||
int remaining_blocks;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START UFS2 INODE DUMP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
|
||||
@ -831,7 +802,6 @@ dbg_dump_ufs2_ino(struct fs *sb, const char *comment, struct ufs2_dinode *ino)
|
||||
return;
|
||||
}
|
||||
|
||||
/* ***************************************************** dbg_dump_iblk ***** */
|
||||
/*
|
||||
* Dump an indirect block. The iteration to dump a full file has to be
|
||||
* written around.
|
||||
@ -841,9 +811,8 @@ dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
|
||||
{
|
||||
unsigned int *mem, i, j, size;
|
||||
|
||||
if(!dbg_log) {
|
||||
if (!dbg_log)
|
||||
return;
|
||||
}
|
||||
|
||||
fprintf(dbg_log, "===== START INDIRECT BLOCK DUMP =====\n");
|
||||
fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)block,
|
||||
@ -856,14 +825,13 @@ dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
|
||||
size = sizeof(ufs2_daddr_t);
|
||||
|
||||
mem = (unsigned int *)block;
|
||||
for (i=0; (size_t)i<MIN(howmany(sb->fs_bsize, size),
|
||||
length); i+=8) {
|
||||
for (i = 0; (size_t)i < MIN(howmany(sb->fs_bsize, size), length);
|
||||
i += 8) {
|
||||
fprintf(dbg_log, "%04x: ", i);
|
||||
for (j = 0; j < 8; j++) {
|
||||
if((size_t)(i+j)<length) {
|
||||
if ((size_t)(i + j) < length)
|
||||
fprintf(dbg_log, "%08X ", *mem++);
|
||||
}
|
||||
}
|
||||
fprintf(dbg_log, "\n");
|
||||
}
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user