Imported Upstream version 1.9.4
[deb_libnfs.git] / rquota / libnfs-raw-rquota.c
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 /*
31 * Please do not edit this file.
32 * It was generated using rpcgen.
33 */
34
35 #include "libnfs-zdr.h"
36 #include "libnfs-raw-rquota.h"
37
38 bool_t
39 zdr_rquotastat (ZDR *zdrs, rquotastat *objp)
40 {
41 register int32_t *buf;
42 buf = NULL;
43
44 if (!zdr_enum (zdrs, (enum_t *) objp))
45 return FALSE;
46 return TRUE;
47 }
48
49 bool_t
50 zdr_exportpath (ZDR *zdrs, exportpath *objp)
51 {
52 register int32_t *buf;
53 buf = NULL;
54
55 if (!zdr_string (zdrs, objp, RQUOTAPATHLEN))
56 return FALSE;
57 return TRUE;
58 }
59
60 bool_t
61 zdr_GETQUOTA1args (ZDR *zdrs, GETQUOTA1args *objp)
62 {
63 register int32_t *buf;
64 buf = NULL;
65
66 if (!zdr_exportpath (zdrs, &objp->export))
67 return FALSE;
68 if (!zdr_int (zdrs, &objp->uid))
69 return FALSE;
70 return TRUE;
71 }
72
73 bool_t
74 zdr_quotatype (ZDR *zdrs, quotatype *objp)
75 {
76 register int32_t *buf;
77 buf = NULL;
78
79 if (!zdr_enum (zdrs, (enum_t *) objp))
80 return FALSE;
81 return TRUE;
82 }
83
84 bool_t
85 zdr_GETQUOTA2args (ZDR *zdrs, GETQUOTA2args *objp)
86 {
87 register int32_t *buf;
88 buf = NULL;
89
90 if (!zdr_exportpath (zdrs, &objp->export))
91 return FALSE;
92 if (!zdr_quotatype (zdrs, &objp->type))
93 return FALSE;
94 if (!zdr_int (zdrs, &objp->uid))
95 return FALSE;
96 return TRUE;
97 }
98
99 bool_t
100 zdr_GETQUOTA1res_ok (ZDR *zdrs, GETQUOTA1res_ok *objp)
101 {
102 register int32_t *buf;
103 buf = NULL;
104
105
106 if (zdrs->x_op == ZDR_ENCODE) {
107 buf = ZDR_INLINE (zdrs, 10 * BYTES_PER_ZDR_UNIT);
108 if (buf == NULL) {
109 if (!zdr_int (zdrs, &objp->bsize))
110 return FALSE;
111 if (!zdr_int (zdrs, &objp->active))
112 return FALSE;
113 if (!zdr_int (zdrs, &objp->bhardlimit))
114 return FALSE;
115 if (!zdr_int (zdrs, &objp->bsoftlimit))
116 return FALSE;
117 if (!zdr_int (zdrs, &objp->curblocks))
118 return FALSE;
119 if (!zdr_int (zdrs, &objp->fhardlimit))
120 return FALSE;
121 if (!zdr_int (zdrs, &objp->fsoftlimit))
122 return FALSE;
123 if (!zdr_int (zdrs, &objp->curfiles))
124 return FALSE;
125 if (!zdr_int (zdrs, &objp->btimeleft))
126 return FALSE;
127 if (!zdr_int (zdrs, &objp->ftimeleft))
128 return FALSE;
129 } else {
130 IZDR_PUT_LONG(buf, objp->bsize);
131 IZDR_PUT_LONG(buf, objp->active);
132 IZDR_PUT_LONG(buf, objp->bhardlimit);
133 IZDR_PUT_LONG(buf, objp->bsoftlimit);
134 IZDR_PUT_LONG(buf, objp->curblocks);
135 IZDR_PUT_LONG(buf, objp->fhardlimit);
136 IZDR_PUT_LONG(buf, objp->fsoftlimit);
137 IZDR_PUT_LONG(buf, objp->curfiles);
138 IZDR_PUT_LONG(buf, objp->btimeleft);
139 IZDR_PUT_LONG(buf, objp->ftimeleft);
140 }
141 return TRUE;
142 } else if (zdrs->x_op == ZDR_DECODE) {
143 buf = ZDR_INLINE (zdrs, 10 * BYTES_PER_ZDR_UNIT);
144 if (buf == NULL) {
145 if (!zdr_int (zdrs, &objp->bsize))
146 return FALSE;
147 if (!zdr_int (zdrs, &objp->active))
148 return FALSE;
149 if (!zdr_int (zdrs, &objp->bhardlimit))
150 return FALSE;
151 if (!zdr_int (zdrs, &objp->bsoftlimit))
152 return FALSE;
153 if (!zdr_int (zdrs, &objp->curblocks))
154 return FALSE;
155 if (!zdr_int (zdrs, &objp->fhardlimit))
156 return FALSE;
157 if (!zdr_int (zdrs, &objp->fsoftlimit))
158 return FALSE;
159 if (!zdr_int (zdrs, &objp->curfiles))
160 return FALSE;
161 if (!zdr_int (zdrs, &objp->btimeleft))
162 return FALSE;
163 if (!zdr_int (zdrs, &objp->ftimeleft))
164 return FALSE;
165 } else {
166 objp->bsize = IZDR_GET_LONG(buf);
167 objp->active = IZDR_GET_LONG(buf);
168 objp->bhardlimit = IZDR_GET_LONG(buf);
169 objp->bsoftlimit = IZDR_GET_LONG(buf);
170 objp->curblocks = IZDR_GET_LONG(buf);
171 objp->fhardlimit = IZDR_GET_LONG(buf);
172 objp->fsoftlimit = IZDR_GET_LONG(buf);
173 objp->curfiles = IZDR_GET_LONG(buf);
174 objp->btimeleft = IZDR_GET_LONG(buf);
175 objp->ftimeleft = IZDR_GET_LONG(buf);
176 }
177 return TRUE;
178 }
179
180 if (!zdr_int (zdrs, &objp->bsize))
181 return FALSE;
182 if (!zdr_int (zdrs, &objp->active))
183 return FALSE;
184 if (!zdr_int (zdrs, &objp->bhardlimit))
185 return FALSE;
186 if (!zdr_int (zdrs, &objp->bsoftlimit))
187 return FALSE;
188 if (!zdr_int (zdrs, &objp->curblocks))
189 return FALSE;
190 if (!zdr_int (zdrs, &objp->fhardlimit))
191 return FALSE;
192 if (!zdr_int (zdrs, &objp->fsoftlimit))
193 return FALSE;
194 if (!zdr_int (zdrs, &objp->curfiles))
195 return FALSE;
196 if (!zdr_int (zdrs, &objp->btimeleft))
197 return FALSE;
198 if (!zdr_int (zdrs, &objp->ftimeleft))
199 return FALSE;
200 return TRUE;
201 }
202
203 bool_t
204 zdr_GETQUOTA1res (ZDR *zdrs, GETQUOTA1res *objp)
205 {
206 register int32_t *buf;
207 buf = NULL;
208
209 if (!zdr_rquotastat (zdrs, &objp->status))
210 return FALSE;
211 switch (objp->status) {
212 case RQUOTA_OK:
213 if (!zdr_GETQUOTA1res_ok (zdrs, &objp->GETQUOTA1res_u.quota))
214 return FALSE;
215 break;
216 default:
217 break;
218 }
219 return TRUE;
220 }