summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2010-06-10 10:12:49 +0000
committerjkar8572 <jkar8572>2010-06-10 10:12:49 +0000
commitb95ab586eceb96bc02a66b3049a2e0a2647926c8 (patch)
treeff0f3003c144c9ec195d64d9b77578485f671588
parentb58944b582722dd3c56893eb4b6c8b8a0291201d (diff)
* fix quotaon to print all informational messages only in verbose mode (Jan Kara)
-rw-r--r--Changelog2
-rw-r--r--quotaon.c32
-rw-r--r--quotaon.h2
-rw-r--r--quotaon_xfs.c29
-rw-r--r--warnquota.84
5 files changed, 39 insertions, 30 deletions
diff --git a/Changelog b/Changelog
index 2c4e872..622ba70 100644
--- a/Changelog
+++ b/Changelog
@@ -1,4 +1,6 @@
Changes in quota-tools from 3.17 to 4.00-pre2
+* fix quotaon to print all informational messages only in verbose mode (Jan Kara)
+* fix warnquota manpage to not speak about RPC (Jan Kara)
* fix repquota to get latest quota info header (Jan Kara)
* do not count system inodes into quota for ext[234] (Jan Kara)
* improve detection of XFS kernel quota interface (Jan Kara)
diff --git a/quotaon.c b/quotaon.c
index 1d1187b..8f7651b 100644
--- a/quotaon.c
+++ b/quotaon.c
@@ -42,6 +42,7 @@
#include <getopt.h>
#include <string.h>
#include <stdlib.h>
+#include <stdarg.h>
#include "quotaon.h"
#include "quota.h"
@@ -145,6 +146,19 @@ static void parse_options(int argcnt, char **argstr)
}
}
+int pinfo(char *fmt, ...)
+{
+ va_list arg;
+ int ret;
+
+ if (!(flags & FL_VERBOSE))
+ return 0;
+ va_start(arg, fmt);
+ ret = vprintf(fmt, arg);
+ va_end(arg);
+ return ret;
+}
+
/*
* Enable/disable rsquash on given filesystem
*/
@@ -171,10 +185,10 @@ static int quotarsquashonoff(const char *quotadev, int type, int flags)
errstr(_("set root_squash on %s: %s\n"), quotadev, strerror(errno));
return 1;
}
- if ((flags & STATEFLAG_VERBOSE) && (flags & STATEFLAG_OFF))
- printf(_("%s: %s root_squash turned off\n"), quotadev, type2name(type));
- else if ((flags & STATEFLAG_VERBOSE) && (flags & STATEFLAG_ON))
- printf(_("%s: %s root_squash turned on\n"), quotadev, type2name(type));
+ if (flags & STATEFLAG_OFF)
+ pinfo(_("%s: %s root_squash turned off\n"), quotadev, type2name(type));
+ else if (flags & STATEFLAG_ON)
+ pinfo(_("%s: %s root_squash turned on\n"), quotadev, type2name(type));
#endif
return 0;
}
@@ -195,8 +209,7 @@ static int quotaonoff(char *quotadev, char *quotadir, char *quotafile, int type,
errstr(_("quotactl on %s [%s]: %s\n"), quotadev, quotadir, strerror(errno));
return 1;
}
- if (flags & STATEFLAG_VERBOSE)
- printf(_("%s [%s]: %s quotas turned off\n"), quotadev, quotadir, type2name(type));
+ pinfo(_("%s [%s]: %s quotas turned off\n"), quotadev, quotadir, type2name(type));
return 0;
}
if (kernel_iface == IFACE_GENERIC) {
@@ -218,8 +231,7 @@ static int quotaonoff(char *quotadev, char *quotadir, char *quotafile, int type,
errstr(_("Quota format not supported in kernel.\n"));
return 1;
}
- if (flags & STATEFLAG_VERBOSE)
- printf(_("%s [%s]: %s quotas turned on\n"), quotadev, quotadir, type2name(type));
+ pinfo(_("%s [%s]: %s quotas turned on\n"), quotadev, quotadir, type2name(type));
return 0;
}
@@ -268,8 +280,6 @@ static int newstate(struct mntent *mnt, int type, char *extra)
int sflags, ret = 0;
sflags = flags & FL_OFF ? STATEFLAG_OFF : STATEFLAG_ON;
- if (flags & FL_VERBOSE)
- sflags |= STATEFLAG_VERBOSE;
if (flags & FL_ALL)
sflags |= STATEFLAG_ALL;
@@ -376,7 +386,7 @@ int main(int argc, char **argv)
while ((mnt = get_next_mount())) {
if (nfs_fstype(mnt->mnt_type)) {
if (!(flags & FL_ALL))
- fprintf(stderr, "%s: Quota cannot be turned on on NFS filesystem\n", mnt->mnt_fsname);
+ errstr(_("%s: Quota cannot be turned on on NFS filesystem\n"), mnt->mnt_fsname);
continue;
}
diff --git a/quotaon.h b/quotaon.h
index 4e92f09..baf3246 100644
--- a/quotaon.h
+++ b/quotaon.h
@@ -13,7 +13,7 @@
#define STATEFLAG_ON 0x01
#define STATEFLAG_OFF 0x02
#define STATEFLAG_ALL 0x04
-#define STATEFLAG_VERBOSE 0x08
typedef int (newstate_t) (struct mntent * mnt, int type, char *file, int flags);
extern int xfs_newstate(struct mntent *mnt, int type, char *file, int flags);
+extern int pinfo(char *fmt, ...);
diff --git a/quotaon_xfs.c b/quotaon_xfs.c
index a2c9f5e..d19f31b 100644
--- a/quotaon_xfs.c
+++ b/quotaon_xfs.c
@@ -59,8 +59,8 @@ static int xfs_state_check(int qcmd, int type, int flags, char *dev, int roothac
return 1;
case Q_XFS_QUOTAON:
if (roothack) {
- printf(_("Enabling %s quota on root filesystem"
- " (reboot to take effect)\n"), type2name(type));
+ pinfo(_("Enabling %s quota on root filesystem"
+ " (reboot to take effect)\n"), type2name(type));
return 1;
}
errstr(_("Enable XFS %s quota accounting during mount\n"),
@@ -79,12 +79,12 @@ static int xfs_state_check(int qcmd, int type, int flags, char *dev, int roothac
return -1;
case Q_XFS_QUOTAON:
if (roothack) {
- printf(_("Enabling %s quota on root filesystem"
- " (reboot to take effect)\n"), type2name(type));
+ pinfo(_("Enabling %s quota on root filesystem"
+ " (reboot to take effect)\n"), type2name(type));
return 1;
}
if (xopts & XFS_QUOTA_UDQ_ENFD || xopts & XFS_QUOTA_GDQ_ENFD) {
- printf(_("Enabling %s quota enforcement on %s\n"), type2name(type), dev);
+ pinfo(_("Enabling %s quota enforcement on %s\n"), type2name(type), dev);
return 1;
}
errstr(_("Already accounting %s quota on %s\n"),
@@ -92,7 +92,7 @@ static int xfs_state_check(int qcmd, int type, int flags, char *dev, int roothac
return -1;
case Q_XFS_QUOTAOFF:
if (xopts & XFS_QUOTA_UDQ_ACCT || xopts & XFS_QUOTA_GDQ_ACCT) {
- printf(_("Disabling %s quota accounting on %s\n"),
+ pinfo(_("Disabling %s quota accounting on %s\n"),
type2name(type), dev);
return 1;
}
@@ -121,9 +121,9 @@ static int xfs_state_check(int qcmd, int type, int flags, char *dev, int roothac
return -1;
}
if (xopts & XFS_QUOTA_UDQ_ACCT || xopts & XFS_QUOTA_GDQ_ACCT)
- acctstr = _("and accounting ");
- printf(_("Disabling %s quota enforcement %son %s\n"),
- type2name(type), acctstr, dev);
+ acctstr = _("and accounting ");
+ pinfo(_("Disabling %s quota enforcement %son %s\n"),
+ type2name(type), acctstr, dev);
return 1;
}
break;
@@ -146,10 +146,10 @@ static int xfs_onoff(char *dev, int type, int flags, int roothack, int xopts)
errstr(_("quotactl on %s: %s\n"), dev, strerror(errno));
return 1;
}
- if ((flags & STATEFLAG_VERBOSE) && qoff)
- printf(_("%s: %s quotas turned off\n"), dev, type2name(type));
- else if ((flags & STATEFLAG_VERBOSE) && !qoff)
- printf(_("%s: %s quotas turned on\n"), dev, type2name(type));
+ if (qoff)
+ pinfo(_("%s: %s quotas turned off\n"), dev, type2name(type));
+ else
+ pinfo(_("%s: %s quotas turned on\n"), dev, type2name(type));
return 0;
}
@@ -168,8 +168,7 @@ static int xfs_delete(char *dev, int type, int flags, int roothack, int xopts)
return 1;
}
- if (flags & STATEFLAG_VERBOSE)
- printf(_("%s: deleted %s quota blocks\n"), dev, type2name(type));
+ pinfo(_("%s: deleted %s quota blocks\n"), dev, type2name(type));
return 0;
}
diff --git a/warnquota.8 b/warnquota.8
index 89844ec..0d85f96 100644
--- a/warnquota.8
+++ b/warnquota.8
@@ -34,10 +34,8 @@ Original quota format with 16-bit UIDs / GIDs,
Quota format with 32-bit UIDs / GIDs, 64-bit space usage, 32-bit inode usage and limits,
.B vfsv1
Quota format with 64-bit quota limits and usage,
-.B rpc
-(quota over NFS),
.B xfs
-(quota on XFS filesystem)
+Quota on XFS filesystem.
.TP
.B -q, --quota-tab=\f2quotatab\f1
Use