Date: 08 Jun 2002 03:06:25 +0200 From: Dag-Erling Smorgrav <des@ofug.org> To: Brooks Davis <brooks@one-eyed-alien.net> Cc: Poul-Henning Kamp <phk@critter.freebsd.dk>, current@FreeBSD.ORG Subject: Re: Please test the UFS2 patch! Message-ID: <xzp8z5qk29a.fsf@flood.ping.uio.no> In-Reply-To: <20020607150902.B19826@Odin.AC.HMC.Edu> References: <20020606170603.GA29429@web.de> <1820.1023390934@critter.freebsd.dk> <20020607150902.B19826@Odin.AC.HMC.Edu>
next in thread | previous in thread | raw e-mail | index | archive | help
--=-=-=
Brooks Davis <brooks@one-eyed-alien.net> 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 <ufs/ufs/ufsmount.h>
#include <err.h>
#include <math.h>
+#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
@@ -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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?xzp8z5qk29a.fsf>
