|
|
ecf77e |
From bd36c3cf438ac4fd44b6779714ad0a44453d41b5 Mon Sep 17 00:00:00 2001
|
|
|
ecf77e |
From: =?UTF-8?q?Petr=20P=C3=ADsa=C5=99?= <ppisar@redhat.com>
|
|
|
ecf77e |
Date: Mon, 16 Jul 2018 11:22:53 +0200
|
|
|
ecf77e |
Subject: [PATCH] quota(1): Distinguish between none quota limits and no
|
|
|
ecf77e |
allocated resources
|
|
|
ecf77e |
MIME-Version: 1.0
|
|
|
ecf77e |
Content-Type: text/plain; charset=UTF-8
|
|
|
ecf77e |
Content-Transfer-Encoding: 8bit
|
|
|
ecf77e |
|
|
|
ecf77e |
If a user does not occupies any space or inodes on a file system but
|
|
|
ecf77e |
quota limits are set, quota(1) tool still reports "none":
|
|
|
ecf77e |
|
|
|
ecf77e |
# quota -u test
|
|
|
ecf77e |
Disk quotas for user test (uid 500): none
|
|
|
ecf77e |
|
|
|
ecf77e |
That's because the tool skips printing details for file systems
|
|
|
ecf77e |
without any used resources but uses the shares the message with file
|
|
|
ecf77e |
system without any quota limits.
|
|
|
ecf77e |
|
|
|
ecf77e |
This patch makes the distinction and changes "none" message into "no
|
|
|
ecf77e |
quota limits set" and "no limited resources used" respectively.
|
|
|
ecf77e |
|
|
|
ecf77e |
Signed-off-by: Petr Písař <ppisar@redhat.com>
|
|
|
ecf77e |
---
|
|
|
ecf77e |
quota.c | 15 ++++++++++-----
|
|
|
ecf77e |
1 file changed, 10 insertions(+), 5 deletions(-)
|
|
|
ecf77e |
|
|
|
ecf77e |
diff --git a/quota.c b/quota.c
|
|
|
ecf77e |
index 15c2a53..0303c7d 100644
|
|
|
ecf77e |
--- a/quota.c
|
|
|
ecf77e |
+++ b/quota.c
|
|
|
ecf77e |
@@ -188,7 +188,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
|
ecf77e |
char timebuf[MAXTIMELEN];
|
|
|
ecf77e |
char name[MAXNAMELEN];
|
|
|
ecf77e |
struct quota_handle **handles;
|
|
|
ecf77e |
- int lines = 0, bover, iover, over;
|
|
|
ecf77e |
+ int lines = 0, bover, iover, over, unlimited;
|
|
|
ecf77e |
time_t now;
|
|
|
ecf77e |
|
|
|
ecf77e |
time(&now;;
|
|
|
ecf77e |
@@ -204,11 +204,16 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
|
ecf77e |
goto out_handles;
|
|
|
ecf77e |
}
|
|
|
ecf77e |
over = 0;
|
|
|
ecf77e |
+ unlimited = 1;
|
|
|
ecf77e |
for (q = qlist; q; q = q->dq_next) {
|
|
|
ecf77e |
bover = iover = 0;
|
|
|
ecf77e |
- if (!(flags & FL_VERBOSE) && !q->dq_dqb.dqb_isoftlimit && !q->dq_dqb.dqb_ihardlimit
|
|
|
ecf77e |
- && !q->dq_dqb.dqb_bsoftlimit && !q->dq_dqb.dqb_bhardlimit)
|
|
|
ecf77e |
- continue;
|
|
|
ecf77e |
+ if (!q->dq_dqb.dqb_isoftlimit && !q->dq_dqb.dqb_ihardlimit
|
|
|
ecf77e |
+ && !q->dq_dqb.dqb_bsoftlimit && !q->dq_dqb.dqb_bhardlimit) {
|
|
|
ecf77e |
+ if (!(flags & FL_VERBOSE))
|
|
|
ecf77e |
+ continue;
|
|
|
ecf77e |
+ } else {
|
|
|
ecf77e |
+ unlimited = 0;
|
|
|
ecf77e |
+ }
|
|
|
ecf77e |
msgi = NULL;
|
|
|
ecf77e |
if (q->dq_dqb.dqb_ihardlimit && q->dq_dqb.dqb_curinodes >= q->dq_dqb.dqb_ihardlimit) {
|
|
|
ecf77e |
msgi = _("File limit reached on");
|
|
|
ecf77e |
@@ -300,7 +305,7 @@ static int showquotas(int type, qid_t id, int mntcnt, char **mnt)
|
|
|
ecf77e |
}
|
|
|
ecf77e |
}
|
|
|
ecf77e |
if (!(flags & FL_QUIET) && !lines && qlist)
|
|
|
ecf77e |
- heading(type, id, name, _("none"));
|
|
|
ecf77e |
+ heading(type, id, name, unlimited ? _("none") : _("no limited resources used"));
|
|
|
ecf77e |
freeprivs(qlist);
|
|
|
ecf77e |
out_handles:
|
|
|
ecf77e |
dispose_handle_list(handles);
|
|
|
ecf77e |
--
|
|
|
ecf77e |
2.14.4
|
|
|
ecf77e |
|