xref: /netbsd/lib/librpcsvc/rquota.x (revision 6550d01e)
1 /*
2  * Remote quota protocol
3  * Requires unix authentication
4  */
5 
6 #ifndef RPC_HDR
7 %#include <sys/cdefs.h>
8 %#ifndef __lint__
9 %/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
10 %/*static char sccsid[] = "from: @(#)rquota.x	2.1 88/08/01 4.0 RPCSRC";*/
11 %__RCSID("$NetBSD: rquota.x,v 1.6 2004/07/01 22:52:34 kleink Exp $");
12 %#endif /* not __lint__ */
13 #endif
14 
15 const RQ_PATHLEN = 1024;
16 
17 struct getquota_args {
18 	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
19 	int gqa_uid;	        	/* inquire about quota for uid */
20 };
21 
22 const RQUOTA_MAXQUOTAS = 0x02;
23 const RQUOTA_USRQUOTA = 0x00;
24 const RQUOTA_GRPQUOTA = 0x01;
25 
26 struct ext_getquota_args {
27 	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
28 	int gqa_type;			/* type of quota */
29 	int gqa_id;	        	/* inquire about quota for uid/gid */
30 };
31 
32 /*
33  * remote quota structure
34  */
35 struct rquota {
36 	int rq_bsize;			/* block size for block counts */
37 	bool rq_active;  		/* indicates whether quota is active */
38 	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
39 	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
40 	unsigned int rq_curblocks;	/* current block count */
41 	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
42 	unsigned int rq_fsoftlimit;	/* preferred file limit */
43 	unsigned int rq_curfiles;	/* current # allocated files */
44 	unsigned int rq_btimeleft;	/* time left for excessive disk use */
45 	unsigned int rq_ftimeleft;	/* time left for excessive files */
46 };
47 
48 enum gqr_status {
49 	Q_OK = 1,		/* quota returned */
50 	Q_NOQUOTA = 2,  	/* noquota for uid */
51 	Q_EPERM = 3		/* no permission to access quota */
52 };
53 
54 union getquota_rslt switch (gqr_status status) {
55 case Q_OK:
56 	rquota gqr_rquota;	/* valid if status == Q_OK */
57 case Q_NOQUOTA:
58 	void;
59 case Q_EPERM:
60 	void;
61 };
62 
63 program RQUOTAPROG {
64 	version RQUOTAVERS {
65 		/*
66 		 * Get all quotas
67 		 */
68 		getquota_rslt
69 		RQUOTAPROC_GETQUOTA(getquota_args) = 1;
70 
71 		/*
72 	 	 * Get active quotas only
73 		 */
74 		getquota_rslt
75 		RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
76 	} = 1;
77 	version EXT_RQUOTAVERS {
78 		/*
79 		 * Get all quotas
80 		 */
81 		getquota_rslt
82 		RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1;
83 
84 		/*
85 	 	 * Get active quotas only
86 		 */
87 		getquota_rslt
88 		RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2;
89 	} = 2;
90 } = 100011;
91