summaryrefslogtreecommitdiff
path: root/extra/quota-tools/quotaon.diff
diff options
context:
space:
mode:
Diffstat (limited to 'extra/quota-tools/quotaon.diff')
-rw-r--r--extra/quota-tools/quotaon.diff216
1 files changed, 0 insertions, 216 deletions
diff --git a/extra/quota-tools/quotaon.diff b/extra/quota-tools/quotaon.diff
deleted file mode 100644
index 6a43cee6c..000000000
--- a/extra/quota-tools/quotaon.diff
+++ /dev/null
@@ -1,216 +0,0 @@
-# Description: Fix quotaon to work with XFS and print all informational messages only in verbose mode
-# Author: Jan Kara
-
-diff -u quota/quotaon.c quota-tools/quotaon.c
---- quota/quotaon.c 2010-07-28 11:14:02.000000000 +0200
-+++ quota-tools/quotaon.c 2010-06-15 10:11:30.000000000 +0200
-@@ -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 @@
- }
- }
-
-+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 @@
- 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 @@
- 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 @@
- 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 @@
- 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;
-
-@@ -281,10 +291,7 @@
- errstr(_("Cannot change state of XFS quota. It's not compiled in kernel.\n"));
- return 1;
- }
-- if ((flags & FL_OFF && (kern_quota_on(mnt->mnt_fsname, USRQUOTA, QF_XFS) != -1
-- || kern_quota_on(mnt->mnt_fsname, GRPQUOTA, QF_XFS) != -1))
-- || (!(flags & FL_OFF) && kern_quota_on(mnt->mnt_fsname, type, QF_XFS) == -1))
-- ret = xfs_newstate(mnt, type, extra, sflags);
-+ ret = xfs_newstate(mnt, type, extra, sflags);
- }
- else if (meta_qf_fstype(mnt->mnt_type)) {
- if (!hasquota(mnt, type, 0))
-@@ -376,7 +383,7 @@
- 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 -u quota/quotaon.h quota-tools/quotaon.h
---- quota/quotaon.h 2010-02-18 09:44:11.000000000 +0100
-+++ quota-tools/quotaon.h 2010-06-12 12:06:08.000000000 +0200
-@@ -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 -u quota/quotaon_xfs.c quota-tools/quotaon_xfs.c
---- quota/quotaon_xfs.c 2010-07-26 18:48:24.000000000 +0200
-+++ quota-tools/quotaon_xfs.c 2010-06-15 10:11:30.000000000 +0200
-@@ -59,8 +59,8 @@
- 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 @@
- 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 @@
- 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 @@
- 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 @@
- 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 @@
- 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;
- }
-
-@@ -208,16 +207,12 @@
- }
- #endif /* XFS_ROOTHACK */
-
-- if (xarg == NULL) { /* both acct & enfd on/off */
-- xopts |= (type == USRQUOTA) ?
-- (XFS_QUOTA_UDQ_ACCT | XFS_QUOTA_UDQ_ENFD) :
-- (XFS_QUOTA_GDQ_ACCT | XFS_QUOTA_GDQ_ENFD);
-+ if (xarg == NULL) { /* only enfd on/off */
-+ xopts |= (type == USRQUOTA) ? XFS_QUOTA_UDQ_ENFD :
-+ XFS_QUOTA_GDQ_ENFD;
- err = xfs_onoff((char *)dev, type, flags, roothack, xopts);
- }
- else if (strcmp(xarg, "account") == 0) {
-- /* only useful if we want root accounting only */
-- if (!roothack || !(flags & STATEFLAG_ON))
-- goto done;
- xopts |= (type == USRQUOTA) ? XFS_QUOTA_UDQ_ACCT : XFS_QUOTA_GDQ_ACCT;
- err = xfs_onoff((char *)dev, type, flags, roothack, xopts);
- }
-@@ -231,7 +226,6 @@
- }
- else
- die(1, _("Invalid argument \"%s\"\n"), xarg);
-- done:
- free((char *)dev);
- return err;
- }