| 1 | /* |
| 2 | Copyright (c) 2014, Ronnie Sahlberg |
| 3 | All rights reserved. |
| 4 | |
| 5 | Redistribution and use in source and binary forms, with or without |
| 6 | modification, are permitted provided that the following conditions are met: |
| 7 | |
| 8 | 1. Redistributions of source code must retain the above copyright notice, this |
| 9 | list of conditions and the following disclaimer. |
| 10 | 2. Redistributions in binary form must reproduce the above copyright notice, |
| 11 | this list of conditions and the following disclaimer in the documentation |
| 12 | and/or other materials provided with the distribution. |
| 13 | |
| 14 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND |
| 15 | ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 16 | WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
| 17 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR |
| 18 | ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
| 19 | (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
| 20 | LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND |
| 21 | ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 22 | (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS |
| 23 | SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 24 | |
| 25 | The views and conclusions contained in the software and documentation are those |
| 26 | of the authors and should not be interpreted as representing official policies, |
| 27 | either expressed or implied, of the FreeBSD Project. |
| 28 | */ |
| 29 | |
| 30 | const RQUOTAPATHLEN = 1024; /* Guess this is max. It is max for mount so probably rquota too */ |
| 31 | |
| 32 | enum rquotastat { |
| 33 | RQUOTA_OK = 1, |
| 34 | RQUOTA_NOQUOTA = 2, |
| 35 | RQUOTA_EPERM = 3 |
| 36 | }; |
| 37 | |
| 38 | typedef string exportpath<RQUOTAPATHLEN>; |
| 39 | |
| 40 | struct GETQUOTA1args { |
| 41 | exportpath export; |
| 42 | int uid; |
| 43 | }; |
| 44 | |
| 45 | enum quotatype { |
| 46 | RQUOTA_TYPE_UID = 0, |
| 47 | RQUOTA_TYPE_GID = 1 |
| 48 | }; |
| 49 | |
| 50 | struct GETQUOTA2args { |
| 51 | exportpath export; |
| 52 | quotatype type; |
| 53 | int uid; |
| 54 | }; |
| 55 | |
| 56 | struct GETQUOTA1res_ok { |
| 57 | int bsize; |
| 58 | int active; |
| 59 | int bhardlimit; |
| 60 | int bsoftlimit; |
| 61 | int curblocks; |
| 62 | int fhardlimit; |
| 63 | int fsoftlimit; |
| 64 | int curfiles; |
| 65 | int btimeleft; |
| 66 | int ftimeleft; |
| 67 | }; |
| 68 | |
| 69 | union GETQUOTA1res switch (rquotastat status) { |
| 70 | case RQUOTA_OK: |
| 71 | GETQUOTA1res_ok quota; |
| 72 | default: |
| 73 | void; |
| 74 | }; |
| 75 | |
| 76 | program RQUOTA_PROGRAM { |
| 77 | version RQUOTA_V1 { |
| 78 | void |
| 79 | RQUOTA1_NULL(void) = 0; |
| 80 | |
| 81 | GETQUOTA1res |
| 82 | RQUOTA1_GETQUOTA(GETQUOTA1args) = 1; |
| 83 | |
| 84 | GETQUOTA1res |
| 85 | RQUOTA1_GETACTIVEQUOTA(GETQUOTA1args) = 2; |
| 86 | } = 1; |
| 87 | |
| 88 | version RQUOTA_V2 { |
| 89 | void |
| 90 | RQUOTA2_NULL(void) = 0; |
| 91 | |
| 92 | GETQUOTA1res |
| 93 | RQUOTA2_GETQUOTA(GETQUOTA2args) = 1; |
| 94 | |
| 95 | GETQUOTA1res |
| 96 | RQUOTA2_GETACTIVEQUOTA(GETQUOTA2args) = 2; |
| 97 | } = 2; |
| 98 | } = 100011; |
| 99 | |