diff options
author | bde <bde@FreeBSD.org> | 1997-12-20 22:24:32 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1997-12-20 22:24:32 +0000 |
commit | 4c386d1f18ad7e07eb2c30568022d58849ceeeae (patch) | |
tree | 61767f7808f5038eb9f5d5dbd65f02edccf45eae /sbin/fsck | |
parent | 65928cad92e38495a5aea3120094f81600cfedad (diff) | |
download | FreeBSD-src-4c386d1f18ad7e07eb2c30568022d58849ceeeae.zip FreeBSD-src-4c386d1f18ad7e07eb2c30568022d58849ceeeae.tar.gz |
Fixed style bugs in the printing of statistics after preening. Use
floating point better in the percentage calculation there to avoid
overflow when there are more than about 20 million fragments. Start
using floating point in the other percentage calculation to avoid
overflow when there are more than about 2 million fragments.
Fixed printf format strings.
Converted sccsid to rcsid.
Diffstat (limited to 'sbin/fsck')
-rw-r--r-- | sbin/fsck/main.c | 31 |
1 files changed, 16 insertions, 15 deletions
diff --git a/sbin/fsck/main.c b/sbin/fsck/main.c index c4ee7cb..dcb7006 100644 --- a/sbin/fsck/main.c +++ b/sbin/fsck/main.c @@ -38,7 +38,11 @@ static const char copyright[] = #endif /* not lint */ #ifndef lint -static const char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; +#if 0 +static char sccsid[] = "@(#)main.c 8.6 (Berkeley) 5/14/95"; +#endif +static const char rcsid[] = + "$Id$"; #endif /* not lint */ #include <sys/param.h> @@ -198,13 +202,11 @@ checkfilesys(filesys, mntpt, auxdata, child) return (0); case -1: pwarn("clean, %ld free ", sblock.fs_cstotal.cs_nffree + - sblock.fs_frag * sblock.fs_cstotal.cs_nbfree); - printf("(%ld frags, %ld blocks, %.1f%% fragmentation)\n", - sblock.fs_cstotal.cs_nffree, - sblock.fs_cstotal.cs_nbfree, - (float)(sblock.fs_cstotal.cs_nffree * 100) / - sblock.fs_dsize); - return(0); + sblock.fs_frag * sblock.fs_cstotal.cs_nbfree); + printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", + sblock.fs_cstotal.cs_nffree, sblock.fs_cstotal.cs_nbfree, + sblock.fs_cstotal.cs_nffree * 100.0 / sblock.fs_dsize); + return (0); } /* @@ -263,29 +265,28 @@ checkfilesys(filesys, mntpt, auxdata, child) n_bfree = sblock.fs_cstotal.cs_nbfree; pwarn("%ld files, %ld used, %ld free ", n_files, n_blks, n_ffree + sblock.fs_frag * n_bfree); - printf("(%ld frags, %ld blocks, %ld.%ld%% fragmentation)\n", - n_ffree, n_bfree, (n_ffree * 100) / sblock.fs_dsize, - ((n_ffree * 1000 + sblock.fs_dsize / 2) / sblock.fs_dsize) % 10); + printf("(%d frags, %d blocks, %.1f%% fragmentation)\n", + n_ffree, n_bfree, n_ffree * 100.0 / sblock.fs_dsize); if (debug && (n_files -= maxino - ROOTINO - sblock.fs_cstotal.cs_nifree)) - printf("%ld files missing\n", n_files); + printf("%d files missing\n", n_files); if (debug) { n_blks += sblock.fs_ncg * (cgdmin(&sblock, 0) - cgsblock(&sblock, 0)); n_blks += cgsblock(&sblock, 0) - cgbase(&sblock, 0); n_blks += howmany(sblock.fs_cssize, sblock.fs_fsize); if (n_blks -= maxfsblock - (n_ffree + sblock.fs_frag * n_bfree)) - printf("%ld blocks missing\n", n_blks); + printf("%d blocks missing\n", n_blks); if (duplist != NULL) { printf("The following duplicate blocks remain:"); for (dp = duplist; dp; dp = dp->next) - printf(" %ld,", dp->dup); + printf(" %d,", dp->dup); printf("\n"); } if (zlnhead != NULL) { printf("The following zero link count inodes remain:"); for (zlnp = zlnhead; zlnp; zlnp = zlnp->next) - printf(" %lu,", zlnp->zlncnt); + printf(" %u,", zlnp->zlncnt); printf("\n"); } } |