summaryrefslogtreecommitdiff
path: root/extra/quota-tools/repquota.diff
diff options
context:
space:
mode:
Diffstat (limited to 'extra/quota-tools/repquota.diff')
-rw-r--r--extra/quota-tools/repquota.diff91
1 files changed, 91 insertions, 0 deletions
diff --git a/extra/quota-tools/repquota.diff b/extra/quota-tools/repquota.diff
new file mode 100644
index 000000000..3d79497d9
--- /dev/null
+++ b/extra/quota-tools/repquota.diff
@@ -0,0 +1,91 @@
+# Description: fix repquota to get latest quota info header
+# Author: Jan Kara
+
+diff -u quota/quotaio.c quota-tools/quotaio.c
+--- quota/quotaio.c 2010-07-28 11:14:02.000000000 +0200
++++ quota-tools/quotaio.c 2010-05-28 09:05:21.000000000 +0200
+@@ -147,6 +147,15 @@
+ }
+ }
+ if (!QIO_ENABLED(h) || flags & IOI_OPENFILE) { /* Need to open file? */
++ if (QIO_ENABLED(h)) { /* Kernel uses same file? */
++ unsigned int cmd =
++ (kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC;
++ if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev,
++ 0, NULL) < 0) {
++ die(4, _("Cannot sync quotas on device %s: %s\n"),
++ h->qh_quotadev, strerror(errno));
++ }
++ }
+ /* We still need to open file for operations like 'repquota' */
+ if ((fd = open(qfname, QIO_RO(h) ? O_RDONLY : O_RDWR)) < 0) {
+ errstr(_("Cannot open quotafile %s: %s\n"),
+diff -u quota/quotaio_v1.c quota-tools/quotaio_v1.c
+--- quota/quotaio_v1.c 2010-07-26 18:48:24.000000000 +0200
++++ quota-tools/quotaio_v1.c 2010-05-28 09:05:23.000000000 +0200
+@@ -348,11 +348,6 @@
+ struct dquot *dquot = get_empty_dquot();
+ qid_t id = 0;
+
+- if (QIO_ENABLED(h)) /* Kernel uses same file? */
+- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
+- h->qh_quotadev, 0, NULL) < 0)
+- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
+- strerror(errno));
+ memset(dquot, 0, sizeof(*dquot));
+ dquot->dq_h = h;
+ lseek(h->qh_fd, 0, SEEK_SET);
+diff -u quota/quotaio_v2.c quota-tools/quotaio_v2.c
+--- quota/quotaio_v2.c 2010-02-18 09:44:11.000000000 +0100
++++ quota-tools/quotaio_v2.c 2010-05-28 09:05:23.000000000 +0200
+@@ -484,11 +484,6 @@
+
+ static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *, char *))
+ {
+- if (QIO_ENABLED(h)) /* Kernel uses same file? */
+- if (quotactl(QCMD((kernel_iface == IFACE_GENERIC) ? Q_SYNC : Q_6_5_SYNC, h->qh_type),
+- h->qh_quotadev, 0, NULL) < 0)
+- die(4, _("Cannot sync quotas on device %s: %s\n"), h->qh_quotadev,
+- strerror(errno));
+ return qtree_scan_dquots(h, process_dquot);
+ }
+
+diff -u quota/quotasys.c quota-tools/quotasys.c
+--- quota/quotasys.c 2010-07-28 11:14:02.000000000 +0200
++++ quota-tools/quotasys.c 2010-06-15 10:11:30.000000000 +0200
+@@ -861,22 +861,23 @@
+ if (kernel_iface == IFACE_GENERIC) {
+ int actfmt;
+
+- if (quotactl(QCMD(Q_GETFMT, type), dev, 0, (void *)&actfmt) < 0)
+- return -1;
+- actfmt = kern2utilfmt(actfmt);
+- if (actfmt < 0)
+- return -1;
+- return actfmt;
++ if (quotactl(QCMD(Q_GETFMT, type), dev, 0,
++ (void *)&actfmt) >= 0) {
++ actfmt = kern2utilfmt(actfmt);
++ if (actfmt >= 0)
++ return actfmt;
++ }
++ } else {
++ if ((fmt == -1 || fmt == QF_VFSV0) &&
++ v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
++ return QF_VFSV0;
++ if ((fmt == -1 || fmt == QF_VFSOLD) &&
++ v1_kern_quota_on(dev, type)) /* Old quota format */
++ return QF_VFSOLD;
+ }
+- if ((fmt == -1 || fmt == QF_VFSV0) &&
+- v2_kern_quota_on(dev, type)) /* VFSv0 quota format */
+- return QF_VFSV0;
+ if ((fmt == -1 || fmt == QF_XFS) &&
+ xfs_kern_quota_on(dev, type)) /* XFS quota format */
+ return QF_XFS;
+- if ((fmt == -1 || fmt == QF_VFSOLD) &&
+- v1_kern_quota_on(dev, type)) /* Old quota format */
+- return QF_VFSOLD;
+ return -1;
+ }
+