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