summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2007-02-22 10:30:14 +0000
committerjkar8572 <jkar8572>2007-02-22 10:30:14 +0000
commit3cdc88177978e5321650bf6e7361469395c03329 (patch)
treec4e08b42843dd873a73106a8711b76f8f8607ecd
parent163122f4ead1f93c8d4dce369043f609efffd604 (diff)
* added option -A to quota(1) to report all NFS mountpoints (Jan Kara)
-rw-r--r--Changelog1
-rw-r--r--quota.143
-rw-r--r--quota.c16
-rw-r--r--quotasys.c10
-rw-r--r--quotasys.h1
5 files changed, 54 insertions, 17 deletions
diff --git a/Changelog b/Changelog
index 3a1df90..e015242 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,5 @@
Changes in quota-tools from 3.14 to 3.15
+* added option -A to quota(1) to report all NFS mountpoints (Jan Kara)
* fixed XFS handling to work with loopback mounted devices (Jan Kara)
* fixed mountpoints scanning to make XFS -x delete command work (Jan Kara)
* fixes of signed vs unsigned int issues (Jan Kara)
diff --git a/quota.1 b/quota.1
index 355649c..601dced 100644
--- a/quota.1
+++ b/quota.1
@@ -7,18 +7,25 @@ quota \- display disk usage and limits
.B -F
.I format-name
] [
-.BR -guvsilw \ |
-.B q
-]
+.B -guqvswi
+] [
+.BR -l \ |
+[
+.BR -Q \ |\ -A
+]]
.br
.B quota
[
.B -F
.I format-name
] [
-.BR -uvsilw \ |
-.B q
-]
+.B -qvswi
+] [
+.BR -l \ |
+[
+.BR -Q \ |\ -A
+]]
+.B -u
.IR user ...
.br
.B quota
@@ -26,10 +33,24 @@ quota \- display disk usage and limits
.B -F
.I format-name
] [
-.BR -gvsilw \ |
-.B q
-]
+.B -qvswi
+] [
+.BR -l \ |
+[
+.BR -Q \ |\ -A
+]]
+.B -g
.IR group ...
+.br
+.B quota
+[
+.B -F
+.I format-name
+] [
+.B -qvswugQ
+]
+.B -f
+.IR filesystem ...
.SH DESCRIPTION
.B quota
displays users' disk usage and limits.
@@ -79,6 +100,10 @@ ignore mountpoints mounted by automounter
.B -l, --local-only
report quotas only on local filesystems (ie. ignore NFS mounted filesystems).
.TP
+.B -A, --all-nfs
+report quotas for all NFS filesystems even if they report to be on the same
+device.
+.TP
.B -q, --quiet
Print a more terse message,
containing only information
diff --git a/quota.c b/quota.c
index c681946..5eae173 100644
--- a/quota.c
+++ b/quota.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quota.c,v 1.20 2006/05/13 01:05:24 jkar8572 Exp $"
+#ident "$Id: quota.c,v 1.21 2007/02/22 10:30:14 jkar8572 Exp $"
/*
* Disk quota reporting program.
@@ -71,6 +71,7 @@
#define FL_NOWRAP 256
#define FL_FSLIST 512
#define FL_NUMNAMES 1024
+#define FL_NFSALL 2048
int flags, fmt = -1;
char *progname;
@@ -78,9 +79,9 @@ char *progname;
void usage(void)
{
errstr( "%s%s%s%s%s",
- _("Usage: quota [-guqvsw] [-l | -Q] [-i] [-F quotaformat]\n"),
- _("\tquota [-qvsw] [-l | -Q] [-i] [-F quotaformat] -u username ...\n"),
- _("\tquota [-qvsw] [-l | -Q] [-i] [-F quotaformat] -g groupname ...\n"),
+ _("Usage: quota [-guqvsw] [-l | [-Q | -A]] [-i] [-F quotaformat]\n"),
+ _("\tquota [-qvsw] [-l | [-Q | -A]] [-i] [-F quotaformat] -u username ...\n"),
+ _("\tquota [-qvsw] [-l | [-Q | -A]] [-i] [-F quotaformat] -g groupname ...\n"),
_("\tquota [-qvswugQ] [-F quotaformat] -f filesystem ...\n"),
_("\n\
-u, --user display quota for user\n\
@@ -97,6 +98,7 @@ void usage(void)
-i, --no-autofs do not query autofs mountpoints\n\
-F, --format=formatname display quota of a specific format\n\
-f, --filesystem-list display quota information only for given filesystems\n\
+-A, --nfs-all display quota for all NFS mountpoints\n\
-h, --help display this help message and exit\n\
-V, --version display version information and exit\n\n"));
fprintf(stderr, _("Bugs to: %s\n"), MY_EMAIL);
@@ -126,7 +128,7 @@ int showquotas(int type, qid_t id, int mntcnt, char **mnt)
time(&now);
id2name(id, type, name);
- handles = create_handle_list(mntcnt, mnt, type, fmt, IOI_READONLY, ((flags & FL_NOAUTOFS) ? MS_NO_AUTOFS : 0) | ((flags & FL_LOCALONLY) ? MS_LOCALONLY : 0));
+ handles = create_handle_list(mntcnt, mnt, type, fmt, IOI_READONLY, ((flags & FL_NOAUTOFS) ? MS_NO_AUTOFS : 0) | ((flags & FL_LOCALONLY) ? MS_LOCALONLY : 0) | ((flags & FL_NFSALL) ? MS_NFS_ALL : 0));
qlist = getprivs(id, handles, !!(flags & FL_QUIETREFUSE));
over = 0;
for (q = qlist; q; q = q->dq_next) {
@@ -229,6 +231,7 @@ int main(int argc, char **argv)
{ "format", 1, NULL, 'F' },
{ "no-wrap", 0, NULL, 'w' },
{ "filesystem-list", 0, NULL, 'f' },
+ { "all-nfs", 0, NULL, 'A' },
{ NULL, 0, NULL, 0 }
};
@@ -274,6 +277,9 @@ int main(int argc, char **argv)
case 'f':
flags |= FL_FSLIST;
break;
+ case 'A':
+ flags |= FL_NFSALL;
+ break;
case 'V':
version();
exit(0);
diff --git a/quotasys.c b/quotasys.c
index 73f19c6..401994b 100644
--- a/quotasys.c
+++ b/quotasys.c
@@ -971,9 +971,13 @@ static int cache_mnt_table(int flags)
continue;
}
if (nfs_fstype(mnt->mnt_type)) {
- /* For network filesystems we must get device from root */
- dev = st.st_dev;
- for (i = 0; i < mnt_entries_cnt && mnt_entries[i].me_dev != dev; i++);
+ if (!(flags & MS_NFS_ALL)) {
+ /* For network filesystems we must get device from root */
+ dev = st.st_dev;
+ for (i = 0; i < mnt_entries_cnt && mnt_entries[i].me_dev != dev; i++);
+ }
+ else /* Always behave as if the device was unique */
+ i = mnt_entries_cnt;
}
}
if (i == mnt_entries_cnt) { /* New mounted device? */
diff --git a/quotasys.h b/quotasys.h
index 4abb64b..642eed3 100644
--- a/quotasys.h
+++ b/quotasys.h
@@ -132,6 +132,7 @@ int kern_quota_on(const char *dev, int type, int fmt);
#define MS_QUIET 0x04 /* Be quiet with error reporting */
#define MS_LOCALONLY 0x08 /* Ignore nfs mountpoints */
#define MS_XFS_DISABLED 0x10 /* Return also XFS mountpoints with quota disabled */
+#define MS_NFS_ALL 0x20 /* Don't filter NFS mountpoints on the same device */
/* Initialize mountpoints scan */
int init_mounts_scan(int dcnt, char **dirs, int flags);