1/*
2 * Remote quota protocol
3 * Requires unix authentication
4 */
5
6const RQ_PATHLEN = 1024;
7
8struct sq_dqblk {
9	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
10	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
11	unsigned int rq_curblocks;	/* current block count */
12	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
13	unsigned int rq_fsoftlimit;	/* preferred file limit */
14	unsigned int rq_curfiles;	/* current # allocated files */
15	unsigned int rq_btimeleft;	/* time left for excessive disk use */
16	unsigned int rq_ftimeleft;	/* time left for excessive files */
17};
18
19struct getquota_args {
20	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
21	int gqa_uid;			/* Inquire about quota for uid */
22};
23
24struct setquota_args {
25	int sqa_qcmd;
26	string sqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
27	int sqa_id;			/* Set quota for uid */
28	sq_dqblk sqa_dqblk;
29};
30
31struct ext_getquota_args {
32	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
33	int gqa_type;			/* Type of quota info is needed about */
34	int gqa_id;			/* Inquire about quota for id */
35};
36
37struct ext_setquota_args {
38	int sqa_qcmd;
39	string sqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
40	int sqa_id;			/* Set quota for id */
41	int sqa_type;			/* Type of quota to set */
42	sq_dqblk sqa_dqblk;
43};
44
45/*
46 * remote quota structure
47 */
48struct rquota {
49	int rq_bsize;			/* block size for block counts */
50	bool rq_active;  		/* indicates whether quota is active */
51	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
52	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
53	unsigned int rq_curblocks;	/* current block count */
54	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
55	unsigned int rq_fsoftlimit;	/* preferred file limit */
56	unsigned int rq_curfiles;	/* current # allocated files */
57	unsigned int rq_btimeleft;	/* time left for excessive disk use */
58	unsigned int rq_ftimeleft;	/* time left for excessive files */
59};
60
61enum gqr_status {
62	Q_OK = 1,		/* quota returned */
63	Q_NOQUOTA = 2,		/* noquota for uid */
64	Q_EPERM = 3		/* no permission to access quota */
65};
66
67union getquota_rslt switch (gqr_status status) {
68case Q_OK:
69	rquota gqr_rquota;	/* valid if status == Q_OK */
70case Q_NOQUOTA:
71	void;
72case Q_EPERM:
73	void;
74};
75
76union setquota_rslt switch (gqr_status status) {
77case Q_OK:
78	rquota sqr_rquota;	/* valid if status == Q_OK */
79case Q_NOQUOTA:
80	void;
81case Q_EPERM:
82	void;
83};
84
85program RQUOTAPROG {
86	version RQUOTAVERS {
87		/*
88		 * Get all quotas
89		 */
90		getquota_rslt
91		RQUOTAPROC_GETQUOTA(getquota_args) = 1;
92
93		/*
94	 	 * Get active quotas only
95		 */
96		getquota_rslt
97		RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
98
99		/*
100		 * Set all quotas
101		 */
102		setquota_rslt
103		RQUOTAPROC_SETQUOTA(setquota_args) = 3;
104
105		/*
106	 	 * Get active quotas only
107		 */
108		setquota_rslt
109		RQUOTAPROC_SETACTIVEQUOTA(setquota_args) = 4;
110	} = 1;
111	version EXT_RQUOTAVERS {
112		/*
113		 * Get all quotas
114		 */
115		getquota_rslt
116		RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1;
117
118		/*
119	 	 * Get active quotas only
120		 */
121		getquota_rslt
122		RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2;
123
124		/*
125		 * Set all quotas
126		 */
127		setquota_rslt
128		RQUOTAPROC_SETQUOTA(ext_setquota_args) = 3;
129
130		/*
131	 	 * Set active quotas only
132		 */
133		setquota_rslt
134		RQUOTAPROC_SETACTIVEQUOTA(ext_setquota_args) = 4;
135	} = 2;
136} = 100011;
137