summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--convertquota.c2
-rw-r--r--dqblk_v1.h2
-rw-r--r--dqblk_v2.h2
-rw-r--r--quotacheck.c4
-rw-r--r--quotaio.h7
-rw-r--r--quotaio_rpc.c4
-rw-r--r--quotaio_v1.c15
-rw-r--r--quotaio_v2.c13
-rw-r--r--quotaio_xfs.c4
-rw-r--r--quotaops.c4
-rw-r--r--rquota_server.c4
11 files changed, 42 insertions, 19 deletions
diff --git a/convertquota.c b/convertquota.c
index 5ce8244..f82a6b8 100644
--- a/convertquota.c
+++ b/convertquota.c
@@ -87,7 +87,7 @@ static int convert_dquot(struct dquot *dquot, char *name)
newdquot.dq_dqb.dqb_curspace = dquot->dq_dqb.dqb_curspace;
newdquot.dq_dqb.dqb_btime = dquot->dq_dqb.dqb_btime;
newdquot.dq_dqb.dqb_itime = dquot->dq_dqb.dqb_itime;
- if (qn->qh_ops->commit_dquot(&newdquot) < 0) {
+ if (qn->qh_ops->commit_dquot(&newdquot, COMMIT_ALL) < 0) {
errstr(_("Can't commit dquot for id %u (%s): %s\n"),
(uint)dquot->dq_id, name, strerror(errno));
return -1;
diff --git a/dqblk_v1.h b/dqblk_v1.h
index 4b3fa35..fe3d683 100644
--- a/dqblk_v1.h
+++ b/dqblk_v1.h
@@ -9,6 +9,8 @@
#define Q_V1_RSQUASH 0x1000
#define Q_V1_GETQUOTA 0x300
#define Q_V1_SETQUOTA 0x400
+#define Q_V1_SETUSE 0x500
+#define Q_V1_SETQLIM 0x700
#define Q_V1_GETSTATS 0x800
struct quotafile_ops; /* Will be defined later in quotaio.h */
diff --git a/dqblk_v2.h b/dqblk_v2.h
index 2a8c2b7..2172c17 100644
--- a/dqblk_v2.h
+++ b/dqblk_v2.h
@@ -11,6 +11,8 @@
#define Q_V2_GETQUOTA 0x0D00 /* Get limits and usage */
#define Q_V2_SETQUOTA 0x0E00 /* Set limits and usage */
+#define Q_V2_SETUSE 0x0F00 /* Set only usage */
+#define Q_V2_SETQLIM 0x0700 /* Set only limits */
#define Q_V2_GETINFO 0x0900 /* Get information about quota */
#define Q_V2_SETINFO 0x0A00 /* Set information about quota */
#define Q_V2_GETSTATS 0x1100 /* get collected stats (before proc was used) */
diff --git a/quotacheck.c b/quotacheck.c
index 9793990..1fb701e 100644
--- a/quotacheck.c
+++ b/quotacheck.c
@@ -8,7 +8,7 @@
* New quota format implementation - Jan Kara <jack@suse.cz> - Sponsored by SuSE CR
*/
-#ident "$Id: quotacheck.c,v 1.21 2001/09/27 10:38:03 jkar8572 Exp $"
+#ident "$Id: quotacheck.c,v 1.22 2001/09/27 21:34:57 jkar8572 Exp $"
#include <dirent.h>
#include <stdio.h>
@@ -686,7 +686,7 @@ static int dump_to_file(struct mntent *mnt, int type)
for (dquot = dquot_hash[type][i]; dquot; dquot = dquot->dq_next) {
dquot->dq_h = h;
update_grace_times(dquot);
- h->qh_ops->commit_dquot(dquot);
+ h->qh_ops->commit_dquot(dquot, COMMIT_ALL);
}
if (end_io(h) < 0) {
errstr(_("Cannot finish IO on new quotafile: %s\n"), strerror(errno));
diff --git a/quotaio.h b/quotaio.h
index e6bee75..22c6d8a 100644
--- a/quotaio.h
+++ b/quotaio.h
@@ -128,6 +128,11 @@ struct dquot {
struct util_dqblk dq_dqb; /* Parsed data of dquot */
};
+/* Flags for commit function (have effect only when quota in kernel is turned on) */
+#define COMMIT_USAGE 1
+#define COMMIT_LIMITS 2
+#define COMMIT_ALL (COMMIT_USAGE | COMMIT_LIMITS)
+
/* Structure of quotafile operations */
struct quotafile_ops {
int (*init_io) (struct quota_handle * h); /* Open quotafile */
@@ -135,7 +140,7 @@ struct quotafile_ops {
int (*end_io) (struct quota_handle * h); /* Write all changes and close quotafile */
int (*write_info) (struct quota_handle * h); /* Write info about quotafile */
struct dquot *(*read_dquot) (struct quota_handle * h, qid_t id); /* Read dquot into memory */
- int (*commit_dquot) (struct dquot * dquot); /* Write given dquot to disk */
+ int (*commit_dquot) (struct dquot * dquot, int flag); /* Write given dquot to disk */
int (*scan_dquots) (struct quota_handle * h, int (*process_dquot) (struct dquot * dquot, char * dqname)); /* Scan quotafile and call callback on every structure */
int (*report) (struct quota_handle * h, int verbose); /* Function called after 'repquota' to print format specific file information */
};
diff --git a/quotaio_rpc.c b/quotaio_rpc.c
index f02727d..258ccc7 100644
--- a/quotaio_rpc.c
+++ b/quotaio_rpc.c
@@ -14,7 +14,7 @@
#include "pot.h"
static struct dquot *rpc_read_dquot(struct quota_handle *h, qid_t id);
-static int rpc_commit_dquot(struct dquot *dquot);
+static int rpc_commit_dquot(struct dquot *dquot, int flags);
struct quotafile_ops quotafile_ops_rpc = {
NULL, /* init_io */
@@ -52,7 +52,7 @@ static struct dquot *rpc_read_dquot(struct quota_handle *h, qid_t id)
/*
* Write a dqblk struct to RPC server - just wrapper function.
*/
-static int rpc_commit_dquot(struct dquot *dquot)
+static int rpc_commit_dquot(struct dquot *dquot, int flags)
{
#ifdef RPC
int ret;
diff --git a/quotaio_v1.c b/quotaio_v1.c
index 4792c53..948d244 100644
--- a/quotaio_v1.c
+++ b/quotaio_v1.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaio_v1.c,v 1.9 2001/09/25 15:56:59 jkar8572 Exp $"
+#ident "$Id: quotaio_v1.c,v 1.10 2001/09/27 21:34:58 jkar8572 Exp $"
#include <unistd.h>
#include <errno.h>
@@ -52,7 +52,7 @@ static int v1_init_io(struct quota_handle *h);
static int v1_new_io(struct quota_handle *h);
static int v1_write_info(struct quota_handle *h);
static struct dquot *v1_read_dquot(struct quota_handle *h, qid_t id);
-static int v1_commit_dquot(struct dquot *dquot);
+static int v1_commit_dquot(struct dquot *dquot, int flags);
static int v1_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *dquot, char *dqname));
struct quotafile_ops quotafile_ops_1 = {
@@ -251,7 +251,7 @@ static struct dquot *v1_read_dquot(struct quota_handle *h, qid_t id)
* Write a dqblk struct to the quotafile.
* User can process use 'errno' to detect errstr
*/
-static int v1_commit_dquot(struct dquot *dquot)
+static int v1_commit_dquot(struct dquot *dquot, int flags)
{
struct v1_disk_dqblk ddqblk;
struct quota_handle *h = dquot->dq_h;
@@ -263,9 +263,16 @@ static int v1_commit_dquot(struct dquot *dquot)
}
if (QIO_ENABLED(h)) { /* Kernel uses same file? */
struct v1_kern_dqblk kdqblk;
+ int cmd;
+ if (flags == COMMIT_USAGE)
+ cmd = Q_V1_SETUSE;
+ else if (flags == COMMIT_LIMITS)
+ cmd = Q_V1_SETQLIM;
+ else
+ cmd = Q_V1_SETQUOTA;
v1_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
- if (quotactl(QCMD(Q_V1_SETQUOTA, h->qh_type), h->qh_quotadev, dquot->dq_id,
+ if (quotactl(QCMD(cmd, h->qh_type), h->qh_quotadev, dquot->dq_id,
(void *)&kdqblk) < 0)
return -1;
}
diff --git a/quotaio_v2.c b/quotaio_v2.c
index cd0d3c4..449c751 100644
--- a/quotaio_v2.c
+++ b/quotaio_v2.c
@@ -25,7 +25,7 @@ static int v2_init_io(struct quota_handle *h);
static int v2_new_io(struct quota_handle *h);
static int v2_write_info(struct quota_handle *h);
static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id);
-static int v2_commit_dquot(struct dquot *dquot);
+static int v2_commit_dquot(struct dquot *dquot, int flags);
static int v2_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *dquot, char *dqname));
static int v2_report(struct quota_handle *h, int verbose);
@@ -624,7 +624,7 @@ static struct dquot *v2_read_dquot(struct quota_handle *h, qid_t id)
* Commit changes of dquot to disk - it might also mean deleting it when quota became fake one and user has no blocks...
* User can process use 'errno' to detect errstr
*/
-static int v2_commit_dquot(struct dquot *dquot)
+static int v2_commit_dquot(struct dquot *dquot, int flags)
{
struct util_dqblk *b = &dquot->dq_dqb;
@@ -635,9 +635,16 @@ static int v2_commit_dquot(struct dquot *dquot)
}
if (QIO_ENABLED(dquot->dq_h)) {
struct v2_kern_dqblk kdqblk;
+ int cmd;
+ if (flags == COMMIT_USAGE)
+ cmd = Q_V2_SETUSE;
+ else if (flags == COMMIT_LIMITS)
+ cmd = Q_V2_SETQLIM;
+ else
+ cmd = Q_V2_SETQUOTA;
v2_util2kerndqblk(&kdqblk, &dquot->dq_dqb);
- if (quotactl(QCMD(Q_V2_SETQUOTA, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
+ if (quotactl(QCMD(cmd, dquot->dq_h->qh_type), dquot->dq_h->qh_quotadev,
dquot->dq_id, (void *)&kdqblk) < 0)
return -1;
return 0;
diff --git a/quotaio_xfs.c b/quotaio_xfs.c
index 256238e..15e75f6 100644
--- a/quotaio_xfs.c
+++ b/quotaio_xfs.c
@@ -27,7 +27,7 @@
static int xfs_init_io(struct quota_handle *h);
static int xfs_write_info(struct quota_handle *h);
static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id);
-static int xfs_commit_dquot(struct dquot *dquot);
+static int xfs_commit_dquot(struct dquot *dquot, int flags);
static int xfs_scan_dquots(struct quota_handle *h, int (*process_dquot) (struct dquot *dquot, char *dqname));
static int xfs_report(struct quota_handle *h, int verbose);
@@ -139,7 +139,7 @@ static struct dquot *xfs_read_dquot(struct quota_handle *h, qid_t id)
/*
* Write a dqblk struct to the XFS quota manager
*/
-static int xfs_commit_dquot(struct dquot *dquot)
+static int xfs_commit_dquot(struct dquot *dquot, int flags)
{
struct quota_handle *h = dquot->dq_h;
struct xfs_kern_dqblk xdqblk;
diff --git a/quotaops.c b/quotaops.c
index 338cdf3..71628d4 100644
--- a/quotaops.c
+++ b/quotaops.c
@@ -34,7 +34,7 @@
#ident "$Copyright: (c) 1980, 1990 Regents of the University of California. $"
#ident "$Copyright: All rights reserved. $"
-#ident "$Id: quotaops.c,v 1.6 2001/08/22 21:17:56 jkar8572 Exp $"
+#ident "$Id: quotaops.c,v 1.7 2001/09/27 21:34:58 jkar8572 Exp $"
#include <rpc/rpc.h>
#include <sys/types.h>
@@ -176,7 +176,7 @@ int putprivs(struct dquot *qlist)
struct dquot *q;
for (q = qlist; q; q = q->dq_next) {
- if (q->dq_h->qh_ops->commit_dquot(q) == -1) {
+ if (q->dq_h->qh_ops->commit_dquot(q, COMMIT_LIMITS) == -1) {
errstr(_("Can't write quota for %u on %s: %s\n"),
q->dq_id, q->dq_h->qh_quotadev, strerror(errno));
continue;
diff --git a/rquota_server.c b/rquota_server.c
index 8956a1d..43bd292 100644
--- a/rquota_server.c
+++ b/rquota_server.c
@@ -9,7 +9,7 @@
*
* This part does the lookup of the info.
*
- * Version: $Id: rquota_server.c,v 1.8 2001/08/22 21:17:56 jkar8572 Exp $
+ * Version: $Id: rquota_server.c,v 1.9 2001/09/27 21:34:58 jkar8572 Exp $
*
* Author: Marco van Wieringen <mvw@planets.elm.net>
*
@@ -183,7 +183,7 @@ setquota_rslt *setquotainfo(int flags, caddr_t * argp, struct svc_req *rqstp)
dquot->dq_dqb.dqb_curspace = dqblk.dqb_curspace;
dquot->dq_dqb.dqb_curinodes = dqblk.dqb_curinodes;
}
- if (handles[0]->qh_ops->commit_dquot(dquot) == -1)
+ if (handles[0]->qh_ops->commit_dquot(dquot, COMMIT_LIMITS) == -1)
goto out;
result.status = Q_OK;
out: