xref: /illumos-gate/usr/src/head/rpcsvc/rquota.x (revision e13f92368d64a8efb300e6217cc0931bf766e6d4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  *
22  * Copyright 1987 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 /*
27  * Remote quota protocol
28  * Requires unix authentication
29  */
30 
31 const RQ_PATHLEN = 1024;
32 
33 struct getquota_args {
34 	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
35 	int32_t gqa_uid;        	/* inquire about quota for uid */
36 };
37 
38 /*
39  * remote quota structure
40  */
41 struct rquota {
42 	int32_t rq_bsize;		/* block size for block counts */
43 	bool rq_active;  		/* indicates whether quota is active */
44 	uint32_t rq_bhardlimit;		/* absolute limit on disk blks alloc */
45 	uint32_t rq_bsoftlimit;		/* preferred limit on disk blks */
46 	uint32_t rq_curblocks;		/* current block count */
47 	uint32_t rq_fhardlimit;		/* absolute limit on allocated files */
48 	uint32_t rq_fsoftlimit;		/* preferred file limit */
49 	uint32_t rq_curfiles;		/* current # allocated files */
50 	uint32_t rq_btimeleft;		/* time left for excessive disk use */
51 	uint32_t rq_ftimeleft;		/* time left for excessive files */
52 };
53 
54 enum gqr_status {
55 	Q_OK = 1,		/* quota returned */
56 	Q_NOQUOTA = 2,  	/* noquota for uid */
57 	Q_EPERM = 3		/* no permission to access quota */
58 };
59 
60 union getquota_rslt switch (gqr_status status) {
61 case Q_OK:
62 	rquota gqr_rquota;	/* valid if status == Q_OK */
63 case Q_NOQUOTA:
64 	void;
65 case Q_EPERM:
66 	void;
67 };
68 
69 program RQUOTAPROG {
70 	version RQUOTAVERS {
71 		/*
72 		 * Get all quotas
73 		 */
74 		getquota_rslt
75 		RQUOTAPROC_GETQUOTA(getquota_args) = 1;
76 
77 		/*
78 	 	 * Get active quotas only
79 		 */
80 		getquota_rslt
81 		RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
82 	} = 1;
83 } = 100011;
84