xref: /freebsd/include/rpcsvc/rquota.x (revision 5b31cc94b10d4bb7109c6b27940a0fc76a44a331)
175b63130SGarrett Wollman /*
275b63130SGarrett Wollman  * Remote quota protocol
375b63130SGarrett Wollman  * Requires unix authentication
475b63130SGarrett Wollman  */
575b63130SGarrett Wollman 
675b63130SGarrett Wollman const RQ_PATHLEN = 1024;
775b63130SGarrett Wollman 
8*aad5531eSSean Eric Fagan struct sq_dqblk {
9*aad5531eSSean Eric Fagan 	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
10*aad5531eSSean Eric Fagan 	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
11*aad5531eSSean Eric Fagan 	unsigned int rq_curblocks;	/* current block count */
12*aad5531eSSean Eric Fagan 	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
13*aad5531eSSean Eric Fagan 	unsigned int rq_fsoftlimit;	/* preferred file limit */
14*aad5531eSSean Eric Fagan 	unsigned int rq_curfiles;	/* current # allocated files */
15*aad5531eSSean Eric Fagan 	unsigned int rq_btimeleft;	/* time left for excessive disk use */
16*aad5531eSSean Eric Fagan 	unsigned int rq_ftimeleft;	/* time left for excessive files */
17*aad5531eSSean Eric Fagan };
18*aad5531eSSean Eric Fagan 
1975b63130SGarrett Wollman struct getquota_args {
2075b63130SGarrett Wollman 	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
21*aad5531eSSean Eric Fagan 	int gqa_uid;			/* Inquire about quota for uid */
22*aad5531eSSean Eric Fagan };
23*aad5531eSSean Eric Fagan 
24*aad5531eSSean Eric Fagan struct setquota_args {
25*aad5531eSSean Eric Fagan 	int sqa_qcmd;
26*aad5531eSSean Eric Fagan 	string sqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
27*aad5531eSSean Eric Fagan 	int sqa_id;			/* Set quota for uid */
28*aad5531eSSean Eric Fagan 	sq_dqblk sqa_dqblk;
29*aad5531eSSean Eric Fagan };
30*aad5531eSSean Eric Fagan 
31*aad5531eSSean Eric Fagan struct ext_getquota_args {
32*aad5531eSSean Eric Fagan 	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
33*aad5531eSSean Eric Fagan 	int gqa_type;			/* Type of quota info is needed about */
34*aad5531eSSean Eric Fagan 	int gqa_id;			/* Inquire about quota for id */
35*aad5531eSSean Eric Fagan };
36*aad5531eSSean Eric Fagan 
37*aad5531eSSean Eric Fagan struct ext_setquota_args {
38*aad5531eSSean Eric Fagan 	int sqa_qcmd;
39*aad5531eSSean Eric Fagan 	string sqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
40*aad5531eSSean Eric Fagan 	int sqa_id;			/* Set quota for id */
41*aad5531eSSean Eric Fagan 	int sqa_type;			/* Type of quota to set */
42*aad5531eSSean Eric Fagan 	sq_dqblk sqa_dqblk;
4375b63130SGarrett Wollman };
4475b63130SGarrett Wollman 
4575b63130SGarrett Wollman /*
4675b63130SGarrett Wollman  * remote quota structure
4775b63130SGarrett Wollman  */
4875b63130SGarrett Wollman struct rquota {
4975b63130SGarrett Wollman 	int rq_bsize;			/* block size for block counts */
5075b63130SGarrett Wollman 	bool rq_active;  		/* indicates whether quota is active */
5175b63130SGarrett Wollman 	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
5275b63130SGarrett Wollman 	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
5375b63130SGarrett Wollman 	unsigned int rq_curblocks;	/* current block count */
5475b63130SGarrett Wollman 	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
5575b63130SGarrett Wollman 	unsigned int rq_fsoftlimit;	/* preferred file limit */
5675b63130SGarrett Wollman 	unsigned int rq_curfiles;	/* current # allocated files */
5775b63130SGarrett Wollman 	unsigned int rq_btimeleft;	/* time left for excessive disk use */
5875b63130SGarrett Wollman 	unsigned int rq_ftimeleft;	/* time left for excessive files */
5975b63130SGarrett Wollman };
6075b63130SGarrett Wollman 
6175b63130SGarrett Wollman enum gqr_status {
6275b63130SGarrett Wollman 	Q_OK = 1,		/* quota returned */
6375b63130SGarrett Wollman 	Q_NOQUOTA = 2,		/* noquota for uid */
6475b63130SGarrett Wollman 	Q_EPERM = 3		/* no permission to access quota */
6575b63130SGarrett Wollman };
6675b63130SGarrett Wollman 
6775b63130SGarrett Wollman union getquota_rslt switch (gqr_status status) {
6875b63130SGarrett Wollman case Q_OK:
6975b63130SGarrett Wollman 	rquota gqr_rquota;	/* valid if status == Q_OK */
7075b63130SGarrett Wollman case Q_NOQUOTA:
7175b63130SGarrett Wollman 	void;
7275b63130SGarrett Wollman case Q_EPERM:
7375b63130SGarrett Wollman 	void;
7475b63130SGarrett Wollman };
7575b63130SGarrett Wollman 
76*aad5531eSSean Eric Fagan union setquota_rslt switch (gqr_status status) {
77*aad5531eSSean Eric Fagan case Q_OK:
78*aad5531eSSean Eric Fagan 	rquota sqr_rquota;	/* valid if status == Q_OK */
79*aad5531eSSean Eric Fagan case Q_NOQUOTA:
80*aad5531eSSean Eric Fagan 	void;
81*aad5531eSSean Eric Fagan case Q_EPERM:
82*aad5531eSSean Eric Fagan 	void;
83*aad5531eSSean Eric Fagan };
84*aad5531eSSean Eric Fagan 
8575b63130SGarrett Wollman program RQUOTAPROG {
8675b63130SGarrett Wollman 	version RQUOTAVERS {
8775b63130SGarrett Wollman 		/*
8875b63130SGarrett Wollman 		 * Get all quotas
8975b63130SGarrett Wollman 		 */
9075b63130SGarrett Wollman 		getquota_rslt
9175b63130SGarrett Wollman 		RQUOTAPROC_GETQUOTA(getquota_args) = 1;
9275b63130SGarrett Wollman 
9375b63130SGarrett Wollman 		/*
9475b63130SGarrett Wollman 	 	 * Get active quotas only
9575b63130SGarrett Wollman 		 */
9675b63130SGarrett Wollman 		getquota_rslt
9775b63130SGarrett Wollman 		RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
98*aad5531eSSean Eric Fagan 
99*aad5531eSSean Eric Fagan 		/*
100*aad5531eSSean Eric Fagan 		 * Set all quotas
101*aad5531eSSean Eric Fagan 		 */
102*aad5531eSSean Eric Fagan 		setquota_rslt
103*aad5531eSSean Eric Fagan 		RQUOTAPROC_SETQUOTA(setquota_args) = 3;
104*aad5531eSSean Eric Fagan 
105*aad5531eSSean Eric Fagan 		/*
106*aad5531eSSean Eric Fagan 	 	 * Get active quotas only
107*aad5531eSSean Eric Fagan 		 */
108*aad5531eSSean Eric Fagan 		setquota_rslt
109*aad5531eSSean Eric Fagan 		RQUOTAPROC_SETACTIVEQUOTA(setquota_args) = 4;
11075b63130SGarrett Wollman 	} = 1;
111*aad5531eSSean Eric Fagan 	version EXT_RQUOTAVERS {
112*aad5531eSSean Eric Fagan 		/*
113*aad5531eSSean Eric Fagan 		 * Get all quotas
114*aad5531eSSean Eric Fagan 		 */
115*aad5531eSSean Eric Fagan 		getquota_rslt
116*aad5531eSSean Eric Fagan 		RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1;
117*aad5531eSSean Eric Fagan 
118*aad5531eSSean Eric Fagan 		/*
119*aad5531eSSean Eric Fagan 	 	 * Get active quotas only
120*aad5531eSSean Eric Fagan 		 */
121*aad5531eSSean Eric Fagan 		getquota_rslt
122*aad5531eSSean Eric Fagan 		RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2;
123*aad5531eSSean Eric Fagan 
124*aad5531eSSean Eric Fagan 		/*
125*aad5531eSSean Eric Fagan 		 * Set all quotas
126*aad5531eSSean Eric Fagan 		 */
127*aad5531eSSean Eric Fagan 		setquota_rslt
128*aad5531eSSean Eric Fagan 		RQUOTAPROC_SETQUOTA(ext_setquota_args) = 3;
129*aad5531eSSean Eric Fagan 
130*aad5531eSSean Eric Fagan 		/*
131*aad5531eSSean Eric Fagan 	 	 * Set active quotas only
132*aad5531eSSean Eric Fagan 		 */
133*aad5531eSSean Eric Fagan 		setquota_rslt
134*aad5531eSSean Eric Fagan 		RQUOTAPROC_SETACTIVEQUOTA(ext_setquota_args) = 4;
135*aad5531eSSean Eric Fagan 	} = 2;
13675b63130SGarrett Wollman } = 100011;
137