From owner-freebsd-current Fri Jun 7 18: 6:37 2002 Delivered-To: freebsd-current@freebsd.org Received: from flood.ping.uio.no (flood.ping.uio.no [129.240.78.31]) by hub.freebsd.org (Postfix) with ESMTP id 76C7C37B408 for ; Fri, 7 Jun 2002 18:06:31 -0700 (PDT) Received: by flood.ping.uio.no (Postfix, from userid 2602) id 7D3D65361; Sat, 8 Jun 2002 03:06:25 +0200 (CEST) X-URL: http://www.ofug.org/~des/ X-Disclaimer: The views expressed in this message do not necessarily coincide with those of any organisation or company with which I am or have been affiliated. To: Brooks Davis Cc: Poul-Henning Kamp , current@FreeBSD.ORG Subject: Re: Please test the UFS2 patch! References: <20020606170603.GA29429@web.de> <1820.1023390934@critter.freebsd.dk> <20020607150902.B19826@Odin.AC.HMC.Edu> From: Dag-Erling Smorgrav Date: 08 Jun 2002 03:06:25 +0200 In-Reply-To: <20020607150902.B19826@Odin.AC.HMC.Edu> Message-ID: Lines: 15 User-Agent: Gnus/5.0808 (Gnus v5.8.8) Emacs/21.2 MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="=-=-=" Sender: owner-freebsd-current@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --=-=-= Brooks Davis writes: > In addition to the dump problem I've reported, I'm also seeing issues > with df output. The following is obviously wrong: > > Filesystem 1K-blocks Used Avail Capacity Mounted on > /dev/ad0s2a 254063 -246047 479785 -105% / Does the attached patch fix the problem? DES -- Dag-Erling Smorgrav - des@ofug.org --=-=-= Content-Type: text/x-patch Content-Disposition: attachment; filename=df.diff Index: df.c =================================================================== RCS file: /home/ncvs/src/bin/df/df.c,v retrieving revision 1.39 diff -u -r1.39 df.c --- df.c 18 May 2002 21:10:40 -0000 1.39 +++ df.c 8 Jun 2002 01:05:08 -0000 @@ -58,6 +58,7 @@ #include #include #include +#include #include #include #include @@ -372,7 +373,7 @@ * Attempts to avoid overflow for large filesystems. */ #define fsbtoblk(num, fsbs, bs) \ - (((fsbs) != 0 && (fsbs) < (bs)) ? \ + (intmax_t)(((fsbs) != 0 && (fsbs) < (bs)) ? \ (num) / ((bs) / (fsbs)) : (num) * ((fsbs) / (bs))) /* @@ -384,7 +385,7 @@ static long blocksize; static int headerlen, timesthrough; static const char *header; - long used, availblks, inodes; + intmax_t used, availblks, inodes; if (++timesthrough == 1) { mwp->mntfrom = imax(mwp->mntfrom, strlen("Filesystem")); @@ -415,7 +416,7 @@ if (hflag) { prthuman(sfsp, used); } else { - (void)printf(" %*ld %*ld %*ld", mwp->total, + (void)printf(" %*jd %*jd %*jd", mwp->total, fsbtoblk(sfsp->f_blocks, sfsp->f_bsize, blocksize), mwp->used, fsbtoblk(used, sfsp->f_bsize, blocksize), mwp->avail, fsbtoblk(sfsp->f_bavail, sfsp->f_bsize, @@ -426,8 +427,8 @@ if (iflag) { inodes = sfsp->f_files; used = inodes - sfsp->f_ffree; - (void)printf(" %*ld %*ld %4.0f%% ", mwp->iused, used, - mwp->ifree, sfsp->f_ffree, inodes == 0 ? 100.0 : + (void)printf(" %*jd %*jd %4.0f%% ", mwp->iused, used, + mwp->ifree, (intmax_t)sfsp->f_ffree, inodes == 0 ? 100.0 : (double)used / (double)inodes * 100.0); } else (void)printf(" "); --=-=-=-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-current" in the body of the message