diff options
author | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-01-14 23:03:40 +0000 |
---|---|---|
committer | Angelos D. Keromytis <angelos@cvs.openbsd.org> | 2001-01-14 23:03:40 +0000 |
commit | c77fa51aab8312bed8825f57f27b3fba45113958 (patch) | |
tree | 797bce9eda27915ec393d08a18fa51aa57be557e | |
parent | 5a6bd6dab375575810f75de24d17c2189af9adcd (diff) |
Handle quotas over 4G, PR 1534 (bob@prophecy.lu)
-rw-r--r-- | usr.sbin/edquota/edquota.c | 18 | ||||
-rw-r--r-- | usr.sbin/repquota/repquota.c | 19 |
2 files changed, 23 insertions, 14 deletions
diff --git a/usr.sbin/edquota/edquota.c b/usr.sbin/edquota/edquota.c index 2454e60e127..aed80aecd8f 100644 --- a/usr.sbin/edquota/edquota.c +++ b/usr.sbin/edquota/edquota.c @@ -42,7 +42,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)edquota.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: edquota.c,v 1.25 2000/12/21 09:48:05 pjanzen Exp $"; +static char *rcsid = "$Id: edquota.c,v 1.26 2001/01/14 23:03:39 angelos Exp $"; #endif /* not lint */ /* @@ -66,6 +66,12 @@ static char *rcsid = "$Id: edquota.c,v 1.25 2000/12/21 09:48:05 pjanzen Exp $"; #include <unistd.h> #include "pathnames.h" +#if DEV_BSHIFT < 10 +#define dbtokb(x) ((x) >> (10 - DEV_BSHIFT)) +#else +#define dbtokb(x) ((x) << (DEV_BSHIFT - 10)) +#endif + char *qfname = QUOTAFILENAME; char *qfextension[] = INITQFNAMES; char *quotagroup = QUOTAGROUP; @@ -431,12 +437,12 @@ writeprivs(quplist, outfd, name, quotatype) err(1, "%s", tmpfil); (void)fprintf(fd, "Quotas for %s %s:\n", qfextension[quotatype], name); for (qup = quplist; qup; qup = qup->next) { - (void)fprintf(fd, "%s: %s %d, limits (soft = %d, hard = %d)\n", + (void)fprintf(fd, "%s: %s %lu, limits (soft = %lu, hard = %lu)\n", qup->fsname, "blocks in use:", - (int)(dbtob((u_quad_t)qup->dqblk.dqb_curblocks) / 1024), - (int)(dbtob((u_quad_t)qup->dqblk.dqb_bsoftlimit) / 1024), - (int)(dbtob((u_quad_t)qup->dqblk.dqb_bhardlimit) / 1024)); - (void)fprintf(fd, "%s %d, limits (soft = %d, hard = %d)\n", + (int)(dbtokb((u_quad_t)qup->dqblk.dqb_curblocks)), + (int)(dbtokb((u_quad_t)qup->dqblk.dqb_bsoftlimit)), + (int)(dbtokb((u_quad_t)qup->dqblk.dqb_bhardlimit))); + (void)fprintf(fd, "%s %lu, limits (soft = %lu, hard = %lu)\n", "\tinodes in use:", qup->dqblk.dqb_curinodes, qup->dqblk.dqb_isoftlimit, qup->dqblk.dqb_ihardlimit); } diff --git a/usr.sbin/repquota/repquota.c b/usr.sbin/repquota/repquota.c index dd452325b26..d9bdc324daa 100644 --- a/usr.sbin/repquota/repquota.c +++ b/usr.sbin/repquota/repquota.c @@ -42,7 +42,7 @@ static char copyright[] = #ifndef lint /*static char sccsid[] = "from: @(#)repquota.c 8.1 (Berkeley) 6/6/93";*/ -static char *rcsid = "$Id: repquota.c,v 1.12 2000/12/21 09:50:00 pjanzen Exp $"; +static char *rcsid = "$Id: repquota.c,v 1.13 2001/01/14 23:03:05 angelos Exp $"; #endif /* not lint */ /* @@ -59,6 +59,12 @@ static char *rcsid = "$Id: repquota.c,v 1.12 2000/12/21 09:50:00 pjanzen Exp $"; #include <string.h> #include <errno.h> +#if DEV_BSHIFT < 10 +#define dbtokb(x) ((x) >> (10 - DEV_BSHIFT)) +#else +#define dbtokb(x) ((x) << (DEV_BSHIFT - 10)) +#endif + char *qfname = QUOTAFILENAME; char *qfextension[] = INITQFNAMES; @@ -226,19 +232,16 @@ repquota(fs, type, qfpathname) fup->fu_dqblk.dqb_curblocks == 0) continue; printf("%-10s", fup->fu_name); - printf("%c%c%8d%8d%8d%7s", + printf("%c%c%8lu%8lu%8lu%7s", fup->fu_dqblk.dqb_bsoftlimit && fup->fu_dqblk.dqb_curblocks >= fup->fu_dqblk.dqb_bsoftlimit ? '+' : '-', fup->fu_dqblk.dqb_isoftlimit && fup->fu_dqblk.dqb_curinodes >= fup->fu_dqblk.dqb_isoftlimit ? '+' : '-', - (int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_curblocks) - / 1024), - (int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_bsoftlimit) - / 1024), - (int)(dbtob((u_quad_t)fup->fu_dqblk.dqb_bhardlimit) - / 1024), + (int)(dbtokb((u_quad_t)fup->fu_dqblk.dqb_curblocks)), + (int)(dbtokb((u_quad_t)fup->fu_dqblk.dqb_bsoftlimit)), + (int)(dbtokb((u_quad_t)fup->fu_dqblk.dqb_bhardlimit)), fup->fu_dqblk.dqb_bsoftlimit && fup->fu_dqblk.dqb_curblocks >= fup->fu_dqblk.dqb_bsoftlimit ? |