From a8ae1d2ba84b022b27b8b4b26a2062af00395a96 Mon Sep 17 00:00:00 2001 From: Julian Elischer Date: Mon, 1 Nov 1999 04:46:09 +0000 Subject: [PATCH] Description repquota reports softlimits, hardlimits and ``used'' field incorrectly, namely those numbers get wrapped modulo 4Gbytes. PR: bin/8164 Submitted by: Anton Berezin --- usr.sbin/repquota/repquota.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c index 8a905ccee37d..3c9aca3424ca 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -65,6 +65,17 @@ static const char rcsid[] = #include #include +/* Let's be paranoid about block size */ +#if 10 > DEV_BSHIFT +#define dbtokb(db) \ + ((off_t)(db) >> (10-DEV_BSHIFT)) +#elif 10 < DEV_BSHIFT +#define dbtokb(db) \ + ((off_t)(db) << (DEV_BSHIFT-10)) +#else +#define dbtokb(db) (db) +#endif + #define max(a,b) ((a) >= (b) ? (a) : (b)) char *qfname = QUOTAFILENAME; @@ -238,9 +249,9 @@ repquota(fs, type, qfpathname) fup->fu_dqblk.dqb_isoftlimit && fup->fu_dqblk.dqb_curinodes >= fup->fu_dqblk.dqb_isoftlimit ? '+' : '-', - (u_long)(dbtob(fup->fu_dqblk.dqb_curblocks) / 1024), - (u_long)(dbtob(fup->fu_dqblk.dqb_bsoftlimit) / 1024), - (u_long)(dbtob(fup->fu_dqblk.dqb_bhardlimit) / 1024), + (u_long)(dbtokb(fup->fu_dqblk.dqb_curblocks)), + (u_long)(dbtokb(fup->fu_dqblk.dqb_bsoftlimit)), + (u_long)(dbtokb(fup->fu_dqblk.dqb_bhardlimit)), fup->fu_dqblk.dqb_bsoftlimit && fup->fu_dqblk.dqb_curblocks >= fup->fu_dqblk.dqb_bsoftlimit ?