summaryrefslogtreecommitdiff
path: root/quotaio_rpc.c
diff options
context:
space:
mode:
authorjkar8572 <jkar8572>2001-03-23 12:03:26 +0000
committerjkar8572 <jkar8572>2001-03-23 12:03:26 +0000
commit869fe242340fefe0540fdcf51698ba4c3c8c07bb (patch)
tree950fa3f5997c1e8ee68c0f17d4eaf17abef64f34 /quotaio_rpc.c
Initial revision
Diffstat (limited to 'quotaio_rpc.c')
-rw-r--r--quotaio_rpc.c55
1 files changed, 55 insertions, 0 deletions
diff --git a/quotaio_rpc.c b/quotaio_rpc.c
new file mode 100644
index 0000000..0e33390
--- /dev/null
+++ b/quotaio_rpc.c
@@ -0,0 +1,55 @@
+/*
+ * quotaio_rpc.c - quota IO operations for RPC (just wrappers for RPC calls)
+ */
+
+#include <stdio.h>
+#include <sys/types.h>
+
+#include "quotaio.h"
+#include "dqblk_rpc.h"
+#include "rquota_client.h"
+
+static struct dquot *rpc_read_dquot(struct quota_handle *h, qid_t id);
+static int rpc_commit_dquot(struct dquot *dquot);
+
+struct quotafile_ops quotafile_ops_rpc = {
+ NULL, /* init_io */
+ NULL, /* new_io */
+ NULL, /* end_io */
+ NULL, /* write_info */
+ rpc_read_dquot,
+ rpc_commit_dquot,
+ NULL /* scan_dquots */
+};
+
+/*
+ * Read a dqblk struct from RPC server - just wrapper function.
+ */
+static struct dquot *rpc_read_dquot(struct quota_handle *h, qid_t id)
+{
+#ifdef RPC
+ struct dquot *dquot = get_empty_dquot();
+
+ dquot->dq_id = id;
+ dquot->dq_h = h;
+ rpc_rquota_get(dquot);
+ return dquot;
+#else
+ errno = ENOTSUP;
+ return NULL;
+#endif
+}
+
+/*
+ * Write a dqblk struct to RPC server - just wrapper function.
+ */
+static int rpc_commit_dquot(struct dquot *dquot)
+{
+#ifdef RPC
+ rpc_rquota_set(QCMD(Q_RPC_SETQUOTA, dquot->dq_h->qh_type), dquot);
+ return 0;
+#else
+ errno = ENOTSUP;
+ return -1;
+#endif
+}