1/*
2 * Copyright (c) 2007 Apple Inc.  All rights reserved.
3 *
4 * @APPLE_LICENSE_HEADER_START@
5 *
6 * This file contains Original Code and/or Modifications of Original Code
7 * as defined in and that are subject to the Apple Public Source License
8 * Version 2.0 (the 'License'). You may not use this file except in
9 * compliance with the License. Please obtain a copy of the License at
10 * http://www.opensource.apple.com/apsl/ and read it before using this
11 * file.
12 *
13 * The Original Code and all software distributed under the License are
14 * distributed on an 'AS IS' basis, WITHOUT WARRANTY OF ANY KIND, EITHER
15 * EXPRESS OR IMPLIED, AND APPLE HEREBY DISCLAIMS ALL SUCH WARRANTIES,
16 * INCLUDING WITHOUT LIMITATION, ANY WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE, QUIET ENJOYMENT OR NON-INFRINGEMENT.
18 * Please see the License for the specific language governing rights and
19 * limitations under the License.
20 *
21 * @APPLE_LICENSE_HEADER_END@
22 */
23/*
24 * Remote quota protocol
25 * Requires unix authentication
26 */
27
28#ifndef RPC_HDR
29%#include <sys/cdefs.h>
30%#ifndef __lint__
31%/*static char sccsid[] = "from: @(#)rquota.x 1.2 87/09/20 Copyr 1987 Sun Micro";*/
32%/*static char sccsid[] = "from: @(#)rquota.x	2.1 88/08/01 4.0 RPCSRC";*/
33%__RCSID("$NetBSD: rquota.x,v 1.6 2004/07/01 22:52:34 kleink Exp $");
34%#endif /* not __lint__ */
35#endif
36
37const RQ_PATHLEN = 1024;
38
39struct getquota_args {
40	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
41	int gqa_uid;	        	/* inquire about quota for uid */
42};
43
44const RQUOTA_MAXQUOTAS = 0x02;
45const RQUOTA_USRQUOTA = 0x00;
46const RQUOTA_GRPQUOTA = 0x01;
47
48struct ext_getquota_args {
49	string gqa_pathp<RQ_PATHLEN>;  	/* path to filesystem of interest */
50	int gqa_type;			/* type of quota */
51	int gqa_id;	        	/* inquire about quota for uid/gid */
52};
53
54/*
55 * remote quota structure
56 */
57struct rquota {
58	int rq_bsize;			/* block size for block counts */
59	bool rq_active;  		/* indicates whether quota is active */
60	unsigned int rq_bhardlimit;	/* absolute limit on disk blks alloc */
61	unsigned int rq_bsoftlimit;	/* preferred limit on disk blks */
62	unsigned int rq_curblocks;	/* current block count */
63	unsigned int rq_fhardlimit;	/* absolute limit on allocated files */
64	unsigned int rq_fsoftlimit;	/* preferred file limit */
65	unsigned int rq_curfiles;	/* current # allocated files */
66	unsigned int rq_btimeleft;	/* time left for excessive disk use */
67	unsigned int rq_ftimeleft;	/* time left for excessive files */
68};
69
70enum gqr_status {
71	Q_OK = 1,		/* quota returned */
72	Q_NOQUOTA = 2,  	/* noquota for uid */
73	Q_EPERM = 3		/* no permission to access quota */
74};
75
76union getquota_rslt switch (gqr_status status) {
77case Q_OK:
78	rquota gqr_rquota;	/* valid if status == Q_OK */
79case Q_NOQUOTA:
80	void;
81case Q_EPERM:
82	void;
83};
84
85program RQUOTAPROG {
86	version RQUOTAVERS {
87		/*
88		 * Get all quotas
89		 */
90		getquota_rslt
91		RQUOTAPROC_GETQUOTA(getquota_args) = 1;
92
93		/*
94	 	 * Get active quotas only
95		 */
96		getquota_rslt
97		RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
98	} = 1;
99	version EXT_RQUOTAVERS {
100		/*
101		 * Get all quotas
102		 */
103		getquota_rslt
104		RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1;
105
106		/*
107	 	 * Get active quotas only
108		 */
109		getquota_rslt
110		RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2;
111	} = 2;
112} = 100011;
113