CVS commit: src/usr.sbin/dumpfs

2023-11-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Nov  6 12:18:59 UTC 2023

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Print the inode numbers of persistent snapshots.

PR kern/57675 "persistent file system snapshots aren't obvious"


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.68 src/usr.sbin/dumpfs/dumpfs.c:1.69
--- src/usr.sbin/dumpfs/dumpfs.c:1.68	Sat Jan  7 19:41:30 2023
+++ src/usr.sbin/dumpfs/dumpfs.c	Mon Nov  6 12:18:59 2023
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.68 2023/01/07 19:41:30 chs Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.69 2023/11/06 12:18:59 hannken Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)dumpfs.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.68 2023/01/07 19:41:30 chs Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.69 2023/11/06 12:18:59 hannken Exp $");
 #endif
 #endif /* not lint */
 
@@ -410,6 +410,11 @@ print_superblock(struct fs *fs, uint16_t
 	fs->fs_journallocs[0], fs->fs_journallocs[1]);
 	printf("\tloc2 %" PRIu64 "\tloc3 %" PRIu64 "\n",
 	fs->fs_journallocs[2], fs->fs_journallocs[3]);
+	printf("snapshot inodes");
+	for (int s = 0; s < FSMAXSNAP; s++) {
+		printf(" %u", fs->fs_snapinum[s]);
+	}
+	printf("\n");
 	printf("usrquota %" PRIu64 "\tgrpquota %" PRIu64 "\n",
 		fs->fs_quotafile[USRQUOTA], fs->fs_quotafile[GRPQUOTA]);
 	printf("flags\t");



CVS commit: src/usr.sbin/dumpfs

2023-11-06 Thread Juergen Hannken-Illjes
Module Name:src
Committed By:   hannken
Date:   Mon Nov  6 12:18:59 UTC 2023

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Print the inode numbers of persistent snapshots.

PR kern/57675 "persistent file system snapshots aren't obvious"


To generate a diff of this commit:
cvs rdiff -u -r1.68 -r1.69 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2022-12-19 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Dec 19 18:51:42 UTC 2022

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8 dumpfs.c

Log Message:
dumpfs: remove confusing output for UFS2

remove the mention of "fslevel 5" because no such thing exists.
the whole "fs level" concept really only applies to UFS1, so don't print
the line with the level number and details for UFS2 file systems at all.
try to clarify this in the manpage as well.
prompted by PR 57082.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/dumpfs/dumpfs.8
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.8
diff -u src/usr.sbin/dumpfs/dumpfs.8:1.20 src/usr.sbin/dumpfs/dumpfs.8:1.21
--- src/usr.sbin/dumpfs/dumpfs.8:1.20	Sat Feb 27 10:49:42 2010
+++ src/usr.sbin/dumpfs/dumpfs.8	Mon Dec 19 18:51:42 2022
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dumpfs.8,v 1.20 2010/02/27 10:49:42 wiz Exp $
+.\"	$NetBSD: dumpfs.8,v 1.21 2022/12/19 18:51:42 chs Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -80,7 +80,7 @@ defaults to
 .Nm
 is useful mostly for finding out certain file system
 information such as the file system block size, minimum
-free space percentage, and the file system level that
+free space percentage, and (for FFSv1) the file system level that
 can be upgraded with the
 .Fl c
 option of

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.66 src/usr.sbin/dumpfs/dumpfs.c:1.67
--- src/usr.sbin/dumpfs/dumpfs.c:1.66	Thu Nov 17 06:40:40 2022
+++ src/usr.sbin/dumpfs/dumpfs.c	Mon Dec 19 18:51:42 2022
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.66 2022/11/17 06:40:40 chs Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.67 2022/12/19 18:51:42 chs Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@ __COPYRIGHT("@(#) Copyright (c) 1983, 19
 #if 0
 static char sccsid[] = "@(#)dumpfs.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.66 2022/11/17 06:40:40 chs Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.67 2022/12/19 18:51:42 chs Exp $");
 #endif
 #endif /* not lint */
 
@@ -314,7 +314,7 @@ print_superblock(struct fs *fs, uint16_t
 	fs->fs_magic, ctime(&t));
 
 	if (is_ufs2)
-		i = 5;
+		i = -1;
 	else {
 		i = 0;
 		if (fs->fs_old_postblformat != FS_42POSTBLFMT) {
@@ -338,10 +338,11 @@ print_superblock(struct fs *fs, uint16_t
 	fs->fs_id[0] || fs->fs_id[1])
 		printf("superblock location\t%jd\tid\t[ %x %x ]\n",
 		(intmax_t)fs->fs_sblockloc, fs->fs_id[0], fs->fs_id[1]);
-	printf("cylgrp\t%s\tinodes\t%s\tsblock\t%s\tfslevel %d\n",
-	i < 1 ? "static" : "dynamic",
-	i < 2 ? "4.2/4.3BSD" : i < 5 ? "4.4BSD" : "FFSv2",
-	i < 4 ? "FFSv1" : "FFSv2", i);
+	if (!is_ufs2)
+		printf("cylgrp\t%s\tinodes\t%s\tsblock\t%s\tfslevel %d\n",
+		i < 1 ? "static" : "dynamic",
+		i < 2 ? "4.2/4.3BSD" : i < 5 ? "4.4BSD" : "FFSv2",
+		i < 4 ? "FFSv1" : "FFSv2", i);
 	printf("nbfree\t%lld\tndir\t%lld\tnifree\t%lld\tnffree\t%lld\n",
 	(long long)fs->fs_cstotal.cs_nbfree,
 	(long long)fs->fs_cstotal.cs_ndir,



CVS commit: src/usr.sbin/dumpfs

2022-12-19 Thread Chuck Silvers
Module Name:src
Committed By:   chs
Date:   Mon Dec 19 18:51:42 UTC 2022

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8 dumpfs.c

Log Message:
dumpfs: remove confusing output for UFS2

remove the mention of "fslevel 5" because no such thing exists.
the whole "fs level" concept really only applies to UFS1, so don't print
the line with the level number and details for UFS2 file systems at all.
try to clarify this in the manpage as well.
prompted by PR 57082.


To generate a diff of this commit:
cvs rdiff -u -r1.20 -r1.21 src/usr.sbin/dumpfs/dumpfs.8
cvs rdiff -u -r1.66 -r1.67 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 12:07:40 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Adjust for change in kernel that stores physical block numbers
in superblock that point to the journal.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 12:07:40 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Adjust for change in kernel that stores physical block numbers
in superblock that point to the journal.


To generate a diff of this commit:
cvs rdiff -u -r1.56 -r1.57 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.56 src/usr.sbin/dumpfs/dumpfs.c:1.57
--- src/usr.sbin/dumpfs/dumpfs.c:1.56	Sat Feb 27 10:49:58 2010
+++ src/usr.sbin/dumpfs/dumpfs.c	Sat Feb 27 12:07:40 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.56 2010/02/27 10:49:58 wiz Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.57 2010/02/27 12:07:40 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)dumpfs.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.56 2010/02/27 10:49:58 wiz Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.57 2010/02/27 12:07:40 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -750,12 +750,12 @@
 		count  = afs.fs_journallocs[1];
 		blklen = afs.fs_journallocs[2];
 
-		for (bno=0; bno= 2 * blklen &&
+			boff = bno * blklen;
+			if (bno * blklen >= 2 * blklen &&
 			  ((head >= tail && (boff < tail || boff >= head)) ||
 			  (head < tail && (boff >= head && boff < tail
 continue;
@@ -763,7 +763,7 @@
 			printf("journal block %lu offset %lld\n",
 (unsigned long)bno, (long long) boff);
 
-			if (lseek(fd, (off_t)(off*DEV_BSIZE) + boff, SEEK_SET)
+			if (lseek(fd, (off_t)(off*blklen) + boff, SEEK_SET)
 			== (off_t)-1)
 return (1);
 			if (read(fd, &jbuf, blklen) != (ssize_t)blklen) {
@@ -791,8 +791,10 @@
 break;
 			}
 
-			if (blklen)
-skip = (skip + blklen - 1) / blklen * blklen;
+			if (blklen == 0)
+break;
+
+			skip = (skip + blklen - 1) / blklen * blklen;
 			if (skip == 0)
 break;
 



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Feb 27 10:49:58 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Sort options.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Feb 27 10:49:58 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Sort options.


To generate a diff of this commit:
cvs rdiff -u -r1.55 -r1.56 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.55 src/usr.sbin/dumpfs/dumpfs.c:1.56
--- src/usr.sbin/dumpfs/dumpfs.c:1.55	Sat Feb 27 09:53:33 2010
+++ src/usr.sbin/dumpfs/dumpfs.c	Sat Feb 27 10:49:58 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.55 2010/02/27 09:53:33 mlelstv Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.56 2010/02/27 10:49:58 wiz Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)dumpfs.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.55 2010/02/27 09:53:33 mlelstv Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.56 2010/02/27 10:49:58 wiz Exp $");
 #endif
 #endif /* not lint */
 
@@ -130,14 +130,14 @@
 {
 	int ch, eval;
 
-	while ((ch = getopt(argc, argv, "acimsjvF")) != -1)
+	while ((ch = getopt(argc, argv, "acijmsvF")) != -1)
 		switch(ch) {
 		case 'a':	/* alternate superblocks */
 		case 'c':	/* cylinder group info */
 		case 'i':	/* actual inodes */
+		case 'j':	/* journal */
 		case 'm':	/* cylinder group summary */
 		case 's':	/* superblock */
-		case 'j':	/* journal */
 		case 'v':	/* more verbose */
 			opt_flags |= OPT_FLAG(ch);
 			break;
@@ -903,7 +903,7 @@
 usage(void)
 {
 
-	(void)fprintf(stderr, "usage: dumpfs [-acFimsjv] filesys | device [...]\n");
+	(void)fprintf(stderr, "usage: dumpfs [-acFijmsv] filesys | device [...]\n");
 	exit(1);
 }
 



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Feb 27 10:49:42 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8

Log Message:
Sort options. Add -j to SYNOPSIS. Bump date for -j.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/dumpfs/dumpfs.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.8
diff -u src/usr.sbin/dumpfs/dumpfs.8:1.19 src/usr.sbin/dumpfs/dumpfs.8:1.20
--- src/usr.sbin/dumpfs/dumpfs.8:1.19	Sat Feb 27 09:05:59 2010
+++ src/usr.sbin/dumpfs/dumpfs.8	Sat Feb 27 10:49:42 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dumpfs.8,v 1.19 2010/02/27 09:05:59 mlelstv Exp $
+.\"	$NetBSD: dumpfs.8,v 1.20 2010/02/27 10:49:42 wiz Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -29,7 +29,7 @@
 .\"
 .\" @(#)dumpfs.8	8.1 (Berkeley) 6/5/93
 .\"
-.Dd January 3, 2004
+.Dd February 27, 2010
 .Dt DUMPFS 8
 .Os
 .Sh NAME
@@ -37,7 +37,7 @@
 .Nd dump file system information
 .Sh SYNOPSIS
 .Nm
-.Op Fl acFimsv
+.Op Fl acFijmsv
 .Ar filesys No \&| Ar device
 .Op Ar ...
 .Sh DESCRIPTION
@@ -54,12 +54,12 @@
 Dump a file system image from a file, not a special device.
 .It Fl i
 Print details of each allocated inode.
+.It Fl j
+Print details of the WAPBL journal.
 .It Fl m
 Print details of the cylinder group summary.
 .It Fl s
 Print details of the superblock.
-.It Fl j
-Print details of the WAPBL journal.
 .It Fl v
 Be even more verbose.
 .El
@@ -68,10 +68,10 @@
 .Fl a ,
 .Fl c ,
 .Fl i ,
+.Fl j ,
 .Fl m ,
-.Fl s ,
 or
-.Fl j
+.Fl s
 are given, then
 .Nm
 defaults to



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Thomas Klausner
Module Name:src
Committed By:   wiz
Date:   Sat Feb 27 10:49:42 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8

Log Message:
Sort options. Add -j to SYNOPSIS. Bump date for -j.


To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/usr.sbin/dumpfs/dumpfs.8

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:53:33 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Print both commit headers, even for disks with larger block sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:53:33 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.c

Log Message:
Print both commit headers, even for disks with larger block sizes.


To generate a diff of this commit:
cvs rdiff -u -r1.54 -r1.55 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.54 src/usr.sbin/dumpfs/dumpfs.c:1.55
--- src/usr.sbin/dumpfs/dumpfs.c:1.54	Sat Feb 27 09:05:59 2010
+++ src/usr.sbin/dumpfs/dumpfs.c	Sat Feb 27 09:53:33 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.54 2010/02/27 09:05:59 mlelstv Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.55 2010/02/27 09:53:33 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)dumpfs.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.54 2010/02/27 09:05:59 mlelstv Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.55 2010/02/27 09:53:33 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
@@ -755,7 +755,7 @@
 			skip = blklen;
 
 			boff = bno * DEV_BSIZE;
-			if (bno >= 2 &&
+			if (bno * DEV_BSIZE >= 2 * blklen &&
 			  ((head >= tail && (boff < tail || boff >= head)) ||
 			  (head < tail && (boff >= head && boff < tail
 continue;



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:05:59 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8 dumpfs.c

Log Message:
Add support to print the WAPBL journal.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/dumpfs/dumpfs.8
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.



CVS commit: src/usr.sbin/dumpfs

2010-02-27 Thread Michael van Elst
Module Name:src
Committed By:   mlelstv
Date:   Sat Feb 27 09:05:59 UTC 2010

Modified Files:
src/usr.sbin/dumpfs: dumpfs.8 dumpfs.c

Log Message:
Add support to print the WAPBL journal.


To generate a diff of this commit:
cvs rdiff -u -r1.18 -r1.19 src/usr.sbin/dumpfs/dumpfs.8
cvs rdiff -u -r1.53 -r1.54 src/usr.sbin/dumpfs/dumpfs.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/dumpfs/dumpfs.8
diff -u src/usr.sbin/dumpfs/dumpfs.8:1.18 src/usr.sbin/dumpfs/dumpfs.8:1.19
--- src/usr.sbin/dumpfs/dumpfs.8:1.18	Sat Jan  3 21:05:21 2004
+++ src/usr.sbin/dumpfs/dumpfs.8	Sat Feb 27 09:05:59 2010
@@ -1,4 +1,4 @@
-.\"	$NetBSD: dumpfs.8,v 1.18 2004/01/03 21:05:21 wiz Exp $
+.\"	$NetBSD: dumpfs.8,v 1.19 2010/02/27 09:05:59 mlelstv Exp $
 .\"
 .\" Copyright (c) 1983, 1991, 1993
 .\"	The Regents of the University of California.  All rights reserved.
@@ -58,6 +58,8 @@
 Print details of the cylinder group summary.
 .It Fl s
 Print details of the superblock.
+.It Fl j
+Print details of the WAPBL journal.
 .It Fl v
 Be even more verbose.
 .El
@@ -67,8 +69,9 @@
 .Fl c ,
 .Fl i ,
 .Fl m ,
+.Fl s ,
 or
-.Fl s
+.Fl j
 are given, then
 .Nm
 defaults to
@@ -107,3 +110,7 @@
 .Fl s
 options, and the inode dump were added for
 .Nx 2.0 .
+The
+.Fl j ,
+option was added for
+.Nx 6.0 .

Index: src/usr.sbin/dumpfs/dumpfs.c
diff -u src/usr.sbin/dumpfs/dumpfs.c:1.53 src/usr.sbin/dumpfs/dumpfs.c:1.54
--- src/usr.sbin/dumpfs/dumpfs.c:1.53	Thu May  7 06:40:38 2009
+++ src/usr.sbin/dumpfs/dumpfs.c	Sat Feb 27 09:05:59 2010
@@ -1,4 +1,4 @@
-/*	$NetBSD: dumpfs.c,v 1.53 2009/05/07 06:40:38 lukem Exp $	*/
+/*	$NetBSD: dumpfs.c,v 1.54 2010/02/27 09:05:59 mlelstv Exp $	*/
 
 /*
  * Copyright (c) 1983, 1992, 1993
@@ -39,15 +39,19 @@
 #if 0
 static char sccsid[] = "@(#)dumpfs.c	8.5 (Berkeley) 4/29/95";
 #else
-__RCSID("$NetBSD: dumpfs.c,v 1.53 2009/05/07 06:40:38 lukem Exp $");
+__RCSID("$NetBSD: dumpfs.c,v 1.54 2010/02/27 09:05:59 mlelstv Exp $");
 #endif
 #endif /* not lint */
 
 #include 
 #include 
 
+#include 
+#include 
+
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -76,6 +80,14 @@
 } cgun;
 #define	acg	cgun.cg
 
+union {
+	struct wapbl_wc_header wh;
+	struct wapbl_wc_null wn;
+	char pad[MAXBSIZE];
+} jbuf;
+#define awh 	jbuf.wh
+#define awn 	jbuf.wn
+
 #define OPT_FLAG(ch)	(1 << ((ch) & 31))
 #define ISOPT(opt)	(opt_flags & (opt))
 #define opt_alt_super	OPT_FLAG('a')
@@ -83,9 +95,10 @@
 #define opt_cg_summary	OPT_FLAG('m')
 #define opt_cg_info	OPT_FLAG('c')
 #define opt_inodes	OPT_FLAG('i')
+#define opt_journal	OPT_FLAG('j')
 #define opt_verbose	OPT_FLAG('v')
 #define DFLT_CHECK (opt_alt_super | opt_cg_info | opt_inodes | \
-opt_cg_summary | opt_superblock)
+opt_cg_summary | opt_superblock | opt_journal )
 #define DFLT_OPTS	(opt_superblock | opt_cg_summary | opt_cg_info | opt_verbose)
 
 long	dev_bsize = 512;
@@ -100,6 +113,9 @@
 int	print_cginfo(const char *, int);
 int	print_inodes(const char *, int, int, int);
 int	print_alt_super(const char *, int);
+int	print_journal(const char *, int);
+void	print_journal_header(const char *);
+off_t	print_journal_entries(const char *, size_t);
 int	dumpcg(const char *, int, int);
 int	main(int, char **);
 int	openpartition(const char *, int, char *, size_t);
@@ -114,13 +130,14 @@
 {
 	int ch, eval;
 
-	while ((ch = getopt(argc, argv, "acimsvF")) != -1)
+	while ((ch = getopt(argc, argv, "acimsjvF")) != -1)
 		switch(ch) {
 		case 'a':	/* alternate superblocks */
 		case 'c':	/* cylinder group info */
 		case 'i':	/* actual inodes */
 		case 'm':	/* cylinder group summary */
 		case 's':	/* superblock */
+		case 'j':	/* journal */
 		case 'v':	/* more verbose */
 			opt_flags |= OPT_FLAG(ch);
 			break;
@@ -215,6 +232,8 @@
 		rval = print_cgsum(name, fd);
 	if (rval == 0 && ISOPT(opt_alt_super))
 		rval = print_alt_super(name, fd);
+	if (rval == 0 && ISOPT(opt_journal))
+		rval = print_journal(name, fd);
 	if (rval == 0 && ISOPT(opt_cg_info))
 		rval = print_cginfo(name, fd);
 	else if (rval == 0 && ISOPT(opt_inodes))
@@ -687,7 +706,6 @@
 		i->di_gen, i->di_uid, i->di_gid);
 }
 
-
 void
 pbits(int offset, void *vp, int max)
 {
@@ -710,11 +728,182 @@
 	printf("\n");
 }
 
+int
+print_journal(const char *name, int fd)
+{
+	daddr_t off;
+	size_t count, blklen, bno, skip;
+	off_t boff, head, tail, len;
+	uint32_t generation;
+
+	if (afs.fs_journal_version != UFS_WAPBL_VERSION)
+		return 0;
+
+	generation = 0;
+	head = tail = 0;
+
+	switch (afs.fs_journal_location) {
+	case UFS_WAPBL_JOURNALLOC_END_PARTITION:
+	case UFS_WAPBL_JOURNALLOC_IN_FILESYSTEM:
+
+		off= afs.fs_journallocs[0];
+		count  = afs.fs_journallocs[1];
+		blklen = afs.fs_journallocs[2];
+
+		for (bno=0; bno= 2 &&
+			  ((head >= tail && (boff < tail || boff >= head)) ||
+			  (head < tail && (boff >= head && boff < tail
+continue;
+
+			printf("journal block %lu offset %lld\n",
+(unsign