summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-11-05 07:43:09 +0000
committerjkar8572 <jkar8572>2001-11-05 07:43:09 +0000
commite3cd20e7ae77e71cd859b09849c1f68e57f9f580 (patch)
tree7d1f3987cb23fbf6b31ed11759606bb9d3d4924f
parent4b6e612eec355fda234e7957e08d943eb6872813 (diff)
downloadlinuxquota-e3cd20e7ae77e71cd859b09849c1f68e57f9f580.tar.gz
Added -n option (don't resolve names) to repquota (not tested)
-rw-r--r--Changelog4
-rw-r--r--repquota.813
-rw-r--r--repquota.c19
3 files changed, 32 insertions, 4 deletions
diff --git a/Changelog b/Changelog
index 713d444..7cf524a 100644
--- a/Changelog
+++ b/Changelog
@@ -1,3 +1,7 @@
+Changes in quota-tools from 3.01 to ????
+
+* added -n option (don't resolve names) to repquota (Jan Kara)
+
Changes in quota-tools from 3.01-final to 3.01
* quotastats should now work better on old kernels (Jan Kara)
diff --git a/repquota.8 b/repquota.8
index 43b6d26..05b7f3c 100644
--- a/repquota.8
+++ b/repquota.8
@@ -5,7 +5,11 @@ repquota \- summarize quotas for a filesystem
.SH SYNOPSIS
.B /usr/sbin/repquota
[
-.B \-vtsug
+.B \-vsug
+] [
+.B \-t
+|
+.B \-n
] [
.B \-F
.I format-name
@@ -16,6 +20,10 @@ repquota \- summarize quotas for a filesystem
[
.B \-avtsug
] [
+.B \-t
+|
+.B \-n
+] [
.B \-F
.I format-name
]
@@ -49,6 +57,9 @@ information.
Truncate user/group names longer than 9 characters. This results in nicer output when
there are such names.
.TP
+.B \-n
+Don't resolve UIDs/GIDs to names. This can speedup printing a lot.
+.TP
.B \-s
Try to report used space, number of used inodes and limits in more appropriate units
than default ones.
diff --git a/repquota.c b/repquota.c
index b4eac62..f46350d 100644
--- a/repquota.c
+++ b/repquota.c
@@ -30,6 +30,7 @@
#define FL_ALL 8
#define FL_TRUNCNAMES 16
#define FL_SHORTNUMS 32
+#define FL_NONAME 64
int flags, fmt = -1;
char **mnt;
@@ -40,7 +41,7 @@ char *progname;
static void usage(void)
{
- errstr(_("Utility for reporting quotas.\nUsage:\n%s [-vugts] [-F quotaformat] (-a | mntpoint)\n"), progname);
+ errstr(_("Utility for reporting quotas.\nUsage:\n%s [-vugs] [-t|n] [-F quotaformat] (-a | mntpoint)\n"), progname);
fprintf(stderr, _("Bugs to %s\n"), MY_EMAIL);
exit(1);
}
@@ -55,7 +56,7 @@ static void parse_options(int argcnt, char **argstr)
else
slash++;
- while ((ret = getopt(argcnt, argstr, "VavughtsF:")) != -1) {
+ while ((ret = getopt(argcnt, argstr, "VavughtsnF:")) != -1) {
switch (ret) {
case '?':
case 'h':
@@ -85,6 +86,9 @@ static void parse_options(int argcnt, char **argstr)
if ((fmt = name2fmt(optarg)) == QF_ERROR)
exit(1);
break;
+ case 'n':
+ flags |= FL_NONAME;
+ break;
}
}
@@ -97,6 +101,10 @@ static void parse_options(int argcnt, char **argstr)
fputs(_("Repquota can't report through RPC calls.\n"), stderr);
exit(1);
}
+ if (flags & FL_NONAME && flags & FL_TRUNCNAMES) {
+ fputs(_("Specified both -n and -t but only one of them can be used.\n"), stderr);
+ exit(1);
+ }
if (!(flags & (FL_USER | FL_GROUP)))
flags |= FL_USER;
if (!(flags & FL_ALL)) {
@@ -184,8 +192,13 @@ static void dump_cached_dquots(int type)
static int output(struct dquot *dquot, char *name)
{
+ if (flags & FL_NONAME) {
+ char namebuf[MAXNAMELEN];
- if (name)
+ sprintf(namebuf, "#%u", dquot->dq_id);
+ print(dquot, namebuf);
+ }
+ else if (name)
print(dquot, name);
else {
memcpy(dquot_cache+cached_dquots++, dquot, sizeof(struct dquot));