bin/53517: [PATCH] repair ffsinfo(8) on CURRENT

Lukas Ertl l.ertl at univie.ac.at
Thu Jun 19 15:10:09 PDT 2003


>Number:         53517
>Category:       bin
>Synopsis:       [PATCH] repair ffsinfo(8) on CURRENT
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jun 19 15:10:06 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Lukas Ertl
>Release:        FreeBSD 5.1-CURRENT i386
>Organization:
Vienna University Computer Center
>Environment:
System: FreeBSD leelou 5.1-CURRENT FreeBSD 5.1-CURRENT #0: Mon Jun 16 13:00:21 CEST 2003 le at leelou:/usr/obj/usr/src/sys/LEELOU i386


	
>Description:

ffsinfo(8) was yanked from the build when UFS2 was introduced. This patch
adds UFS2 support to ffsinfo and does a general code clean up, although
it surely needs some more work.

IMPORTANT: this patch requires the fix from bin/53515 applied to libufs
beforehand.

>How-To-Repeat:
	
>Fix:

	

--- ffsinfo.diff begins here ---
Index: src/sbin/Makefile
===================================================================
RCS file: /hugo/bsdcvs/src/sbin/Makefile,v
retrieving revision 1.122
diff -u -r1.122 Makefile
--- src/sbin/Makefile	17 Jun 2003 09:12:42 -0000	1.122
+++ src/sbin/Makefile	19 Jun 2003 21:55:25 -0000
@@ -19,6 +19,7 @@
 	dump \
 	dumpfs \
 	dumpon \
+	ffsinfo \
 	fsck \
 	fsck_ffs \
 	fsck_msdosfs \
Index: src/sbin/ffsinfo/Makefile
===================================================================
RCS file: /hugo/bsdcvs/src/sbin/ffsinfo/Makefile,v
retrieving revision 1.5
diff -u -r1.5 Makefile
--- src/sbin/ffsinfo/Makefile	11 Jun 2003 23:24:31 -0000	1.5
+++ src/sbin/ffsinfo/Makefile	19 Jun 2003 21:47:40 -0000
@@ -15,5 +15,6 @@
 
 WARNS?=	0
 CFLAGS+=-DFS_DEBUG -I${GROWFS}
+LDADD= -lufs
  
 .include <bsd.prog.mk>               
Index: src/sbin/ffsinfo/ffsinfo.8
===================================================================
RCS file: /hugo/bsdcvs/src/sbin/ffsinfo/ffsinfo.8,v
retrieving revision 1.12
diff -u -r1.12 ffsinfo.8
--- src/sbin/ffsinfo/ffsinfo.8	21 Aug 2002 18:10:14 -0000	1.12
+++ src/sbin/ffsinfo/ffsinfo.8	19 Jun 2003 21:52:26 -0000
@@ -45,7 +45,6 @@
 .Nd "dump all meta information of an existing ufs file system"
 .Sh SYNOPSIS
 .Nm
-.Op Fl L
 .Op Fl g Ar cylinder_group
 .Op Fl i Ar inode
 .Op Fl l Ar level
@@ -65,9 +64,6 @@
 .Pp
 The following options are available:
 .Bl -tag -width indent
-.It Fl L
-Specifying this option skips the tests of the disklabel.
-This is done automatically, if the specified filename to dump is a plain file.
 .It Fl g Ar cylinder_group
 This restricts the dump to information about this cylinder group only.
 Here
@@ -104,8 +100,6 @@
 fragment allocation bitmap
 .It Ar 0x040
 cluster maps and summary
-.It Ar 0x080
-rotational layout tables
 .It Ar 0x100
 inode information
 .It Ar 0x200
@@ -126,13 +120,7 @@
 .Pa /dev/vinum/testvol
 with all available information.
 .Sh BUGS
-Currently
-.Nm
-can only dump unmounted file systems.
-Do not try dumping a mounted file system, your system may panic and you will
-not be able to use the file system any longer.
-.Pp
-Also snapshots are handled like plain files.
+Snapshots are handled like plain files.
 They should get their own level to provide for independent control of the
 amount of what gets dumped.
 It probably also makes sense to some extend to dump the snapshot as a
Index: src/sbin/ffsinfo/ffsinfo.c
===================================================================
RCS file: /hugo/bsdcvs/src/sbin/ffsinfo/ffsinfo.c,v
retrieving revision 1.5
diff -u -r1.5 ffsinfo.c
--- src/sbin/ffsinfo/ffsinfo.c	21 Aug 2002 18:10:14 -0000	1.5
+++ src/sbin/ffsinfo/ffsinfo.c	19 Jun 2003 21:35:47 -0000
@@ -52,15 +52,22 @@
 #endif /* not lint */
 
 /* ********************************************************** INCLUDES ***** */
-#include <sys/param.h>
+#include <sys/types.h>
 #include <sys/disklabel.h>
+#include <sys/param.h>
+#include <sys/mount.h>
 #include <sys/stat.h>
 
-#include <stdio.h>
-#include <paths.h>
+#include <ufs/ufs/ufsmount.h>
+#include <ufs/ufs/dinode.h>
+#include <ufs/ffs/fs.h>
+
 #include <ctype.h>
 #include <err.h>
 #include <fcntl.h>
+#include <libufs.h>
+#include <paths.h>
+#include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
 #include <unistd.h>
@@ -72,20 +79,18 @@
 int	_dbg_lvl_ = (DL_INFO); /* DL_TRC */
 #endif /* FS_DEBUG */
 
-static union {
-	struct fs	fs;
-	char	pad[SBSIZE];
-} fsun1, fsun2;
-#define	sblock	fsun1.fs
-#define	osblock	fsun2.fs
+struct uufsd disk;
+
+#define sblock disk.d_fs
+#define acg    disk.d_cg
 
 static union {
-	struct cg	cg;
-	char	pad[MAXBSIZE];
-} cgun1;
-#define	acg	cgun1.cg
+	struct fs fs;
+	char pad[SBLOCKSIZE];
+} fsun;
+
+#define osblock fsun.fs
 
-static char	ablk[MAXBSIZE];
 static char	i1blk[MAXBSIZE];
 static char	i2blk[MAXBSIZE];
 static char	i3blk[MAXBSIZE];
@@ -93,107 +98,71 @@
 static struct csum	*fscs;
 
 /* ******************************************************** PROTOTYPES ***** */
-static void	rdfs(daddr_t, size_t, void *, int);
 static void	usage(void);
-static struct disklabel	*get_disklabel(int);
-static struct dinode	*ginode(ino_t, int);
-static void	dump_whole_inode(ino_t, int, int);
+static void	dump_whole_ufs1_inode(ino_t, int);
+static void	dump_whole_ufs2_inode(ino_t, int);
 
-/* ************************************************************** rdfs ***** */
-/*
- * Here we read some block(s) from disk.
- */
-void
-rdfs(daddr_t bno, size_t size, void *bf, int fsi)
-{
-	DBG_FUNC("rdfs")
-	ssize_t	n;
-
-	DBG_ENTER;
-
-	if (lseek(fsi, (off_t)bno * DEV_BSIZE, 0) < 0) {
-		err(33, "rdfs: seek error: %ld", (long)bno);
-	}
-	n = read(fsi, bf, size);
-	if (n != (ssize_t)size) {
-		err(34, "rdfs: read error: %ld", (long)bno);
-	}
-
-	DBG_LEAVE;
-	return;
-}
+#define DUMP_WHOLE_INODE(A,B) \
+	( disk.d_ufs == 1 \
+		? dump_whole_ufs1_inode((A),(B)) : dump_whole_ufs2_inode((A),(B)) )
 
 /* ************************************************************** main ***** */
 /*
  * ffsinfo(8) is a tool to dump all metadata of a file system. It helps to find
- * errors is the file system much easier. You can run ffsinfo before and  after
- * an  fsck(8),  and compare the two ascii dumps easy with diff, and  you  see
- * directly where the problem is. You can control how much detail you want  to
- * see  with some command line arguments. You can also easy check  the  status
- * of  a file system, like is there is enough space for growing  a  file system,
- * or  how  many active snapshots do we have. It provides much  more  detailed
- * information  then dumpfs. Snapshots, as they are very new, are  not  really
- * supported.  They  are just mentioned currently, but it is  planned  to  run
- * also over active snapshots, to even get that output.
+ * errors is the file system much easier.  You can run ffsinfo before and after
+ * an fsck(8), and compare the two ascii dumps easy with diff, and you see
+ * directly where the problem is.  You can control how much detail you want to
+ * see with some command line arguments.  You can also easy check the status
+ * of a file system, like is there is enough space for growing a file
+ * system, or how many active snapshots do we have.  It provides much more
+ * detailed information than dumpfs.  Snapshots, as they are very new, are not
+ * really supported.  They are just mentioned currently, but it is planned
+ * to run also over active snapshots, to even get that output.
  */
 int
 main(int argc, char **argv)
 {
 	DBG_FUNC("main")
-	char	*device, *special, *cp;
-	char	ch;
-	size_t	len;
+	char *device, *special, *out_file, ch, dbg_line[80];
+	int i, dbg_csc, cylno, cfg_cg, cfg_in, cfg_lv, cg_start, cg_stop;
+	size_t len;
 	struct stat	st;
-	struct disklabel	*lp;
-	struct partition	*pp;
-	int	fsi;
 	struct csum	*dbg_csp;
-	int	dbg_csc;
-	char	dbg_line[80];
-	int	cylno,i;
-	int	cfg_cg, cfg_in, cfg_lv;
-	int	cg_start, cg_stop;
-	ino_t	in;
-	char	*out_file;
-	int	Lflag=0;
+	ino_t in;
 
 	DBG_ENTER;
 
-	cfg_lv=0xff;
-	cfg_in=-2;
-	cfg_cg=-2;
-	out_file=strdup("/var/tmp/ffsinfo");
-	if(out_file == NULL) {
+	cfg_lv = 0xff;
+	cfg_in = -2;
+	cfg_cg = -2;
+	out_file = strdup("/var/tmp/ffsinfo");
+	if (out_file == NULL)
 		errx(1, "strdup failed");
-	}
 
-	while ((ch=getopt(argc, argv, "Lg:i:l:o:")) != -1) {
+	while ((ch = getopt(argc, argv, "Lg:i:l:o:")) != -1) {
 		switch(ch) {
-		case 'L':
-			Lflag=1;
-			break;
 		case 'g':
-			cfg_cg=atol(optarg);
-			if(cfg_cg < -1) {
+			cfg_cg = atol(optarg);
+			if (cfg_cg < -1) {
 				usage();
 			}
 			break;
 		case 'i':
-			cfg_in=atol(optarg);
-			if(cfg_in < 0) {
+			cfg_in = atol(optarg);
+			if (cfg_in < 0) {
 				usage();
 			}
 			break; 
 		case 'l':
-			cfg_lv=atol(optarg);
-			if(cfg_lv < 0x1||cfg_lv > 0x3ff) {
+			cfg_lv = atol(optarg);
+			if (cfg_lv < 0x1 || cfg_lv > 0x3ff) {
 				usage();
 			}
 			break;
 		case 'o':
 			free(out_file);
-			out_file=strdup(optarg);
-			if(out_file == NULL) {
+			out_file = strdup(optarg);
+			if (out_file == NULL) {
 				errx(1, "strdup failed");
 			}
 			break;
@@ -206,10 +175,10 @@
 	argc -= optind;
 	argv += optind;
 
-	if(argc != 1) {
+	if (argc != 1) 
 		usage();
-	}
-	device=*argv;
+
+	device = *argv;
 	
 	/*
 	 * Now we try to guess the (raw)device name.
@@ -225,9 +194,9 @@
 		 * FreeBSD now doesn't distinguish between raw and  block
 		 * devices any longer, but it should still work this way.
 		 */
-		len=strlen(device)+strlen(_PATH_DEV)+2+strlen("vinum/");
-		special=(char *)malloc(len);
-		if(special == NULL) {
+		len = strlen(device) + strlen(_PATH_DEV) + 2 + strlen("vinum/");
+		special = (char *)malloc(len);
+		if (special == NULL) {
 			errx(1, "malloc failed");
 		}
 		snprintf(special, len, "%sr%s", _PATH_DEV, device);
@@ -235,99 +204,47 @@
 			snprintf(special, len, "%s%s", _PATH_DEV, device);
 			if (stat(special, &st) == -1) {
 				snprintf(special, len, "%svinum/r%s",
-				    _PATH_DEV, device);
+					_PATH_DEV, device);
 				if (stat(special, &st) == -1) {
 					/*
 					 * For now this is the 'last resort'.
 					 */
 					snprintf(special, len, "%svinum/%s",
-					    _PATH_DEV, device);
+						_PATH_DEV, device);
 				}
 			}
 		}
 		device = special;
 	}
 
-	/*
-	 * Open our device for reading.
-	 */
-	fsi = open(device, O_RDONLY);
-	if (fsi < 0) {
-		err(1, "%s", device);
-	}
-
-	stat(device, &st);
-	
-	if(S_ISREG(st.st_mode)) { /* label check not supported for files */
-		Lflag=1;
-	}
-
-	if(!Lflag) {
-		/*
-		 * Try  to read a label and gess the slice if not  specified.
-		 * This code should guess the right thing and avaid to bother
-		 * the user user with the task of specifying the option -v on
-		 * vinum volumes.
-		 */
-		cp=device+strlen(device)-1;
-		lp = get_disklabel(fsi);
-		if(lp->d_type == DTYPE_VINUM) {
-			pp = &lp->d_partitions[0];
-		} else if (isdigit(*cp)) {
-			pp = &lp->d_partitions[2];
-		} else if (*cp>='a' && *cp<='h') {
-			pp = &lp->d_partitions[*cp - 'a'];
-		} else {
-			errx(1, "unknown device");
-		}
-	
-		/*
-		 * Check if that partition looks suited for dumping.
-		 */
-		if (pp->p_size < 1) {
-			errx(1, "partition is unavailable");
-		}
-		if (pp->p_fstype != FS_BSDFFS) {
-			errx(1, "partition not 4.2BSD");
-		}
-	}
-
-	/*
-	 * Read the current superblock.
-	 */
-	rdfs((daddr_t)(SBOFF/DEV_BSIZE), (size_t)SBSIZE, (void *)&sblock, fsi);
-	if (sblock.fs_magic != FS_MAGIC) {
-		errx(1, "superblock not recognized");
-	}
+	if (ufs_disk_fillout(&disk, device) == -1)
+		err(1, "ufs_disk_fillout(%s) failed: %s", device, disk.d_error);
 
 	DBG_OPEN(out_file); /* already here we need a superblock */
 
-	if(cfg_lv & 0x001) {
-		DBG_DUMP_FS(&sblock,
-		    "primary sblock");
-	}
+	if(cfg_lv & 0x001) 
+		DBG_DUMP_FS(&sblock, "primary sblock");
 
 	/*
 	 * Determine here what cylinder groups to dump.
 	 */
-	if(cfg_cg==-2) {
-		cg_start=0;
-		cg_stop=sblock.fs_ncg;
-	} else if (cfg_cg==-1) {
-		cg_start=sblock.fs_ncg-1;
-		cg_stop=sblock.fs_ncg;
-	} else if (cfg_cg<sblock.fs_ncg) {
-		cg_start=cfg_cg;
-		cg_stop=cfg_cg+1;
+	if(cfg_cg == -2) {
+		cg_start = 0;
+		cg_stop = sblock.fs_ncg;
+	} else if (cfg_cg == -1) {
+		cg_start = sblock.fs_ncg - 1;
+		cg_stop = sblock.fs_ncg;
+	} else if (cfg_cg < sblock.fs_ncg) {
+		cg_start = cfg_cg;
+		cg_stop = cfg_cg+1;
 	} else {
-		cg_start=sblock.fs_ncg;
-		cg_stop=sblock.fs_ncg;
+		cg_start = sblock.fs_ncg;
+		cg_stop = sblock.fs_ncg;
 	}
 
 	if (cfg_lv & 0x004) {
-		fscs = (struct csum *)calloc((size_t)1,
-		    (size_t)sblock.fs_cssize);
-		if(fscs == NULL) {
+		fscs = (struct csum *)calloc((size_t)1, (size_t)sblock.fs_cssize);
+		if (fscs == NULL) {
 			errx(1, "calloc failed");
 		}
 
@@ -335,106 +252,101 @@
 		 * Get the cylinder summary into the memory ...
 		 */
 		for (i = 0; i < sblock.fs_cssize; i += sblock.fs_bsize) {
-			rdfs(fsbtodb(&sblock, sblock.fs_csaddr +
-			    numfrags(&sblock, i)), (size_t)(sblock.fs_cssize-i<
-			    sblock.fs_bsize ? sblock.fs_cssize - i :
-			    sblock.fs_bsize), (void *)(((char *)fscs)+i), fsi);
+			if (bread(&disk, 
+				fsbtodb(&sblock, sblock.fs_csaddr + numfrags(&sblock, i)), 
+				(void *)(((char *)fscs)+i), 
+				(size_t)(sblock.fs_cssize-i < sblock.fs_bsize 
+					? sblock.fs_cssize - i 
+					: sblock.fs_bsize)) == -1) {
+				err(1, "bread: %s", disk.d_error);
+			}
 		}
 
-		dbg_csp=fscs;
+		dbg_csp = fscs;
 		/*
 		 * ... and dump it.
 		 */
-		for(dbg_csc=0; dbg_csc<sblock.fs_ncg; dbg_csc++) {
-			snprintf(dbg_line, sizeof(dbg_line),
-			    "%d. csum in fscs", dbg_csc);
-			DBG_DUMP_CSUM(&sblock,
-			    dbg_line,
-			    dbg_csp++);
+		for (dbg_csc=0; dbg_csc < sblock.fs_ncg; dbg_csc++) {
+			snprintf(dbg_line, sizeof(dbg_line), "%d. csum in fscs", dbg_csc);
+			DBG_DUMP_CSUM(&sblock, dbg_line, dbg_csp++);
 		}
 	}
 
 	/*
 	 * 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);
-		if(cfg_lv & 0x002) {
+		if (cfg_lv & 0x002) {
 			/*
 			 * ... dump the superblock copies ...
 			 */
-			rdfs(fsbtodb(&sblock, cgsblock(&sblock, cylno)),
-			    (size_t)SBSIZE, (void *)&osblock, fsi);
-			DBG_DUMP_FS(&osblock,
-			    dbg_line);
+			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.
 		 */
-		rdfs(fsbtodb(&sblock, cgtod(&sblock, cylno)),
-		    (size_t)sblock.fs_cgsize, (void *)&acg, fsi);
-		if(cfg_lv & 0x008) {
-			DBG_DUMP_CG(&sblock,
-			    dbg_line,
-			    &acg);
-		}
-		if(cfg_lv & 0x010) {
-			DBG_DUMP_INMAP(&sblock,
-			    dbg_line,
-			    &acg);
-		}
-		if(cfg_lv & 0x020) {
-			DBG_DUMP_FRMAP(&sblock,
-			    dbg_line,
-			    &acg);
-		}
-		if(cfg_lv & 0x040) {
-			DBG_DUMP_CLMAP(&sblock,
-			    dbg_line,
-			    &acg);
-			DBG_DUMP_CLSUM(&sblock,
-			    dbg_line,
-			    &acg);
+		if (bread(&disk, fsbtodb(&sblock, cgtod(&sblock, cylno)), 
+			(void *)&acg, (size_t)sblock.fs_cgsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		if (cfg_lv & 0x008) {
+			DBG_DUMP_CG(&sblock, dbg_line, &acg);
+		}
+		if (cfg_lv & 0x010) {
+			DBG_DUMP_INMAP(&sblock, dbg_line, &acg);
+		}
+		if (cfg_lv & 0x020) {
+			DBG_DUMP_FRMAP(&sblock, dbg_line, &acg);
+		}
+		if (cfg_lv & 0x040) {
+			DBG_DUMP_CLMAP(&sblock, dbg_line, &acg);
+			DBG_DUMP_CLSUM(&sblock, dbg_line, &acg);
 		}
+/*
 		if(cfg_lv & 0x080) {
 			DBG_DUMP_SPTBL(&sblock,
 			    dbg_line,
 			    &acg);
 		}
+*/
 	}
 	/*
 	 * Dump the requested inode(s).
 	 */
-	if(cfg_in != -2) {
-		dump_whole_inode((ino_t)cfg_in, fsi, cfg_lv);
+	if (cfg_in != -2) {
+		DUMP_WHOLE_INODE((ino_t)cfg_in, cfg_lv);
 	} else {
-		for(in=cg_start*sblock.fs_ipg; in<(ino_t)cg_stop*sblock.fs_ipg;
-		    in++) {
-			dump_whole_inode(in, fsi, cfg_lv);
+		for (in = cg_start * sblock.fs_ipg; 
+			 in < (ino_t) cg_stop * sblock.fs_ipg; 
+			 in++) {
+			DUMP_WHOLE_INODE(in, cfg_lv);
 		}
 	}
 
 	DBG_CLOSE;
 
-	close(fsi);
-
 	DBG_LEAVE;
 	return 0;
 }
 
-/* ************************************************** dump_whole_inode ***** */
+/* ********************************************** dump_whole_ufs1_inode ***** */
 /*
  * Here we dump a list of all blocks allocated by this inode. We follow
  * all indirect blocks.
  */
 void
-dump_whole_inode(ino_t inode, int fsi, int level)
+dump_whole_ufs1_inode(ino_t inode, int level)
 {
-	DBG_FUNC("dump_whole_inode")
-	struct dinode	*ino;
-	int	rb;
+	DBG_FUNC("dump_whole_ufs1_inode")
+	struct ufs1_dinode	*ino;
+	int	rb, mode;
 	unsigned int	ind2ctr, ind3ctr;
-	ufs_daddr_t	*ind2ptr, *ind3ptr;
+	ufs1_daddr_t	*ind2ptr, *ind3ptr;
 	char	comment[80];
 	
 	DBG_ENTER;
@@ -442,9 +354,10 @@
 	/*
 	 * Read the inode from disk/cache.
 	 */
-	ino=ginode(inode, fsi);
+	if (getino(&disk, (void **)&ino, inode, &mode) == -1)
+		err(1, "getino: %s", disk.d_error);
 
-	if(ino->di_nlink==0) {
+	if (ino->di_nlink == 0) {
 		DBG_LEAVE;
 		return;	/* inode not in use */
 	}
@@ -454,9 +367,7 @@
 	 */
 	snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
 	if (level & 0x100) {
-		DBG_DUMP_INO(&sblock,
-		    comment,
-		    ino);
+		DBG_DUMP_INO(&sblock, comment, ino);
 	}
 
 	if (!(level & 0x200)) {
@@ -467,92 +378,86 @@
 	/*
 	 * Ok, now prepare for dumping all direct and indirect pointers.
 	 */
-	rb=howmany(ino->di_size, sblock.fs_bsize)-NDADDR;
-	if(rb>0) {
+	rb = howmany(ino->di_size, sblock.fs_bsize) - NDADDR;
+	if (rb > 0) {
 		/*
 		 * Dump single indirect block.
 		 */
-		rdfs(fsbtodb(&sblock, ino->di_ib[0]), (size_t)sblock.fs_bsize,
-		    (void *)&i1blk, fsi);
-		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0",
-		    inode);
-		DBG_DUMP_IBLK(&sblock,
-		    comment,
-		    i1blk,
-		    (size_t)rb);
-		rb-=howmany(sblock.fs_bsize, sizeof(ufs_daddr_t));
+		if (bread(&disk, fsbtodb(&sblock, ino->di_ib[0]), (void *)&i1blk, 
+			(size_t)sblock.fs_bsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0", inode);
+		DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
+		rb -= howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t));
 	}
-	if(rb>0) {
+	if (rb > 0) {
 		/*
 		 * Dump double indirect blocks.
 		 */
-		rdfs(fsbtodb(&sblock, ino->di_ib[1]), (size_t)sblock.fs_bsize,
-		    (void *)&i2blk, fsi);
-		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1",
-		    inode);
-		DBG_DUMP_IBLK(&sblock,
-		    comment,
-		    i2blk,
-		    howmany(rb, howmany(sblock.fs_bsize, sizeof(ufs_daddr_t))));
-		for(ind2ctr=0; ((ind2ctr < howmany(sblock.fs_bsize,
-		    sizeof(ufs_daddr_t)))&&(rb>0)); ind2ctr++) {
-			ind2ptr=&((ufs_daddr_t *)(void *)&i2blk)[ind2ctr];
-
-			rdfs(fsbtodb(&sblock, *ind2ptr),
-			    (size_t)sblock.fs_bsize, (void *)&i1blk, fsi);
+		if (bread(&disk, fsbtodb(&sblock, ino->di_ib[1]), (void *)&i2blk, 
+			(size_t)sblock.fs_bsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1", inode);
+		DBG_DUMP_IBLK(&sblock, comment, i2blk,
+			howmany(rb, howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t))));
+		for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
+			sizeof(ufs1_daddr_t))) && (rb > 0)); ind2ctr++) {
+			ind2ptr = &((ufs1_daddr_t *)(void *)&i2blk)[ind2ctr];
+
+			if (bread(&disk, fsbtodb(&sblock, *ind2ptr), (void *)&i1blk, 
+				(size_t)sblock.fs_bsize) == -1) {
+				err(1, "bread: %s", disk.d_error);
+			}
 			snprintf(comment, sizeof(comment),
-			    "Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
-			DBG_DUMP_IBLK(&sblock,
-			    comment,
-			    i1blk,
-			    (size_t)rb);
-			rb-=howmany(sblock.fs_bsize, sizeof(ufs_daddr_t));
+				"Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
+			DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
+			rb -= howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t));
 		}
 	}
-	if(rb>0) {
+	if (rb > 0) {
 		/*
 		 * Dump triple indirect blocks.
 		 */
-		rdfs(fsbtodb(&sblock, ino->di_ib[2]), (size_t)sblock.fs_bsize,
-		    (void *)&i3blk, fsi);
-		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2",
-		    inode);
+		if (bread(&disk, fsbtodb(&sblock, ino->di_ib[2]), (void *)&i3blk, 
+			(size_t)sblock.fs_bsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2", inode);
 #define SQUARE(a) ((a)*(a))
 		DBG_DUMP_IBLK(&sblock,
-		    comment,
-		    i3blk,
-		    howmany(rb,
-		      SQUARE(howmany(sblock.fs_bsize, sizeof(ufs_daddr_t)))));
+			comment,
+			i3blk,
+			howmany(rb,
+				SQUARE(howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t)))));
 #undef SQUARE
-		for(ind3ctr=0; ((ind3ctr < howmany(sblock.fs_bsize,
-		    sizeof(ufs_daddr_t)))&&(rb>0)); ind3ctr ++) {
-			ind3ptr=&((ufs_daddr_t *)(void *)&i3blk)[ind3ctr];
-
-			rdfs(fsbtodb(&sblock, *ind3ptr),
-			    (size_t)sblock.fs_bsize, (void *)&i2blk, fsi);
+		for (ind3ctr = 0; ((ind3ctr < howmany(sblock.fs_bsize,
+			sizeof(ufs1_daddr_t))) && (rb > 0)); ind3ctr++) {
+			ind3ptr = &((ufs1_daddr_t *)(void *)&i3blk)[ind3ctr];
+
+			if (bread(&disk, fsbtodb(&sblock, *ind3ptr), (void *)&i2blk, 
+				(size_t)sblock.fs_bsize) == -1) {
+				err(1, "bread: %s", disk.d_error);
+			}
 			snprintf(comment, sizeof(comment),
-			    "Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
+				"Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
 			DBG_DUMP_IBLK(&sblock,
-			    comment,
-			    i2blk,
-			    howmany(rb,
-			      howmany(sblock.fs_bsize, sizeof(ufs_daddr_t))));
-			for(ind2ctr=0; ((ind2ctr < howmany(sblock.fs_bsize,
-			    sizeof(ufs_daddr_t)))&&(rb>0)); ind2ctr ++) {
-				ind2ptr=&((ufs_daddr_t *)(void *)&i2blk)
-				    [ind2ctr];
-				rdfs(fsbtodb(&sblock, *ind2ptr),
-				    (size_t)sblock.fs_bsize, (void *)&i1blk,
-				    fsi);
+				comment,
+				i2blk,
+				howmany(rb, howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t))));
+			for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
+				sizeof(ufs1_daddr_t))) && (rb>0)); ind2ctr++) {
+				ind2ptr = &((ufs1_daddr_t *)(void *)&i2blk)[ind2ctr];
+				if (bread(&disk, fsbtodb(&sblock, *ind2ptr), (void *)&i1blk, 
+					(size_t)sblock.fs_bsize) == -1) {
+					err(1, "bread: %s", disk.d_error);
+				}
 				snprintf(comment, sizeof(comment),
-				    "Inode 0x%08x: indirect 2->%d->%d", inode,
-				    ind3ctr, ind3ctr);
-				DBG_DUMP_IBLK(&sblock,
-				    comment,
-				    i1blk,
-				    (size_t)rb);
-				rb-=howmany(sblock.fs_bsize,
-				    sizeof(ufs_daddr_t));
+					"Inode 0x%08x: indirect 2->%d->%d", inode,
+					ind3ctr, ind3ctr);
+				DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
+				rb -= howmany(sblock.fs_bsize, sizeof(ufs1_daddr_t));
 			}
 		}
 	}
@@ -561,32 +466,141 @@
 	return;
 }
 
-/* ***************************************************** get_disklabel ***** */
+/* ********************************************** dump_whole_ufs2_inode ***** */
 /*
- * Read the disklabel from disk.
+ * Here we dump a list of all blocks allocated by this inode. We follow
+ * all indirect blocks.
  */
-struct disklabel *
-get_disklabel(int fd)
+void
+dump_whole_ufs2_inode(ino_t inode, int level)
 {
-	DBG_FUNC("get_disklabel")
-	static struct disklabel	*lab;
-
+	DBG_FUNC("dump_whole_ufs2_inode")
+	struct ufs2_dinode	*ino;
+	int	rb, mode;
+	unsigned int	ind2ctr, ind3ctr;
+	ufs2_daddr_t	*ind2ptr, *ind3ptr;
+	char	comment[80];
+	
 	DBG_ENTER;
 
-	lab=(struct disklabel *)malloc(sizeof(struct disklabel));
-	if (!lab) {
-		errx(1, "malloc failed");
-	}
-	if (ioctl(fd, DIOCGDINFO, (char *)lab) < 0) {
-		errx(1, "DIOCGDINFO failed");
-		exit(-1);
+	/*
+	 * Read the inode from disk/cache.
+	 */
+	if (getino(&disk, (void **)&ino, inode, &mode) == -1)
+		err(1, "getino: %s", disk.d_error);
+
+	if (ino->di_nlink == 0) {
+		DBG_LEAVE;
+		return;	/* inode not in use */
+	}
+
+	/*
+	 * Dump the main inode structure.
+	 */
+	snprintf(comment, sizeof(comment), "Inode 0x%08x", inode);
+	if (level & 0x100) {
+		DBG_DUMP_INO(&sblock, comment, ino);
+	}
+
+	if (!(level & 0x200)) {
+		DBG_LEAVE;
+		return;
+	}
+
+	/*
+	 * Ok, now prepare for dumping all direct and indirect pointers.
+	 */
+	rb = howmany(ino->di_size, sblock.fs_bsize) - NDADDR;
+	if (rb > 0) {
+		/*
+		 * Dump single indirect block.
+		 */
+		if (bread(&disk, fsbtodb(&sblock, ino->di_ib[0]), (void *)&i1blk, 
+			(size_t)sblock.fs_bsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 0", inode);
+		DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
+		rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
+	}
+	if (rb > 0) {
+		/*
+		 * Dump double indirect blocks.
+		 */
+		if (bread(&disk, fsbtodb(&sblock, ino->di_ib[1]), (void *)&i2blk, 
+			(size_t)sblock.fs_bsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 1", inode);
+		DBG_DUMP_IBLK(&sblock,
+			comment,
+			i2blk,
+			howmany(rb, howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t))));
+		for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
+			sizeof(ufs2_daddr_t))) && (rb>0)); ind2ctr++) {
+			ind2ptr = &((ufs2_daddr_t *)(void *)&i2blk)[ind2ctr];
+
+			if (bread(&disk, fsbtodb(&sblock, *ind2ptr), (void *)&i1blk, 
+				(size_t)sblock.fs_bsize) == -1) {
+				err(1, "bread: %s", disk.d_error);
+			}
+			snprintf(comment, sizeof(comment),
+				"Inode 0x%08x: indirect 1->%d", inode, ind2ctr);
+			DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
+			rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
+		}
+	}
+	if (rb > 0) {
+		/*
+		 * Dump triple indirect blocks.
+		 */
+		if (bread(&disk, fsbtodb(&sblock, ino->di_ib[2]), (void *)&i3blk, 
+			(size_t)sblock.fs_bsize) == -1) {
+			err(1, "bread: %s", disk.d_error);
+		}
+		snprintf(comment, sizeof(comment), "Inode 0x%08x: indirect 2", inode);
+#define SQUARE(a) ((a)*(a))
+		DBG_DUMP_IBLK(&sblock,
+			comment,
+			i3blk,
+			howmany(rb,
+				SQUARE(howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t)))));
+#undef SQUARE
+		for (ind3ctr = 0; ((ind3ctr < howmany(sblock.fs_bsize,
+			sizeof(ufs2_daddr_t))) && (rb > 0)); ind3ctr++) {
+			ind3ptr = &((ufs2_daddr_t *)(void *)&i3blk)[ind3ctr];
+
+			if (bread(&disk, fsbtodb(&sblock, *ind3ptr), (void *)&i2blk, 
+				(size_t)sblock.fs_bsize) == -1) {
+				err(1, "bread: %s", disk.d_error);
+			}
+			snprintf(comment, sizeof(comment),
+				"Inode 0x%08x: indirect 2->%d", inode, ind3ctr);
+			DBG_DUMP_IBLK(&sblock,
+				comment,
+				i2blk,
+				howmany(rb,
+					howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t))));
+			for (ind2ctr = 0; ((ind2ctr < howmany(sblock.fs_bsize,
+				sizeof(ufs2_daddr_t))) && (rb > 0)); ind2ctr++) {
+				ind2ptr = &((ufs2_daddr_t *)(void *)&i2blk) [ind2ctr];
+				if (bread(&disk, fsbtodb(&sblock, *ind2ptr), (void *)&i1blk, 
+					(size_t)sblock.fs_bsize) == -1) {
+					err(1, "bread: %s", disk.d_error);
+				}
+				snprintf(comment, sizeof(comment),
+					"Inode 0x%08x: indirect 2->%d->%d", inode,
+					ind3ctr, ind3ctr);
+				DBG_DUMP_IBLK(&sblock, comment, i1blk, (size_t)rb);
+				rb -= howmany(sblock.fs_bsize, sizeof(ufs2_daddr_t));
+			}
+		}
 	}
 
 	DBG_LEAVE;
-	return (lab);
+	return;
 }
 
-
 /* ************************************************************* usage ***** */
 /*
  * Dump a line of usage.
@@ -599,46 +613,10 @@
 	DBG_ENTER;
 
 	fprintf(stderr,
-	    "usage: ffsinfo [-L] [-g cylgrp] [-i inode] [-l level] "
-	    "[-o outfile]\n"
-	    "               special | file\n");
+		"usage: ffsinfo [-L] [-g cylgrp] [-i inode] [-l level] "
+		"[-o outfile]\n"
+		"               special | file\n");
 
 	DBG_LEAVE;
 	exit(1);
 }
-
-/* ************************************************************ ginode ***** */
-/*
- * This function provides access to an individual inode. We find out in which
- * block  the  requested inode is located, read it from disk if  needed,  and
- * return  the pointer into that block. We maintain a cache of one  block  to
- * not  read the same block again and again if we iterate linearly  over  all
- * inodes.
- */
-struct dinode *
-ginode(ino_t inumber, int fsi)
-{
-	DBG_FUNC("ginode")
-	ufs_daddr_t	iblk;
-	static ino_t	startinum=0;	/* first inode in cached block */
-	struct dinode	*pi;
-
-	DBG_ENTER;
-
-	pi=(struct dinode *)(void *)ablk;
-	if (startinum == 0 || inumber < startinum ||
-	    inumber >= startinum + INOPB(&sblock)) {
-		/*
-		 * The block needed is not cached, so we have to read it from
-		 * disk now.
-		 */
-		iblk = ino_to_fsba(&sblock, inumber);
-		rdfs(fsbtodb(&sblock, iblk), (size_t)sblock.fs_bsize,
-		    (void *)&ablk, fsi);
-		startinum = (inumber / INOPB(&sblock)) * INOPB(&sblock);
-	}
-
-	DBG_LEAVE;
-	return (&(pi[inumber % INOPB(&sblock)]));
-}
-
Index: src/sbin/growfs/debug.c
===================================================================
RCS file: /hugo/bsdcvs/src/sbin/growfs/debug.c,v
retrieving revision 1.7
diff -u -r1.7 debug.c
--- src/sbin/growfs/debug.c	25 Sep 2002 04:06:36 -0000	1.7
+++ src/sbin/growfs/debug.c	19 Jun 2003 20:44:20 -0000
@@ -145,168 +145,206 @@
 	fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)sb, comment);
 	indent++;
 
-	fprintf(dbg_log, "sblkno        ufs_daddr_t       0x%08x\n",
+	fprintf(dbg_log, "sblkno            int32_t          0x%08x\n",
 	    sb->fs_sblkno);
-	fprintf(dbg_log, "cblkno        ufs_daddr_t       0x%08x\n",
+	fprintf(dbg_log, "cblkno            int32_t          0x%08x\n",
 	    sb->fs_cblkno);
-	fprintf(dbg_log, "iblkno        ufs_daddr_t       0x%08x\n",
+	fprintf(dbg_log, "iblkno            int32_t          0x%08x\n",
 	    sb->fs_iblkno);
-	fprintf(dbg_log, "dblkno        ufs_daddr_t       0x%08x\n",
+	fprintf(dbg_log, "dblkno            int32_t          0x%08x\n",
 	    sb->fs_dblkno);
 
-	fprintf(dbg_log, "cgoffset      int32_t           0x%08x\n",
-	    sb->fs_cgoffset);
-	fprintf(dbg_log, "cgmask        int32_t           0x%08x\n",
-	    sb->fs_cgmask);
-	fprintf(dbg_log, "time          time_t            %10u\n",
-	    (unsigned int)sb->fs_time);
-	fprintf(dbg_log, "size          int32_t           0x%08x\n",
-	    sb->fs_size);
-	fprintf(dbg_log, "dsize         int32_t           0x%08x\n",
-	    sb->fs_dsize);
-	fprintf(dbg_log, "ncg           int32_t           0x%08x\n",
+	fprintf(dbg_log, "old_cgoffset      int32_t          0x%08x\n",
+	    sb->fs_old_cgoffset);
+	fprintf(dbg_log, "old_cgmask        int32_t          0x%08x\n",
+	    sb->fs_old_cgmask);
+	fprintf(dbg_log, "old_time          int32_t          %10u\n",
+	    (unsigned int)sb->fs_old_time);
+	fprintf(dbg_log, "old_size          int32_t          0x%08x\n",
+	    sb->fs_old_size);
+	fprintf(dbg_log, "old_dsize         int32_t          0x%08x\n",
+	    sb->fs_old_dsize);
+	fprintf(dbg_log, "ncg               int32_t          0x%08x\n",
 	    sb->fs_ncg);
-	fprintf(dbg_log, "bsize         int32_t           0x%08x\n",
+	fprintf(dbg_log, "bsize             int32_t          0x%08x\n",
 	    sb->fs_bsize);
-	fprintf(dbg_log, "fsize         int32_t           0x%08x\n",
+	fprintf(dbg_log, "fsize             int32_t          0x%08x\n",
 	    sb->fs_fsize);
-	fprintf(dbg_log, "frag          int32_t           0x%08x\n",
+	fprintf(dbg_log, "frag              int32_t          0x%08x\n",
 	    sb->fs_frag);
 
-	fprintf(dbg_log, "minfree       int32_t           0x%08x\n",
+	fprintf(dbg_log, "minfree           int32_t          0x%08x\n",
 	    sb->fs_minfree);
-	fprintf(dbg_log, "rotdelay      int32_t           0x%08x\n",
-	    sb->fs_rotdelay);
-	fprintf(dbg_log, "rps           int32_t           0x%08x\n",
-	    sb->fs_rps);
+	fprintf(dbg_log, "old_rotdelay      int32_t          0x%08x\n",
+	    sb->fs_old_rotdelay);
+	fprintf(dbg_log, "old_rps           int32_t          0x%08x\n",
+	    sb->fs_old_rps);
 
-	fprintf(dbg_log, "bmask         int32_t           0x%08x\n",
+	fprintf(dbg_log, "bmask             int32_t          0x%08x\n",
 	    sb->fs_bmask);
-	fprintf(dbg_log, "fmask         int32_t           0x%08x\n",
+	fprintf(dbg_log, "fmask             int32_t          0x%08x\n",
 	    sb->fs_fmask);
-	fprintf(dbg_log, "bshift        int32_t           0x%08x\n",
+	fprintf(dbg_log, "bshift            int32_t          0x%08x\n",
 	    sb->fs_bshift);
-	fprintf(dbg_log, "fshift        int32_t           0x%08x\n",
+	fprintf(dbg_log, "fshift            int32_t          0x%08x\n",
 	    sb->fs_fshift);
 
-	fprintf(dbg_log, "maxcontig     int32_t           0x%08x\n",
+	fprintf(dbg_log, "maxcontig         int32_t          0x%08x\n",
 	    sb->fs_maxcontig);
-	fprintf(dbg_log, "maxbpg        int32_t           0x%08x\n",
+	fprintf(dbg_log, "maxbpg            int32_t          0x%08x\n",
 	    sb->fs_maxbpg);
 
-	fprintf(dbg_log, "fragshift     int32_t           0x%08x\n",
+	fprintf(dbg_log, "fragshift         int32_t          0x%08x\n",
 	    sb->fs_fragshift);
-	fprintf(dbg_log, "fsbtodb       int32_t           0x%08x\n",
+	fprintf(dbg_log, "fsbtodb           int32_t          0x%08x\n",
 	    sb->fs_fsbtodb);
-	fprintf(dbg_log, "sbsize        int32_t           0x%08x\n",
+	fprintf(dbg_log, "sbsize            int32_t          0x%08x\n",
 	    sb->fs_sbsize);
-	fprintf(dbg_log, "csmask        int32_t           0x%08x\n",
-	    sb->fs_csmask);
-	fprintf(dbg_log, "csshift       int32_t           0x%08x\n",
-	    sb->fs_csshift);
-	fprintf(dbg_log, "nindir        int32_t           0x%08x\n",
+	fprintf(dbg_log, "spare1            int32_t[2]       0x%08x 0x%08x\n",
+	    sb->fs_spare1[0], sb->fs_spare1[1]);
+	fprintf(dbg_log, "nindir            int32_t          0x%08x\n",
 	    sb->fs_nindir);
-	fprintf(dbg_log, "inopb         int32_t           0x%08x\n",
+	fprintf(dbg_log, "inopb             int32_t          0x%08x\n",
 	    sb->fs_inopb);
-	fprintf(dbg_log, "nspf          int32_t           0x%08x\n",
-	    sb->fs_nspf);
+	fprintf(dbg_log, "old_nspf          int32_t          0x%08x\n",
+	    sb->fs_old_nspf);
 
-	fprintf(dbg_log, "optim         int32_t           0x%08x\n",
+	fprintf(dbg_log, "optim             int32_t          0x%08x\n",
 	    sb->fs_optim);
 
-	fprintf(dbg_log, "npsect        int32_t           0x%08x\n",
-	    sb->fs_npsect);
-	fprintf(dbg_log, "interleave    int32_t           0x%08x\n",
-	    sb->fs_interleave);
-	fprintf(dbg_log, "trackskew     int32_t           0x%08x\n",
-	    sb->fs_trackskew);
+	fprintf(dbg_log, "old_npsect        int32_t          0x%08x\n",
+	    sb->fs_old_npsect);
+	fprintf(dbg_log, "old_interleave    int32_t          0x%08x\n",
+	    sb->fs_old_interleave);
+	fprintf(dbg_log, "old_trackskew     int32_t          0x%08x\n",
+	    sb->fs_old_trackskew);
 
-	fprintf(dbg_log, "id            int32_t[2]        %08x %08x\n",
+	fprintf(dbg_log, "id                int32_t[2]       0x%08x 0x%08x\n",
 	    sb->fs_id[0], sb->fs_id[1]);
 
-	fprintf(dbg_log, "csaddr        ufs_daddr_t       0x%08x\n",
-	    sb->fs_csaddr);
-	fprintf(dbg_log, "cssize        int32_t           0x%08x\n",
+	fprintf(dbg_log, "old_csaddr        int32_t          0x%08x\n",
+	    sb->fs_old_csaddr);
+	fprintf(dbg_log, "cssize            int32_t          0x%08x\n",
 	    sb->fs_cssize);
-	fprintf(dbg_log, "cgsize        int32_t           0x%08x\n",
+	fprintf(dbg_log, "cgsize            int32_t          0x%08x\n",
 	    sb->fs_cgsize);
 
-	fprintf(dbg_log, "ntrak         int32_t           0x%08x\n",
-	    sb->fs_ntrak);
-	fprintf(dbg_log, "nsect         int32_t           0x%08x\n",
-	    sb->fs_nsect);
-	fprintf(dbg_log, "spc           int32_t           0x%08x\n",
-	    sb->fs_spc);
-
-	fprintf(dbg_log, "ncyl          int32_t           0x%08x\n",
-	    sb->fs_ncyl);
-
-	fprintf(dbg_log, "cpg           int32_t           0x%08x\n",
-	    sb->fs_cpg);
-	fprintf(dbg_log, "ipg           int32_t           0x%08x\n",
+	fprintf(dbg_log, "spare2            int32_t          0x%08x\n",
+	    sb->fs_spare2);
+	fprintf(dbg_log, "old_nsect         int32_t          0x%08x\n",
+	    sb->fs_old_nsect);
+	fprintf(dbg_log, "old_spc           int32_t          0x%08x\n",
+	    sb->fs_old_spc);
+
+	fprintf(dbg_log, "old_ncyl          int32_t          0x%08x\n",
+	    sb->fs_old_ncyl);
+
+	fprintf(dbg_log, "old_cpg           int32_t          0x%08x\n",
+	    sb->fs_old_cpg);
+	fprintf(dbg_log, "ipg               int32_t          0x%08x\n",
 	    sb->fs_ipg);
-	fprintf(dbg_log, "fpg           int32_t           0x%08x\n",
+	fprintf(dbg_log, "fpg               int32_t          0x%08x\n",
 	    sb->fs_fpg);
 
-	dbg_dump_csum("internal cstotal", &sb->fs_cstotal);
+	dbg_dump_csum("internal old_cstotal", &sb->fs_old_cstotal);
 
-	fprintf(dbg_log, "fmod          int8_t            0x%02x\n",
+	fprintf(dbg_log, "fmod              int8_t           0x%02x\n",
 	    sb->fs_fmod);
-	fprintf(dbg_log, "clean         int8_t            0x%02x\n",
+	fprintf(dbg_log, "clean             int8_t           0x%02x\n",
 	    sb->fs_clean);
-	fprintf(dbg_log, "ronly         int8_t            0x%02x\n",
+	fprintf(dbg_log, "ronly             int8_t           0x%02x\n",
 	    sb->fs_ronly);
-	fprintf(dbg_log, "flags         int8_t            0x%02x\n",
-	    sb->fs_flags);
-	fprintf(dbg_log, "fsmnt         u_char[MAXMNTLEN] \"%s\"\n",
+	fprintf(dbg_log, "old_flags         int8_t           0x%02x\n",
+	    sb->fs_old_flags);
+	fprintf(dbg_log, "fsmnt             u_char[MAXMNTLEN] \"%s\"\n",
 	    sb->fs_fsmnt);
+	fprintf(dbg_log, "volname           u_char[MAXVOLLEN] \"%s\"\n",
+	    sb->fs_volname);
+	fprintf(dbg_log, "swuid             u_int64_t        0x%08x%08x\n",
+	    ((unsigned int *)&(sb->fs_swuid))[1],
+		((unsigned int *)&(sb->fs_swuid))[0]);
 
-	fprintf(dbg_log, "cgrotor       int32_t           0x%08x\n",
+	fprintf(dbg_log, "pad               int32_t          0x%08x\n",
+	    sb->fs_pad);
+
+	fprintf(dbg_log, "cgrotor           int32_t          0x%08x\n",
 	    sb->fs_cgrotor);
 /*
  * struct csum[MAXCSBUFS] - is only maintained in memory
  */
 /*	fprintf(dbg_log, " int32_t\n", sb->*fs_maxcluster);*/
-	fprintf(dbg_log, "cpc           int32_t           0x%08x\n",
-	    sb->fs_cpc);
+	fprintf(dbg_log, "old_cpc           int32_t          0x%08x\n",
+	    sb->fs_old_cpc);
 /*
  * int16_t fs_opostbl[16][8] - is dumped when used in dbg_dump_sptbl
  */
+	fprintf(dbg_log, "maxbsize          int32_t          0x%08x\n",
+	    sb->fs_maxbsize);
+	fprintf(dbg_log, "sblockloc         int64_t          0x%08x%08x\n",
+		((unsigned int *)&(sb->fs_sblockloc))[1],
+		((unsigned int *)&(sb->fs_sblockloc))[0]);
+
+	dbg_dump_csum_total("internal cstotal", &sb->fs_cstotal);
+
+	fprintf(dbg_log, "time              ufs_time_t       %10u\n",
+	    (unsigned int)sb->fs_time);
+
+	fprintf(dbg_log, "size              int64_t          0x%08x%08x\n",
+		((unsigned int *)&(sb->fs_size))[1],
+		((unsigned int *)&(sb->fs_size))[0]);
+	fprintf(dbg_log, "dsize             int64_t          0x%08x%08x\n",
+		((unsigned int *)&(sb->fs_dsize))[1],
+		((unsigned int *)&(sb->fs_dsize))[0]);
+	fprintf(dbg_log, "csaddr            ufs2_daddr_t     0x%08x%08x\n",
+		((unsigned int *)&(sb->fs_csaddr))[1],
+		((unsigned int *)&(sb->fs_csaddr))[0]);
+	fprintf(dbg_log, "pendingblocks     int64_t          0x%08x%08x\n",
+		((unsigned int *)&(sb->fs_pendingblocks))[1],
+		((unsigned int *)&(sb->fs_pendingblocks))[0]);
+	fprintf(dbg_log, "pendinginodes     int32_t          0x%08x\n",
+	    sb->fs_pendinginodes);
+
 #ifdef FSMAXSNAP
 	for(j=0; j<FSMAXSNAP; j++) {
-		fprintf(dbg_log, "snapinum      int32_t[%2d]       0x%08x\n",
+		fprintf(dbg_log, "snapinum          int32_t[%2d]      0x%08x\n",
 		    j, sb->fs_snapinum[j]);
 		if(!sb->fs_snapinum[j]) { /* list is dense */
 			break;
 		}
 	}
 #endif /* FSMAXSNAP */
-	fprintf(dbg_log, "contigsumsize int32_t           0x%08x\n",
+	fprintf(dbg_log, "avgfilesize       int32_t          0x%08x\n",
+	    sb->fs_avgfilesize);
+	fprintf(dbg_log, "avgfpdir          int32_t          0x%08x\n",
+	    sb->fs_avgfpdir);
+	fprintf(dbg_log, "save_cgsize       int32_t          0x%08x\n",
+	    sb->fs_save_cgsize);
+	fprintf(dbg_log, "flags             int32_t          0x%08x\n",
+	    sb->fs_flags);
+	fprintf(dbg_log, "contigsumsize     int32_t          0x%08x\n",
 	    sb->fs_contigsumsize);
-	fprintf(dbg_log, "maxsymlinklen int32_t           0x%08x\n",
+	fprintf(dbg_log, "maxsymlinklen     int32_t          0x%08x\n",
 	    sb->fs_maxsymlinklen);
-	fprintf(dbg_log, "inodefmt      int32_t           0x%08x\n",
-	    sb->fs_inodefmt);
-	fprintf(dbg_log, "maxfilesize   u_int64_t         0x%08x%08x\n",
+	fprintf(dbg_log, "old_inodefmt      int32_t          0x%08x\n",
+	    sb->fs_old_inodefmt);
+	fprintf(dbg_log, "maxfilesize       u_int64_t        0x%08x%08x\n",
 	    ((unsigned int *)&(sb->fs_maxfilesize))[1],
 	    ((unsigned int *)&(sb->fs_maxfilesize))[0]);
-	fprintf(dbg_log, "qbmask        int64_t           0x%08x%08x\n",
+	fprintf(dbg_log, "qbmask            int64_t          0x%08x%08x\n",
 	    ((unsigned int *)&(sb->fs_qbmask))[1],
 	    ((unsigned int *)&(sb->fs_qbmask))[0]);
-	fprintf(dbg_log, "qfmask        int64_t           0x%08x%08x\n",
+	fprintf(dbg_log, "qfmask            int64_t          0x%08x%08x\n",
 	    ((unsigned int *)&(sb->fs_qfmask))[1],
 	    ((unsigned int *)&(sb->fs_qfmask))[0]);
-	fprintf(dbg_log, "state         int32_t           0x%08x\n",
+	fprintf(dbg_log, "state             int32_t          0x%08x\n",
 	    sb->fs_state);
-	fprintf(dbg_log, "postblformat  int32_t           0x%08x\n",
-	    sb->fs_postblformat);
-	fprintf(dbg_log, "nrpos         int32_t           0x%08x\n",
-	    sb->fs_nrpos);
-	fprintf(dbg_log, "postbloff     int32_t           0x%08x\n",
-	    sb->fs_postbloff);
-	fprintf(dbg_log, "rotbloff      int32_t           0x%08x\n",
-	    sb->fs_rotbloff);
-	fprintf(dbg_log, "magic         int32_t           0x%08x\n",
+	fprintf(dbg_log, "old_postblformat  int32_t          0x%08x\n",
+	    sb->fs_old_postblformat);
+	fprintf(dbg_log, "old_nrpos         int32_t          0x%08x\n",
+	    sb->fs_old_nrpos);
+	fprintf(dbg_log, "spare5            int32_t[2]       0x%08x 0x%08x\n",
+	    sb->fs_spare5[0], sb->fs_spare5[1]);
+	fprintf(dbg_log, "magic             int32_t          0x%08x\n",
 	    sb->fs_magic);
 
 	indent--;
@@ -333,11 +371,10 @@
 	indent++;
 
 	fprintf(dbg_log, "magic         int32_t    0x%08x\n", cgr->cg_magic);
-	fprintf(dbg_log, "time          time_t     %10u\n", (unsigned int)
-	    cgr->cg_time);
+	fprintf(dbg_log, "old_time      int32_t    0x%08x\n", cgr->cg_old_time);
 	fprintf(dbg_log, "cgx           int32_t    0x%08x\n", cgr->cg_cgx);
-	fprintf(dbg_log, "ncyl          int16_t    0x%04x\n", cgr->cg_ncyl);
-	fprintf(dbg_log, "niblk         int16_t    0x%04x\n", cgr->cg_niblk);
+	fprintf(dbg_log, "old_ncyl      int16_t    0x%04x\n", cgr->cg_old_ncyl);
+	fprintf(dbg_log, "old_niblk     int16_t    0x%04x\n", cgr->cg_old_niblk);
 	fprintf(dbg_log, "ndblk         int32_t    0x%08x\n", cgr->cg_ndblk);
 	dbg_dump_csum("internal cs", &cgr->cg_cs);
 	fprintf(dbg_log, "rotor         int32_t    0x%08x\n", cgr->cg_rotor);
@@ -347,18 +384,22 @@
 		fprintf(dbg_log, "frsum         int32_t[%d] 0x%08x\n", j,
 		    cgr->cg_frsum[j]);
 	}
-	fprintf(dbg_log, "btotoff       int32_t    0x%08x\n", cgr->cg_btotoff);
-	fprintf(dbg_log, "boff          int32_t    0x%08x\n", cgr->cg_boff);
+	fprintf(dbg_log, "old_btotoff   int32_t    0x%08x\n", cgr->cg_old_btotoff);
+	fprintf(dbg_log, "old_boff      int32_t    0x%08x\n", cgr->cg_old_boff);
 	fprintf(dbg_log, "iusedoff      int32_t    0x%08x\n", cgr->cg_iusedoff);
 	fprintf(dbg_log, "freeoff       int32_t    0x%08x\n", cgr->cg_freeoff);
 	fprintf(dbg_log, "nextfreeoff   int32_t    0x%08x\n",
 	    cgr->cg_nextfreeoff);
 	fprintf(dbg_log, "clustersumoff int32_t    0x%08x\n",
 	    cgr->cg_clustersumoff);
-	fprintf(dbg_log, "clusterof     int32_t    0x%08x\n",
+	fprintf(dbg_log, "clusteroff    int32_t    0x%08x\n",
 	    cgr->cg_clusteroff);
 	fprintf(dbg_log, "nclusterblks  int32_t    0x%08x\n",
 	    cgr->cg_nclusterblks);
+	fprintf(dbg_log, "niblk         int32_t    0x%08x\n", cgr->cg_niblk);
+	fprintf(dbg_log, "initediblk    int32_t    0x%08x\n", cgr->cg_initediblk);
+	fprintf(dbg_log, "time          ufs_time_t %10u\n", 
+		(unsigned int)cgr->cg_initediblk);
 
 	indent--;
 	fprintf(dbg_log, "===== END CYLINDER GROUP =====\n");
@@ -393,6 +434,43 @@
 	return;
 }
 
+/* ************************************************ dbg_dump_csum_total ***** */
+/*
+ * Dump a cylinder summary.
+ */
+void
+dbg_dump_csum_total(const char *comment, struct csum_total *cs)
+{
+
+	if(!dbg_log) {
+		return;
+	}
+
+	fprintf(dbg_log, "===== START CYLINDER SUMMARY TOTAL =====\n");
+	fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cs, comment);
+	indent++;
+
+	fprintf(dbg_log, "ndir        int64_t 0x%08x%08x\n", 
+		((unsigned int *)&(cs->cs_ndir))[1],
+		((unsigned int *)&(cs->cs_ndir))[0]);
+	fprintf(dbg_log, "nbfree      int64_t 0x%08x%08x\n", 
+		((unsigned int *)&(cs->cs_nbfree))[1],
+		((unsigned int *)&(cs->cs_nbfree))[0]);
+	fprintf(dbg_log, "nifree      int64_t 0x%08x%08x\n", 
+		((unsigned int *)&(cs->cs_nifree))[1],
+		((unsigned int *)&(cs->cs_nifree))[0]);
+	fprintf(dbg_log, "nffree      int64_t 0x%08x%08x\n", 
+		((unsigned int *)&(cs->cs_nffree))[1],
+		((unsigned int *)&(cs->cs_nffree))[0]);
+	fprintf(dbg_log, "numclusters int64_t 0x%08x%08x\n", 
+		((unsigned int *)&(cs->cs_numclusters))[1],
+		((unsigned int *)&(cs->cs_numclusters))[0]);
+
+	indent--;
+	fprintf(dbg_log, "===== END CYLINDER SUMMARY TOTAL =====\n");
+
+	return;
+}
 /* **************************************************** dbg_dump_inmap ***** */
 /*
  * Dump the inode allocation map in one cylinder group.
@@ -457,7 +535,10 @@
 	indent++;
 
 	cp=(unsigned char *)cg_blksfree(cgr);
-	e=howmany((sb->fs_cpg * sb->fs_spc / NSPF(sb)), CHAR_BIT);
+	if (sb->fs_old_nspf)
+		e=howmany((sb->fs_old_cpg * sb->fs_old_spc / sb->fs_old_nspf), CHAR_BIT);
+	else
+		e = 0;
 	for(j=0; j<e; j+=32) {
 		fprintf(dbg_log, "%08x: ", j);
 		for(k=0; k<32; k+=8) {
@@ -501,7 +582,10 @@
 	indent++;
 
 	cp=(unsigned char *)cg_clustersfree(cgr);
-	e=howmany(sb->fs_cpg * sb->fs_spc / NSPB(sb), CHAR_BIT);
+	if (sb->fs_old_nspf)
+		e=howmany(sb->fs_old_cpg * sb->fs_old_spc / (sb->fs_old_nspf << sb->fs_fragshift), CHAR_BIT);
+	else
+		e = 0;
 	for(j=0; j<e; j+=32) {
 		fprintf(dbg_log, "%08x: ", j);
 		for(k=0; k<32; k+=8) {
@@ -555,49 +639,12 @@
 	return;
 }
 
-/* **************************************************** dbg_dump_sptbl ***** */
-/*
- * Dump the block summary, and the rotational layout table.
- */
-void
-dbg_dump_sptbl(struct fs *sb, const char *comment, struct cg *cgr)
-{
-	int j,k;
-	int *ip;
-
-	if(!dbg_log) {
-		return;
-	}
-
-	fprintf(dbg_log,
-	    "===== START BLOCK SUMMARY AND POSITION TABLE =====\n");
-	fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)cgr, comment);
-	indent++;
-
-	ip=(int *)cg_blktot(cgr);
-	for(j=0; j<sb->fs_cpg; j++) {
-		fprintf(dbg_log, "%2d: %5d = ", j, *ip++);
-		for(k=0; k<sb->fs_nrpos; k++) {
-			fprintf(dbg_log, "%4d", cg_blks(sb, cgr, j)[k]);
-			if(k<sb->fs_nrpos-1) {
-				fprintf(dbg_log, " + ");
-			}
-		}
-		fprintf(dbg_log, "\n");
-	}
-
-	indent--;
-	fprintf(dbg_log, "===== END BLOCK SUMMARY AND POSITION TABLE =====\n");
-
-	return;
-}
-
-/* ****************************************************** dbg_dump_ino ***** */
+/* ************************************************** dbg_dump_ufs1_ino ***** */
 /*
- * Dump an inode structure.
+ * Dump a UFS1 inode structure.
  */
 void
-dbg_dump_ino(struct fs *sb, const char *comment, struct dinode *ino)
+dbg_dump_ufs1_ino(struct fs *sb, const char *comment, struct ufs1_dinode *ino)
 {
 	int ictr;
 	int remaining_blocks;
@@ -606,7 +653,7 @@
 		return;
 	}
 
-	fprintf(dbg_log, "===== START INODE DUMP =====\n");
+	fprintf(dbg_log, "===== START UFS1 INODE DUMP =====\n");
 	fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
 	indent++;
 
@@ -636,13 +683,13 @@
 		fprintf(dbg_log, "ib         ufs_daddr_t[0] 0x%08x\n",
 		    ino->di_ib[0]);
 	}
-	remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs_daddr_t));
+	remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs1_daddr_t));
 	if(remaining_blocks>0) {
 		fprintf(dbg_log, "ib         ufs_daddr_t[1] 0x%08x\n",
 		    ino->di_ib[1]);
 	}
 #define SQUARE(a) ((a)*(a))
-	remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs_daddr_t)));
+	remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs1_daddr_t)));
 #undef SQUARE
 	if(remaining_blocks>0) {
 		fprintf(dbg_log, "ib         ufs_daddr_t[2] 0x%08x\n",
@@ -656,7 +703,80 @@
 	fprintf(dbg_log, "gid        u_int32_t      0x%08x\n", ino->di_gid);
 
 	indent--;
-	fprintf(dbg_log, "===== END INODE DUMP =====\n");
+	fprintf(dbg_log, "===== END UFS1 INODE DUMP =====\n");
+
+	return;
+}
+
+/* ************************************************** dbg_dump_ufs2_ino ***** */
+/*
+ * Dump a UFS2 inode structure.
+ */
+void
+dbg_dump_ufs2_ino(struct fs *sb, const char *comment, struct ufs2_dinode *ino)
+{
+	int ictr;
+	int remaining_blocks;
+	
+	if(!dbg_log) {
+		return;
+	}
+
+	fprintf(dbg_log, "===== START UFS2 INODE DUMP =====\n");
+	fprintf(dbg_log, "# %d@%lx: %s\n", indent, (unsigned long)ino, comment);
+	indent++;
+
+	fprintf(dbg_log, "mode       u_int16_t      0%o\n", ino->di_mode);
+	fprintf(dbg_log, "nlink      int16_t        0x%04x\n", ino->di_nlink);
+	fprintf(dbg_log, "uid        u_int32_t      0x%08x\n", ino->di_uid);
+	fprintf(dbg_log, "gid        u_int32_t      0x%08x\n", ino->di_gid);
+	fprintf(dbg_log, "blksize    u_int32_t      0x%08x\n", ino->di_blksize);
+	fprintf(dbg_log, "size       u_int64_t      0x%08x%08x\n", 
+	    ((unsigned int *)&(ino->di_size))[1],
+	    ((unsigned int *)&(ino->di_size))[0]);
+	fprintf(dbg_log, "blocks     u_int64_t      0x%08x%08x\n", 
+		((unsigned int *)&(ino->di_blocks))[1],
+		((unsigned int *)&(ino->di_blocks))[0]);
+	fprintf(dbg_log, "atime      ufs_time_t     %10u\n", ino->di_atime);
+	fprintf(dbg_log, "mtime      ufs_time_t     %10u\n", ino->di_mtime);
+	fprintf(dbg_log, "ctime      ufs_time_t     %10u\n", ino->di_ctime);
+	fprintf(dbg_log, "birthtime  ufs_time_t     %10u\n", ino->di_birthtime);
+	fprintf(dbg_log, "mtimensec  int32_t        0x%08x\n", ino->di_mtimensec);
+	fprintf(dbg_log, "atimensec  int32_t        0x%08x\n", ino->di_atimensec);
+	fprintf(dbg_log, "ctimensec  int32_t        0x%08x\n", ino->di_ctimensec);
+	fprintf(dbg_log, "birthnsec  int32_t        0x%08x\n", ino->di_birthnsec);
+	fprintf(dbg_log, "gen        int32_t        0x%08x\n", ino->di_gen);
+	fprintf(dbg_log, "kernflags  u_int32_t      0x%08x\n", ino->di_kernflags);
+	fprintf(dbg_log, "flags      u_int32_t      0x%08x\n", ino->di_flags);
+	fprintf(dbg_log, "extsize    int32_t        0x%08x\n", ino->di_extsize);
+
+	/* XXX: What do we do with di_extb[NXADDR]? */
+
+	remaining_blocks=howmany(ino->di_size, sb->fs_bsize); /* XXX ts - +1? */
+	for(ictr=0; ictr < MIN(NDADDR, remaining_blocks); ictr++) {
+		fprintf(dbg_log, "db         ufs2_daddr_t[%x] 0x%16x\n", ictr,
+		    ino->di_db[ictr]);
+	}
+	remaining_blocks-=NDADDR;
+	if(remaining_blocks>0) {
+		fprintf(dbg_log, "ib         ufs2_daddr_t[0] 0x%16x\n",
+		    ino->di_ib[0]);
+	}
+	remaining_blocks-=howmany(sb->fs_bsize, sizeof(ufs2_daddr_t));
+	if(remaining_blocks>0) {
+		fprintf(dbg_log, "ib         ufs2_daddr_t[1] 0x%16x\n",
+		    ino->di_ib[1]);
+	}
+#define SQUARE(a) ((a)*(a))
+	remaining_blocks-=SQUARE(howmany(sb->fs_bsize, sizeof(ufs2_daddr_t)));
+#undef SQUARE
+	if(remaining_blocks>0) {
+		fprintf(dbg_log, "ib         ufs2_daddr_t[2] 0x%16x\n",
+		    ino->di_ib[2]);
+	}
+
+	indent--;
+	fprintf(dbg_log, "===== END UFS2 INODE DUMP =====\n");
 
 	return;
 }
@@ -670,7 +790,7 @@
 dbg_dump_iblk(struct fs *sb, const char *comment, char *block, size_t length)
 {
 	unsigned int *mem;
-	int i, j;
+	int i, j, size;
 
 	if(!dbg_log) {
 		return;
@@ -681,8 +801,13 @@
 	    comment);
 	indent++;
 
+	if (sb->fs_magic == FS_UFS1_MAGIC)
+		size = sizeof(ufs1_daddr_t);
+	else
+		size = sizeof(ufs2_daddr_t);
+
 	mem=(unsigned int *)block;
-	for (i=0; (size_t)i<MIN(howmany(sb->fs_bsize, sizeof(ufs_daddr_t)),
+	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++) {
Index: src/sbin/growfs/debug.h
===================================================================
RCS file: /hugo/bsdcvs/src/sbin/growfs/debug.h,v
retrieving revision 1.1
diff -u -r1.1 debug.h
--- src/sbin/growfs/debug.h	9 Dec 2000 15:27:35 -0000	1.1
+++ src/sbin/growfs/debug.h	19 Jun 2003 18:39:34 -0000
@@ -54,7 +54,9 @@
 void dbg_dump_fs(struct fs *, const char *);
 void dbg_dump_cg(const char *, struct cg *);
 void dbg_dump_csum(const char *, struct csum *);
-void dbg_dump_ino(struct fs *, const char *, struct dinode *);
+void dbg_dump_csum_total(const char *, struct csum_total *);
+void dbg_dump_ufs1_ino(struct fs *, const char *, struct ufs1_dinode *);
+void dbg_dump_ufs2_ino(struct fs *, const char *, struct ufs2_dinode *);
 void dbg_dump_iblk(struct fs *, const char *, char *, size_t);
 void dbg_dump_inmap(struct fs *, const char *, struct cg *);
 void dbg_dump_frmap(struct fs *, const char *, struct cg *);
@@ -68,13 +70,14 @@
 #define DBG_DUMP_FS(F,C) dbg_dump_fs((F),(C))
 #define DBG_DUMP_CG(F,C,M) dbg_dump_cg((C),(M))
 #define DBG_DUMP_CSUM(F,C,M) dbg_dump_csum((C),(M))
-#define DBG_DUMP_INO(F,C,M) dbg_dump_ino((F),(C),(M))
+#define DBG_DUMP_INO(F,C,M) (F)->fs_magic == FS_UFS1_MAGIC \
+	? dbg_dump_ufs1_ino((F),(C),(M)) \
+	: dbg_dump_ufs2_ino((F),(C),(M))
 #define DBG_DUMP_IBLK(F,C,M,L) dbg_dump_iblk((F),(C),(M),(L))
 #define DBG_DUMP_INMAP(F,C,M) dbg_dump_inmap((F),(C),(M))
 #define DBG_DUMP_FRMAP(F,C,M) dbg_dump_frmap((F),(C),(M))
 #define DBG_DUMP_CLMAP(F,C,M) dbg_dump_clmap((F),(C),(M))
 #define DBG_DUMP_CLSUM(F,C,M) dbg_dump_clsum((F),(C),(M))
-#define DBG_DUMP_SPTBL(F,C,M) dbg_dump_sptbl((F),(C),(M))
 
 #define DL_TRC	0x01
 #define DL_INFO	0x02
@@ -123,7 +126,6 @@
 #define DBG_DUMP_FRMAP(F,C,M)
 #define DBG_DUMP_CLMAP(F,C,M)
 #define DBG_DUMP_CLSUM(F,C,M)
-#define DBG_DUMP_SPTBL(F,C,M)
 #define DBG_FUNC(N)
 #define DBG_ENTER
 #define DBG_TRC
--- ffsinfo.diff ends here ---


>Release-Note:
>Audit-Trail:
>Unformatted:


More information about the freebsd-bugs mailing list