summaryrefslogtreecommitdiff
path: root/quotaio_rpc.c
blob: 0e33390baf823d6ea22a0a573fb4d601d26f3758 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
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
}