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/dumpfs/dumpfs.c | |
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/dumpfs/dumpfs.c')
-rw-r--r-- | sbin/dumpfs/dumpfs.c | 25 |
1 files changed, 19 insertions, 6 deletions
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); |