Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/bouyer-quota2]: src/usr.sbin/repquota When reading quota1 entries, initi...



details:   https://anonhg.NetBSD.org/src/rev/ea0923d8b309
branches:  bouyer-quota2
changeset: 761177:ea0923d8b309
user:      bouyer <bouyer%NetBSD.org@localhost>
date:      Mon Feb 14 20:55:36 2011 +0000

description:
When reading quota1 entries, initialize default quota to unlimited,
for POLA when using -x.
When displaying quotas, do not skip users which have a 0 usage but are
overquota.
When -v is used display all existing quota entries, including those with a
0 usage.

diffstat:

 usr.sbin/repquota/repquota.8 |   3 ++-
 usr.sbin/repquota/repquota.c |  25 ++++++++++++++++---------
 2 files changed, 18 insertions(+), 10 deletions(-)

diffs (83 lines):

diff -r d559c7adeada -r ea0923d8b309 usr.sbin/repquota/repquota.8
--- a/usr.sbin/repquota/repquota.8      Mon Feb 14 20:38:56 2011 +0000
+++ b/usr.sbin/repquota/repquota.8      Mon Feb 14 20:55:36 2011 +0000
@@ -29,7 +29,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\"     from: @(#)repquota.8   8.1 (Berkeley) 6/6/93
-.\"    $NetBSD: repquota.8,v 1.9.50.2 2011/02/10 17:11:35 bouyer Exp $
+.\"    $NetBSD: repquota.8,v 1.9.50.3 2011/02/14 20:55:36 bouyer Exp $
 .\"
 .Dd February 10, 2011
 .Dt REPQUOTA 8
@@ -75,6 +75,7 @@
 group and user quotas if they exist).
 .It Fl v
 Print a header line before printing each filesystem quotas.
+Print all exiting quotas, including those whose current usage is 0.
 .It Fl D
 Debug: print plist sent to and received from kernel.
 .It Fl h
diff -r d559c7adeada -r ea0923d8b309 usr.sbin/repquota/repquota.c
--- a/usr.sbin/repquota/repquota.c      Mon Feb 14 20:38:56 2011 +0000
+++ b/usr.sbin/repquota/repquota.c      Mon Feb 14 20:55:36 2011 +0000
@@ -40,7 +40,7 @@
 #if 0
 static char sccsid[] = "@(#)repquota.c 8.2 (Berkeley) 11/22/94";
 #else
-__RCSID("$NetBSD: repquota.c,v 1.25.2.7 2011/02/10 17:11:35 bouyer Exp $");
+__RCSID("$NetBSD: repquota.c,v 1.25.2.8 2011/02/14 20:55:36 bouyer Exp $");
 #endif
 #endif /* not lint */
 
@@ -378,7 +378,9 @@
                        if (dqbuf.dqb_itime > 0)
                                igrace = dqbuf.dqb_itime;
                }
-               if (dqbuf.dqb_curinodes == 0 && dqbuf.dqb_curblocks == 0)
+               if (dqbuf.dqb_curinodes == 0 && dqbuf.dqb_curblocks == 0 &&
+                   dqbuf.dqb_bsoftlimit == 0 && dqbuf.dqb_bhardlimit == 0 &&
+                   dqbuf.dqb_isoftlimit == 0 && dqbuf.dqb_ihardlimit == 0)
                        continue;
                if ((fup = lookup(id, type)) == 0)
                        fup = addid(id, type, (char *)0);
@@ -388,6 +390,10 @@
        }
        defaultq2e[type].q2e_val[QL_BLOCK].q2v_grace = bgrace;
        defaultq2e[type].q2e_val[QL_FILE].q2v_grace = igrace;
+       defaultq2e[type].q2e_val[QL_BLOCK].q2v_softlimit = 
+           defaultq2e[type].q2e_val[QL_BLOCK].q2v_hardlimit = 
+           defaultq2e[type].q2e_val[QL_FILE].q2v_softlimit = 
+           defaultq2e[type].q2e_val[QL_FILE].q2v_hardlimit = UQUAD_MAX;
        fclose(qf);
        valid[type] = 1;
        if (xflag == 0)
@@ -423,13 +429,6 @@
                fup = lookup(id, type);
                if (fup == 0)
                        continue;
-               if (fup->fu_q2e.q2e_val[QL_BLOCK].q2v_cur == 0 &&
-                   fup->fu_q2e.q2e_val[QL_FILE].q2v_cur == 0)
-                       continue;
-               if (strlen(fup->fu_name) > 9)
-                       printf("%s ", fup->fu_name);
-               else
-                       printf("%-10s", fup->fu_name);
                for (i = 0; i < N_QL; i++) {
                        switch (QL_STATUS(quota2_check_limit(
                             &fup->fu_q2e.q2e_val[i], 1, now))) {
@@ -450,6 +449,14 @@
                        }
                }
 
+               if (fup->fu_q2e.q2e_val[QL_BLOCK].q2v_cur == 0 &&
+                   fup->fu_q2e.q2e_val[QL_FILE].q2v_cur == 0 && vflag == 0 &&
+                   overchar[QL_BLOCK] == '-' && overchar[QL_FILE] == '-')
+                       continue;
+               if (strlen(fup->fu_name) > 9)
+                       printf("%s ", fup->fu_name);
+               else
+                       printf("%-10s", fup->fu_name);
                printf("%c%c%9s%9s%9s%7s",
                        overchar[QL_BLOCK], overchar[QL_FILE],
                        intprt(fup->fu_q2e.q2e_val[QL_BLOCK].q2v_cur,



Home | Main Index | Thread Index | Old Index