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