Initial revision
[nfs-utils.git] / utils / rquotad / rquota.x
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 #ifdef RPC_CLNT
10 %#include <string.h>
11 #endif
12
13 const RQ_PATHLEN = 1024;
14
15 struct getquota_args {
16         string gqa_pathp<RQ_PATHLEN>;   /* path to filesystem of interest */
17         int gqa_uid;                    /* Inquire about quota for uid */
18 };
19
20 struct ext_getquota_args {
21         string gqa_pathp<RQ_PATHLEN>;   /* path to filesystem of interest */
22         int gqa_type;                   /* Type of quota info is needed about */
23         int gqa_id;                     /* Inquire about quota for id */
24 };
25
26 /*
27  * remote quota structure
28  */
29 struct rquota {
30         int rq_bsize;                   /* block size for block counts */
31         bool rq_active;                 /* indicates whether quota is active */
32         unsigned int rq_bhardlimit;     /* absolute limit on disk blks alloc */
33         unsigned int rq_bsoftlimit;     /* preferred limit on disk blks */
34         unsigned int rq_curblocks;      /* current block count */
35         unsigned int rq_fhardlimit;     /* absolute limit on allocated files */
36         unsigned int rq_fsoftlimit;     /* preferred file limit */
37         unsigned int rq_curfiles;       /* current # allocated files */
38         unsigned int rq_btimeleft;      /* time left for excessive disk use */
39         unsigned int rq_ftimeleft;      /* time left for excessive files */
40 };      
41
42 enum gqr_status {
43         Q_OK = 1,       /* quota returned */
44         Q_NOQUOTA = 2,  /* noquota for uid */
45         Q_EPERM = 3     /* no permission to access quota */
46 };
47
48 union getquota_rslt switch (gqr_status status) {
49 case Q_OK:
50         rquota gqr_rquota;      /* valid if status == Q_OK */
51 case Q_NOQUOTA:
52         void;
53 case Q_EPERM:
54         void;
55 };
56
57 program RQUOTAPROG {
58         version RQUOTAVERS {
59                 /*
60                  * Get all quotas
61                  */
62                 getquota_rslt
63                 RQUOTAPROC_GETQUOTA(getquota_args) = 1;
64
65                 /*
66                  * Get active quotas only
67                  */
68                 getquota_rslt
69                 RQUOTAPROC_GETACTIVEQUOTA(getquota_args) = 2;
70         } = 1;
71         version EXT_RQUOTAVERS {
72                 /*
73                  * Get all quotas
74                  */
75                 getquota_rslt
76                 RQUOTAPROC_GETQUOTA(ext_getquota_args) = 1;
77
78                 /*
79                  * Get active quotas only
80                  */
81                 getquota_rslt
82                 RQUOTAPROC_GETACTIVEQUOTA(ext_getquota_args) = 2;
83         } = 2;
84 } = 100011;