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