diff options
author | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-05-31 08:32:32 +0000 |
---|---|---|
committer | Theo de Raadt <deraadt@cvs.openbsd.org> | 1997-05-31 08:32:32 +0000 |
commit | d182c568403712b5413cbc6757a83964c8c269af (patch) | |
tree | c8c2f7f5735dddbd31cea937dd90c2b3c740798f /sbin | |
parent | 300183e104bf22eb2796e67bca3767e48498813e (diff) |
lukem: Determine filesystem level (ref: fsck_ffs(8) -c ...) and display it.
Code was derivied from observing how fsck_ffs `upgrades' to a given
level, and has been tested on recent NetBSD filesystems (reports as "3"),
SunOS ("1"), and ULTRIX ("0"). I haven't found a filesystem of level
"2" to test, but the code should detect it. Fixes [bin/1353]
Diffstat (limited to 'sbin')
-rw-r--r-- | sbin/dumpfs/dumpfs.8 | 31 | ||||
-rw-r--r-- | sbin/dumpfs/dumpfs.c | 25 |
2 files changed, 39 insertions, 17 deletions
diff --git a/sbin/dumpfs/dumpfs.8 b/sbin/dumpfs/dumpfs.8 index 78a275c9c64..8b856feb73e 100644 --- a/sbin/dumpfs/dumpfs.8 +++ b/sbin/dumpfs/dumpfs.8 @@ -1,5 +1,5 @@ -.\" $OpenBSD: dumpfs.8,v 1.2 1996/06/23 14:30:15 deraadt Exp $ -.\" $NetBSD: dumpfs.8,v 1.6 1995/03/18 14:55:14 cgd Exp $ +.\" $OpenBSD: dumpfs.8,v 1.3 1997/05/31 08:32:29 deraadt Exp $ +.\" $NetBSD: dumpfs.8,v 1.8 1997/05/07 23:19:03 lukem Exp $ .\" .\" Copyright (c) 1983, 1991, 1993 .\" The Regents of the University of California. All rights reserved. @@ -41,23 +41,32 @@ .Nm dumpfs .Nd dump file system information .Sh SYNOPSIS -.Nm dumpfs +.Nm .Op Ar filesys No \&| Ar device .Sh DESCRIPTION -.Nm Dumpfs +.Nm prints out the super block and cylinder group information for the file system or special device specified. -The listing is very long and detailed. This -command is useful mostly for finding out certain file system -information such as the file system block size and minimum -free space percentage. +The listing is very long and detailed. +.Pp +.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 +can be upgraded with the +.Fl c +option of +.Xr fsck_ffs 8 . +All of this information can be found within the first twenty +lines of the output. .Sh SEE ALSO -.Xr fs 5 , .Xr disktab 5 , +.Xr fs 5 , .Xr disklabel 8 , -.Xr tunefs 8 , +.Xr fsck 8 , +.Xr fsck_ffs 8 , .Xr newfs 8 , -.Xr fsck 8 +.Xr tunefs 8 .Sh HISTORY The .Nm diff --git a/sbin/dumpfs/dumpfs.c b/sbin/dumpfs/dumpfs.c index 2ffb2d1a9be..9e91771c54b 100644 --- a/sbin/dumpfs/dumpfs.c +++ b/sbin/dumpfs/dumpfs.c @@ -1,5 +1,5 @@ -/* $OpenBSD: dumpfs.c,v 1.5 1997/02/11 07:01:27 millert Exp $ */ -/* $NetBSD: dumpfs.c,v 1.11 1996/01/09 21:23:36 pk Exp $ */ +/* $OpenBSD: dumpfs.c,v 1.6 1997/05/31 08:32:31 deraadt Exp $ */ +/* $NetBSD: dumpfs.c,v 1.12 1997/04/26 05:41:33 lukem Exp $ */ /* * Copyright (c) 1983, 1992, 1993 @@ -44,7 +44,7 @@ static char copyright[] = #if 0 static char sccsid[] = "@(#)dumpfs.c 8.2 (Berkeley) 2/2/94"; #else -static char rcsid[] = "$OpenBSD: dumpfs.c,v 1.5 1997/02/11 07:01:27 millert Exp $"; +static char rcsid[] = "$OpenBSD: dumpfs.c,v 1.6 1997/05/31 08:32:31 deraadt Exp $"; #endif #endif /* not lint */ @@ -135,9 +135,22 @@ dumpfs(name) dev_bsize = afs.fs_fsize / fsbtodb(&afs, 1); printf("magic\t%x\ttime\t%s", afs.fs_magic, ctime(&afs.fs_time)); - printf("cylgrp\t%s\tinodes\t%s\n", - afs.fs_postblformat == FS_42POSTBLFMT ? "static" : "dynamic", - afs.fs_inodefmt < FS_44INODEFMT ? "4.2/4.3BSD" : "4.4BSD"); + i = 0; + if (afs.fs_postblformat != FS_42POSTBLFMT) { + i++; + if (afs.fs_inodefmt >= FS_44INODEFMT) { + int max, siz; + + i++; + max = afs.fs_maxcontig; + size = afs.fs_contigsumsize; + if ((max < 2 && size == 0) + || (max > 1 && size >= MIN(max, FS_MAXCONTIG))) + i++; + } + } + printf("cylgrp\t%s\tinodes\t%s\tfslevel %d\n", + i < 1 ? "static" : "dynamic", i < 2 ? "4.2/4.3BSD" : "4.4BSD", i); printf("nbfree\t%d\tndir\t%d\tnifree\t%d\tnffree\t%d\n", afs.fs_cstotal.cs_nbfree, afs.fs_cstotal.cs_ndir, afs.fs_cstotal.cs_nifree, afs.fs_cstotal.cs_nffree); |