xref: /illumos-gate/usr/src/uts/common/fs/nfs/nfs4x_xdr.c (revision f44e1126d9eae71c48c5d1de51e24750c6ec20a4)
1 /*
2  * CDDL HEADER START
3  *
4  * The contents of this file are subject to the terms of the
5  * Common Development and Distribution License (the "License").
6  * You may not use this file except in compliance with the License.
7  *
8  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9  * or http://www.opensolaris.org/os/licensing.
10  * See the License for the specific language governing permissions
11  * and limitations under the License.
12  *
13  * When distributing Covered Code, include this CDDL HEADER in each
14  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15  * If applicable, add the following below this CDDL HEADER, with the
16  * fields enclosed by brackets "[]" replaced with your own identifying
17  * information: Portions Copyright [yyyy] [name of copyright owner]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2008 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  * Copyright 2017 RackTop Systems.
25  */
26 
27 /*
28  * This file contains the xdr for datatypes and operations that are
29  * specific to NFSv4 minor version 1 (i.e., datatypes that
30  * were either introduced or changed by the NFSv4.1 specification).
31  */
32 
33 /*
34  * INSTRUCTIONS for updating to a new NFSv4.1:
35  *
36  *    **DO NOT** simply replace this file with code rpcgen creates
37  *    and then remove non-NFS41 code.  The file now contains the hand
38  *    coded xdr for the NFS4.1 attributes.  If you run rpcgen,
39  *    then those, and future changes, should be manually integrated.
40  */
41 #include <sys/statvfs.h>
42 #include <sys/sysmacros.h>
43 #include <sys/sdt.h>
44 #include <nfs/nfs4.h>
45 #include <nfs/nfs4_attr.h>
46 
47 #ifndef _KERNEL
48 #include <stdlib.h>
49 #endif /* !_KERNEL */
50 
51 /* modified version */
52 bool_t
xdr_verifier4(XDR * xdrs,verifier4 * objp)53 xdr_verifier4(XDR *xdrs, verifier4 *objp)
54 {
55 	if (!xdr_u_longlong_t(xdrs, (u_longlong_t *)objp))
56 		return (FALSE);
57 	return (TRUE);
58 }
59 
60 bool_t
xdr_sequenceid4(XDR * xdrs,sequenceid4 * objp)61 xdr_sequenceid4(XDR *xdrs, sequenceid4 *objp)
62 {
63 	if (!xdr_uint32_t(xdrs, objp))
64 		return (FALSE);
65 	return (TRUE);
66 }
67 
68 bool_t
xdr_sessionid4(XDR * xdrs,sessionid4 objp)69 xdr_sessionid4(XDR *xdrs, sessionid4 objp)
70 {
71 	if (!xdr_opaque(xdrs, objp, NFS4_SESSIONID_SIZE))
72 		return (FALSE);
73 	return (TRUE);
74 }
75 
76 bool_t
xdr_slotid4(XDR * xdrs,slotid4 * objp)77 xdr_slotid4(XDR *xdrs, slotid4 *objp)
78 {
79 
80 	if (!xdr_uint32_t(xdrs, objp))
81 		return (FALSE);
82 	return (TRUE);
83 }
84 
85 bool_t
xdr_change_policy4(XDR * xdrs,change_policy4 * objp)86 xdr_change_policy4(XDR *xdrs, change_policy4 *objp)
87 {
88 	if (!xdr_uint64_t(xdrs, &objp->cp_major))
89 		return (FALSE);
90 	if (!xdr_uint64_t(xdrs, &objp->cp_minor))
91 		return (FALSE);
92 	return (TRUE);
93 }
94 
95 bool_t
xdr_aclflag4(XDR * xdrs,aclflag4 * objp)96 xdr_aclflag4(XDR *xdrs, aclflag4 *objp)
97 {
98 	if (!xdr_uint32_t(xdrs, objp))
99 		return (FALSE);
100 	return (TRUE);
101 }
102 
103 bool_t
xdr_nfsacl41(XDR * xdrs,nfsacl41 * objp)104 xdr_nfsacl41(XDR *xdrs, nfsacl41 *objp)
105 {
106 	if (!xdr_aclflag4(xdrs, &objp->na41_flag))
107 		return (FALSE);
108 	if (!xdr_array(xdrs, (char **)&objp->na41_aces.na41_aces_val,
109 	    (uint_t *)&objp->na41_aces.na41_aces_len, ~0, sizeof (nfsace4),
110 	    (xdrproc_t)xdr_nfsace4))
111 		return (FALSE);
112 	return (TRUE);
113 }
114 
115 bool_t
xdr_mode_masked4(XDR * xdrs,mode_masked4 * objp)116 xdr_mode_masked4(XDR *xdrs, mode_masked4 *objp)
117 {
118 	if (!xdr_mode4(xdrs, &objp->mm_value_to_set))
119 		return (FALSE);
120 	if (!xdr_mode4(xdrs, &objp->mm_mask_bits))
121 		return (FALSE);
122 	return (TRUE);
123 }
124 
125 bool_t
xdr_nfs_impl_id4(XDR * xdrs,nfs_impl_id4 * objp)126 xdr_nfs_impl_id4(XDR *xdrs, nfs_impl_id4 *objp)
127 {
128 	if (!xdr_utf8str_cis(xdrs, &objp->nii_domain))
129 		return (FALSE);
130 	if (!xdr_utf8str_cs(xdrs, &objp->nii_name))
131 		return (FALSE);
132 	if (!xdr_nfstime4(xdrs, &objp->nii_date))
133 		return (FALSE);
134 	return (TRUE);
135 }
136 
137 bool_t
xdr_layouttype4(XDR * xdrs,layouttype4 * objp)138 xdr_layouttype4(XDR *xdrs, layouttype4 *objp)
139 {
140 	if (!xdr_enum(xdrs, (enum_t *)objp))
141 		return (FALSE);
142 	return (TRUE);
143 }
144 
145 bool_t
xdr_layout_content4(XDR * xdrs,layout_content4 * objp)146 xdr_layout_content4(XDR *xdrs, layout_content4 *objp)
147 {
148 	if (!xdr_layouttype4(xdrs, &objp->loc_type))
149 		return (FALSE);
150 	if (!xdr_bytes(xdrs, (char **)&objp->loc_body.loc_body_val,
151 	    (uint_t *)&objp->loc_body.loc_body_len, ~0))
152 		return (FALSE);
153 	return (TRUE);
154 }
155 
156 bool_t
xdr_layoutiomode4(XDR * xdrs,layoutiomode4 * objp)157 xdr_layoutiomode4(XDR *xdrs, layoutiomode4 *objp)
158 {
159 	if (!xdr_enum(xdrs, (enum_t *)objp))
160 		return (FALSE);
161 	return (TRUE);
162 }
163 
164 
165 bool_t
xdr_layout4(XDR * xdrs,layout4 * objp)166 xdr_layout4(XDR *xdrs, layout4 *objp)
167 {
168 	if (!xdr_offset4(xdrs, &objp->lo_offset))
169 		return (FALSE);
170 	if (!xdr_length4(xdrs, &objp->lo_length))
171 		return (FALSE);
172 	if (!xdr_layoutiomode4(xdrs, &objp->lo_iomode))
173 		return (FALSE);
174 	if (!xdr_layout_content4(xdrs, &objp->lo_content))
175 		return (FALSE);
176 	return (TRUE);
177 }
178 
179 bool_t
xdr_deviceid4(XDR * xdrs,deviceid4 objp)180 xdr_deviceid4(XDR *xdrs, deviceid4 objp)
181 {
182 	if (!xdr_opaque(xdrs, objp, NFS4_DEVICEID4_SIZE))
183 		return (FALSE);
184 	return (TRUE);
185 }
186 
187 bool_t
xdr_device_addr4(XDR * xdrs,device_addr4 * objp)188 xdr_device_addr4(XDR *xdrs, device_addr4 *objp)
189 {
190 	if (!xdr_layouttype4(xdrs, &objp->da_layout_type))
191 		return (FALSE);
192 	if (!xdr_bytes(xdrs, (char **)&objp->da_addr_body.da_addr_body_val,
193 	    (uint_t *)&objp->da_addr_body.da_addr_body_len, ~0))
194 		return (FALSE);
195 	return (TRUE);
196 }
197 
198 bool_t
xdr_layoutupdate4(XDR * xdrs,layoutupdate4 * objp)199 xdr_layoutupdate4(XDR *xdrs, layoutupdate4 *objp)
200 {
201 	if (!xdr_layouttype4(xdrs, &objp->lou_type))
202 		return (FALSE);
203 	if (!xdr_bytes(xdrs, (char **)&objp->lou_body.lou_body_val,
204 	    (uint_t *)&objp->lou_body.lou_body_len, ~0))
205 		return (FALSE);
206 	return (TRUE);
207 }
208 
209 bool_t
xdr_layoutreturn_type4(XDR * xdrs,layoutreturn_type4 * objp)210 xdr_layoutreturn_type4(XDR *xdrs, layoutreturn_type4 *objp)
211 {
212 	if (!xdr_enum(xdrs, (enum_t *)objp))
213 		return (FALSE);
214 	return (TRUE);
215 }
216 /* layouttype4 specific data */
217 
218 bool_t
xdr_layoutreturn_file4(XDR * xdrs,layoutreturn_file4 * objp)219 xdr_layoutreturn_file4(XDR *xdrs, layoutreturn_file4 *objp)
220 {
221 	if (!xdr_offset4(xdrs, &objp->lrf_offset))
222 		return (FALSE);
223 	if (!xdr_length4(xdrs, &objp->lrf_length))
224 		return (FALSE);
225 	if (!xdr_stateid4(xdrs, &objp->lrf_stateid))
226 		return (FALSE);
227 	if (!xdr_bytes(xdrs, (char **)&objp->lrf_body.lrf_body_val,
228 	    (uint_t *)&objp->lrf_body.lrf_body_len, ~0))
229 		return (FALSE);
230 	return (TRUE);
231 }
232 
233 bool_t
xdr_layoutreturn4(XDR * xdrs,layoutreturn4 * objp)234 xdr_layoutreturn4(XDR *xdrs, layoutreturn4 *objp)
235 {
236 	if (!xdr_layoutreturn_type4(xdrs, &objp->lr_returntype))
237 		return (FALSE);
238 	switch (objp->lr_returntype) {
239 	case LAYOUTRETURN4_FILE:
240 		if (!xdr_layoutreturn_file4(xdrs,
241 		    &objp->layoutreturn4_u.lr_layout))
242 			return (FALSE);
243 		break;
244 	}
245 	return (TRUE);
246 }
247 
248 
249 bool_t
xdr_fs4_status_type(XDR * xdrs,fs4_status_type * objp)250 xdr_fs4_status_type(XDR *xdrs, fs4_status_type *objp)
251 {
252 	if (!xdr_enum(xdrs, (enum_t *)objp))
253 		return (FALSE);
254 	return (TRUE);
255 }
256 
257 bool_t
xdr_fs4_status(XDR * xdrs,fs4_status * objp)258 xdr_fs4_status(XDR *xdrs, fs4_status *objp)
259 {
260 	if (!xdr_bool(xdrs, &objp->fss_absent))
261 		return (FALSE);
262 	if (!xdr_fs4_status_type(xdrs, &objp->fss_type))
263 		return (FALSE);
264 	if (!xdr_utf8str_cs(xdrs, &objp->fss_source))
265 		return (FALSE);
266 	if (!xdr_utf8str_cs(xdrs, &objp->fss_current))
267 		return (FALSE);
268 	if (!xdr_int32_t(xdrs, &objp->fss_age))
269 		return (FALSE);
270 	if (!xdr_nfstime4(xdrs, &objp->fss_version))
271 		return (FALSE);
272 	return (TRUE);
273 }
274 
275 bool_t
xdr_threshold4_read_size(XDR * xdrs,threshold4_read_size * objp)276 xdr_threshold4_read_size(XDR *xdrs, threshold4_read_size *objp)
277 {
278 
279 	if (!xdr_length4(xdrs, objp))
280 		return (FALSE);
281 	return (TRUE);
282 }
283 
284 bool_t
xdr_threshold4_write_size(XDR * xdrs,threshold4_write_size * objp)285 xdr_threshold4_write_size(XDR *xdrs, threshold4_write_size *objp)
286 {
287 	if (!xdr_length4(xdrs, objp))
288 		return (FALSE);
289 	return (TRUE);
290 }
291 
292 bool_t
xdr_threshold4_read_iosize(XDR * xdrs,threshold4_read_iosize * objp)293 xdr_threshold4_read_iosize(XDR *xdrs, threshold4_read_iosize *objp)
294 {
295 	if (!xdr_length4(xdrs, objp))
296 		return (FALSE);
297 	return (TRUE);
298 }
299 
300 bool_t
xdr_threshold4_write_iosize(XDR * xdrs,threshold4_write_iosize * objp)301 xdr_threshold4_write_iosize(XDR *xdrs, threshold4_write_iosize *objp)
302 {
303 	if (!xdr_length4(xdrs, objp))
304 		return (FALSE);
305 	return (TRUE);
306 }
307 
308 bool_t
xdr_threshold_item4(XDR * xdrs,threshold_item4 * objp)309 xdr_threshold_item4(XDR *xdrs, threshold_item4 *objp)
310 {
311 	if (!xdr_layouttype4(xdrs, &objp->thi_layout_type))
312 		return (FALSE);
313 	if (!xdr_bitmap4(xdrs, &objp->thi_hintset))
314 		return (FALSE);
315 	if (!xdr_bytes(xdrs, (char **)&objp->thi_hintlist.thi_hintlist_val,
316 	    (uint_t *)&objp->thi_hintlist.thi_hintlist_len, ~0))
317 		return (FALSE);
318 	return (TRUE);
319 }
320 
321 bool_t
xdr_mdsthreshold4(XDR * xdrs,mdsthreshold4 * objp)322 xdr_mdsthreshold4(XDR *xdrs, mdsthreshold4 *objp)
323 {
324 	if (!xdr_array(xdrs, (char **)&objp->mth_hints.mth_hints_val,
325 	    (uint_t *)&objp->mth_hints.mth_hints_len, ~0,
326 	    sizeof (threshold_item4), (xdrproc_t)xdr_threshold_item4))
327 		return (FALSE);
328 	return (TRUE);
329 }
330 
331 bool_t
xdr_retention_get4(XDR * xdrs,retention_get4 * objp)332 xdr_retention_get4(XDR *xdrs, retention_get4 *objp)
333 {
334 	if (!xdr_uint64_t(xdrs, &objp->rg_duration))
335 		return (FALSE);
336 	if (!xdr_array(xdrs, (char **)&objp->rg_begin_time.rg_begin_time_val,
337 	    (uint_t *)&objp->rg_begin_time.rg_begin_time_len, 1,
338 	    sizeof (nfstime4), (xdrproc_t)xdr_nfstime4))
339 		return (FALSE);
340 	return (TRUE);
341 }
342 
343 bool_t
xdr_retention_set4(XDR * xdrs,retention_set4 * objp)344 xdr_retention_set4(XDR *xdrs, retention_set4 *objp)
345 {
346 	if (!xdr_bool(xdrs, &objp->rs_enable))
347 		return (FALSE);
348 	if (!xdr_array(xdrs, (char **)&objp->rs_duration.rs_duration_val,
349 	    (uint_t *)&objp->rs_duration.rs_duration_len, 1, sizeof (uint64_t),
350 	    (xdrproc_t)xdr_uint64_t))
351 		return (FALSE);
352 	return (TRUE);
353 }
354 
355 bool_t
xdr_fs_charset_cap4(XDR * xdrs,fs_charset_cap4 * objp)356 xdr_fs_charset_cap4(XDR *xdrs, fs_charset_cap4 *objp)
357 {
358 
359 	if (!xdr_uint32_t(xdrs, objp))
360 		return (FALSE);
361 	return (TRUE);
362 }
363 
364 bool_t
xdr_fattr4_mode_set_masked(XDR * xdrs,fattr4_mode_set_masked * objp)365 xdr_fattr4_mode_set_masked(XDR *xdrs, fattr4_mode_set_masked *objp)
366 {
367 	if (!xdr_mode_masked4(xdrs, objp))
368 		return (FALSE);
369 	return (TRUE);
370 }
371 
372 bool_t
xdr_fattr4_dir_notif_delay(XDR * xdrs,fattr4_dir_notif_delay * objp)373 xdr_fattr4_dir_notif_delay(XDR *xdrs, fattr4_dir_notif_delay *objp)
374 {
375 
376 	if (!xdr_nfstime4(xdrs, objp))
377 		return (FALSE);
378 	return (TRUE);
379 }
380 
381 bool_t
xdr_fattr4_dirent_notif_delay(XDR * xdrs,fattr4_dirent_notif_delay * objp)382 xdr_fattr4_dirent_notif_delay(XDR *xdrs, fattr4_dirent_notif_delay *objp)
383 {
384 	if (!xdr_nfstime4(xdrs, objp))
385 		return (FALSE);
386 	return (TRUE);
387 }
388 
389 bool_t
xdr_fattr4_fs_layout_types(XDR * xdrs,fattr4_fs_layout_types * objp)390 xdr_fattr4_fs_layout_types(XDR *xdrs, fattr4_fs_layout_types *objp)
391 {
392 	if (!xdr_array(xdrs, (char **)&objp->fattr4_fs_layout_types_val,
393 	    (uint_t *)&objp->fattr4_fs_layout_types_len, ~0,
394 	    sizeof (layouttype4), (xdrproc_t)xdr_layouttype4))
395 		return (FALSE);
396 	return (TRUE);
397 }
398 
399 bool_t
xdr_fattr4_fs_status(XDR * xdrs,fattr4_fs_status * objp)400 xdr_fattr4_fs_status(XDR *xdrs, fattr4_fs_status *objp)
401 {
402 	if (!xdr_fs4_status(xdrs, objp))
403 		return (FALSE);
404 	return (TRUE);
405 }
406 
407 bool_t
xdr_fattr4_fs_charset_cap4(XDR * xdrs,fattr4_fs_charset_cap * objp)408 xdr_fattr4_fs_charset_cap4(XDR *xdrs, fattr4_fs_charset_cap *objp)
409 {
410 	if (!xdr_fs_charset_cap4(xdrs, objp))
411 		return (FALSE);
412 	return (TRUE);
413 }
414 
415 bool_t
xdr_fattr4_retention_get(XDR * xdrs,fattr4_retention_get * objp)416 xdr_fattr4_retention_get(XDR *xdrs, fattr4_retention_get *objp)
417 {
418 	if (!xdr_retention_get4(xdrs, objp))
419 		return (FALSE);
420 	return (TRUE);
421 }
422 
423 bool_t
xdr_fattr4_retention_set(XDR * xdrs,fattr4_retention_set * objp)424 xdr_fattr4_retention_set(XDR *xdrs, fattr4_retention_set *objp)
425 {
426 	if (!xdr_retention_set4(xdrs, objp))
427 		return (FALSE);
428 	return (TRUE);
429 }
430 
431 bool_t
xdr_fattr4_retentevt_get(XDR * xdrs,fattr4_retentevt_get * objp)432 xdr_fattr4_retentevt_get(XDR *xdrs, fattr4_retentevt_get *objp)
433 {
434 	if (!xdr_retention_get4(xdrs, objp))
435 		return (FALSE);
436 	return (TRUE);
437 }
438 
439 bool_t
xdr_fattr4_retentevt_set(XDR * xdrs,fattr4_retentevt_set * objp)440 xdr_fattr4_retentevt_set(XDR *xdrs, fattr4_retentevt_set *objp)
441 {
442 	if (!xdr_retention_set4(xdrs, objp))
443 		return (FALSE);
444 	return (TRUE);
445 }
446 
447 bool_t
xdr_fattr4_retention_hold(XDR * xdrs,fattr4_retention_hold * objp)448 xdr_fattr4_retention_hold(XDR *xdrs, fattr4_retention_hold *objp)
449 {
450 	if (!xdr_uint64_t(xdrs, objp))
451 		return (FALSE);
452 	return (TRUE);
453 }
454 
455 bool_t
xdr_fattr4_dacl(XDR * xdrs,fattr4_dacl * objp)456 xdr_fattr4_dacl(XDR *xdrs, fattr4_dacl *objp)
457 {
458 	if (!xdr_nfsacl41(xdrs, objp))
459 		return (FALSE);
460 	return (TRUE);
461 }
462 
463 bool_t
xdr_fattr4_sacl(XDR * xdrs,fattr4_sacl * objp)464 xdr_fattr4_sacl(XDR *xdrs, fattr4_sacl *objp)
465 {
466 	if (!xdr_nfsacl41(xdrs, objp))
467 		return (FALSE);
468 	return (TRUE);
469 }
470 
471 bool_t
xdr_client_owner4(XDR * xdrs,client_owner4 * objp)472 xdr_client_owner4(XDR *xdrs, client_owner4 *objp)
473 {
474 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->co_verifier))
475 		return (FALSE);
476 	if (!xdr_bytes(xdrs, (char **)&objp->co_ownerid.co_ownerid_val,
477 	    (uint_t *)&objp->co_ownerid.co_ownerid_len, NFS4_OPAQUE_LIMIT))
478 		return (FALSE);
479 	return (TRUE);
480 }
481 
482 bool_t
xdr_server_owner4(XDR * xdrs,server_owner4 * objp)483 xdr_server_owner4(XDR *xdrs, server_owner4 *objp)
484 {
485 	if (!xdr_uint64_t(xdrs, &objp->so_minor_id))
486 		return (FALSE);
487 	if (!xdr_bytes(xdrs, (char **)&objp->so_major_id.so_major_id_val,
488 	    (uint_t *)&objp->so_major_id.so_major_id_len, NFS4_OPAQUE_LIMIT))
489 		return (FALSE);
490 	return (TRUE);
491 }
492 
493 bool_t
xdr_state_owner4(XDR * xdrs,state_owner4 * objp)494 xdr_state_owner4(XDR *xdrs, state_owner4 *objp)
495 {
496 	if (!xdr_clientid4(xdrs, &objp->clientid))
497 		return (FALSE);
498 	if (!xdr_bytes(xdrs, (char **)&objp->owner.owner_val,
499 	    (uint_t *)&objp->owner.owner_len, NFS4_OPAQUE_LIMIT))
500 		return (FALSE);
501 	return (TRUE);
502 }
503 
504 /* Input for computing subkeys */
505 
506 bool_t
xdr_ssv_subkey4(XDR * xdrs,ssv_subkey4 * objp)507 xdr_ssv_subkey4(XDR *xdrs, ssv_subkey4 *objp)
508 {
509 	if (!xdr_enum(xdrs, (enum_t *)objp))
510 		return (FALSE);
511 	return (TRUE);
512 }
513 
514 
515 /* Input for computing smt_hmac */
516 
517 bool_t
xdr_ssv_mic_plain_tkn4(XDR * xdrs,ssv_mic_plain_tkn4 * objp)518 xdr_ssv_mic_plain_tkn4(XDR *xdrs, ssv_mic_plain_tkn4 *objp)
519 {
520 	if (!xdr_uint32_t(xdrs, &objp->smpt_ssv_seq))
521 		return (FALSE);
522 	if (!xdr_bytes(xdrs,
523 	    (char **)&objp->smpt_orig_plain.smpt_orig_plain_val,
524 	    (uint_t *)&objp->smpt_orig_plain.smpt_orig_plain_len, ~0))
525 		return (FALSE);
526 	return (TRUE);
527 }
528 
529 
530 /* SSV GSS PerMsgToken token */
531 
532 bool_t
xdr_ssv_mic_tkn4(XDR * xdrs,ssv_mic_tkn4 * objp)533 xdr_ssv_mic_tkn4(XDR *xdrs, ssv_mic_tkn4 *objp)
534 {
535 	if (!xdr_uint32_t(xdrs, &objp->smt_ssv_seq))
536 		return (FALSE);
537 	if (!xdr_bytes(xdrs, (char **)&objp->smt_hmac.smt_hmac_val,
538 	    (uint_t *)&objp->smt_hmac.smt_hmac_len, ~0))
539 		return (FALSE);
540 	return (TRUE);
541 }
542 
543 
544 /* Input for computing ssct_encr_data and ssct_hmac */
545 
546 bool_t
xdr_ssv_seal_plain_tkn4(XDR * xdrs,ssv_seal_plain_tkn4 * objp)547 xdr_ssv_seal_plain_tkn4(XDR *xdrs, ssv_seal_plain_tkn4 *objp)
548 {
549 	if (!xdr_bytes(xdrs,
550 	    (char **)&objp->sspt_confounder.sspt_confounder_val,
551 	    (uint_t *)&objp->sspt_confounder.sspt_confounder_len, ~0))
552 		return (FALSE);
553 	if (!xdr_uint32_t(xdrs, &objp->sspt_ssv_seq))
554 		return (FALSE);
555 	if (!xdr_bytes(xdrs,
556 	    (char **)&objp->sspt_orig_plain.sspt_orig_plain_val,
557 	    (uint_t *)&objp->sspt_orig_plain.sspt_orig_plain_len, ~0))
558 		return (FALSE);
559 	if (!xdr_bytes(xdrs, (char **)&objp->sspt_pad.sspt_pad_val,
560 	    (uint_t *)&objp->sspt_pad.sspt_pad_len, ~0))
561 		return (FALSE);
562 	return (TRUE);
563 }
564 
565 
566 /* SSV GSS SealedMessage token */
567 
568 bool_t
xdr_ssv_seal_cipher_tkn4(XDR * xdrs,ssv_seal_cipher_tkn4 * objp)569 xdr_ssv_seal_cipher_tkn4(XDR *xdrs, ssv_seal_cipher_tkn4 *objp)
570 {
571 	if (!xdr_uint32_t(xdrs, &objp->ssct_ssv_seq))
572 		return (FALSE);
573 	if (!xdr_bytes(xdrs, (char **)&objp->ssct_iv.ssct_iv_val,
574 	    (uint_t *)&objp->ssct_iv.ssct_iv_len, ~0))
575 		return (FALSE);
576 	if (!xdr_bytes(xdrs, (char **)&objp->ssct_encr_data.ssct_encr_data_val,
577 	    (uint_t *)&objp->ssct_encr_data.ssct_encr_data_len, ~0))
578 		return (FALSE);
579 	if (!xdr_bytes(xdrs, (char **)&objp->ssct_hmac.ssct_hmac_val,
580 	    (uint_t *)&objp->ssct_hmac.ssct_hmac_len, ~0))
581 		return (FALSE);
582 	return (TRUE);
583 }
584 
585 
586 bool_t
xdr_fs_locations_server4(XDR * xdrs,fs_locations_server4 * objp)587 xdr_fs_locations_server4(XDR *xdrs, fs_locations_server4 *objp)
588 {
589 	if (!xdr_int32_t(xdrs, &objp->fls_currency))
590 		return (FALSE);
591 	if (!xdr_bytes(xdrs, (char **)&objp->fls_info.fls_info_val,
592 	    (uint_t *)&objp->fls_info.fls_info_len, ~0))
593 		return (FALSE);
594 	if (!xdr_utf8str_cis(xdrs, &objp->fls_server))
595 		return (FALSE);
596 	return (TRUE);
597 }
598 
599 bool_t
xdr_fs_locations_item4(XDR * xdrs,fs_locations_item4 * objp)600 xdr_fs_locations_item4(XDR *xdrs, fs_locations_item4 *objp)
601 {
602 	if (!xdr_array(xdrs, (char **)&objp->fli_entries.fli_entries_val,
603 	    (uint_t *)&objp->fli_entries.fli_entries_len, ~0,
604 	    sizeof (fs_locations_server4), (xdrproc_t)xdr_fs_locations_server4))
605 		return (FALSE);
606 	if (!xdr_pathname4(xdrs, &objp->fli_rootpath))
607 		return (FALSE);
608 	return (TRUE);
609 }
610 
611 bool_t
xdr_fs_locations_info4(XDR * xdrs,fs_locations_info4 * objp)612 xdr_fs_locations_info4(XDR *xdrs, fs_locations_info4 *objp)
613 {
614 	if (!xdr_uint32_t(xdrs, &objp->fli_flags))
615 		return (FALSE);
616 	if (!xdr_int32_t(xdrs, &objp->fli_valid_for))
617 		return (FALSE);
618 	if (!xdr_pathname4(xdrs, &objp->fli_fs_root))
619 		return (FALSE);
620 	if (!xdr_array(xdrs, (char **)&objp->fli_items.fli_items_val,
621 	    (uint_t *)&objp->fli_items.fli_items_len, ~0,
622 	    sizeof (fs_locations_item4), (xdrproc_t)xdr_fs_locations_item4))
623 		return (FALSE);
624 	return (TRUE);
625 }
626 
627 bool_t
xdr_fattr4_fs_locations_info(XDR * xdrs,fattr4_fs_locations_info * objp)628 xdr_fattr4_fs_locations_info(XDR *xdrs, fattr4_fs_locations_info *objp)
629 {
630 	if (!xdr_fs_locations_info4(xdrs, objp))
631 		return (FALSE);
632 	return (TRUE);
633 }
634 
635 bool_t
xdr_nfl_util4(XDR * xdrs,nfl_util4 * objp)636 xdr_nfl_util4(XDR *xdrs, nfl_util4 *objp)
637 {
638 	if (!xdr_uint32_t(xdrs, objp))
639 		return (FALSE);
640 	return (TRUE);
641 }
642 
643 bool_t
xdr_filelayout_hint_care4(XDR * xdrs,filelayout_hint_care4 * objp)644 xdr_filelayout_hint_care4(XDR *xdrs, filelayout_hint_care4 *objp)
645 {
646 	if (!xdr_enum(xdrs, (enum_t *)objp))
647 		return (FALSE);
648 	return (TRUE);
649 }
650 
651 
652 bool_t
xdr_multipath_list4(XDR * xdrs,multipath_list4 * objp)653 xdr_multipath_list4(XDR *xdrs, multipath_list4 *objp)
654 {
655 	if (!xdr_array(xdrs, (char **)&objp->multipath_list4_val,
656 	    (uint_t *)&objp->multipath_list4_len, ~0,
657 	    sizeof (netaddr4), (xdrproc_t)xdr_netaddr4))
658 		return (FALSE);
659 	return (TRUE);
660 }
661 
662 /* Encoded in the da_addr_body field of type device_addr4: */
663 
664 bool_t
xdr_nfsv4_1_file_layout_ds_addr4(XDR * xdrs,nfsv4_1_file_layout_ds_addr4 * objp)665 xdr_nfsv4_1_file_layout_ds_addr4(XDR *xdrs, nfsv4_1_file_layout_ds_addr4 *objp)
666 {
667 	if (!xdr_array(xdrs,
668 	    (char **)&objp->nflda_stripe_indices.nflda_stripe_indices_val,
669 	    (uint_t *)&objp->nflda_stripe_indices.nflda_stripe_indices_len, ~0,
670 	    sizeof (uint32_t), (xdrproc_t)xdr_uint32_t))
671 		return (FALSE);
672 	if (!xdr_array(xdrs,
673 	    (char **)&objp->nflda_multipath_ds_list.nflda_multipath_ds_list_val,
674 	    (uint_t *)&objp->nflda_multipath_ds_list.
675 	    nflda_multipath_ds_list_len, ~0, sizeof (multipath_list4),
676 	    (xdrproc_t)xdr_multipath_list4))
677 		return (FALSE);
678 	return (TRUE);
679 }
680 
681 
682 /* Encoded in the loc_body field of type layout_content4: */
683 
684 bool_t
xdr_nfsv4_1_file_layout4(XDR * xdrs,nfsv4_1_file_layout4 * objp)685 xdr_nfsv4_1_file_layout4(XDR *xdrs, nfsv4_1_file_layout4 *objp)
686 {
687 	if (!xdr_deviceid4(xdrs, objp->nfl_deviceid))
688 		return (FALSE);
689 	if (!xdr_nfl_util4(xdrs, &objp->nfl_util))
690 		return (FALSE);
691 	if (!xdr_uint32_t(xdrs, &objp->nfl_first_stripe_index))
692 		return (FALSE);
693 	if (!xdr_offset4(xdrs, &objp->nfl_pattern_offset))
694 		return (FALSE);
695 	if (!xdr_array(xdrs, (char **)&objp->nfl_fh_list.nfl_fh_list_val,
696 	    (uint_t *)&objp->nfl_fh_list.nfl_fh_list_len, ~0,
697 	    sizeof (nfs_fh4), (xdrproc_t)xdr_nfs_fh4))
698 		return (FALSE);
699 	return (TRUE);
700 }
701 
702 /*
703  * Encoded in the lou_body field of type layoutupdate4:
704  *      Nothing. lou_body is a zero length array of octets.
705  */
706 
707 
708 bool_t
xdr_creatverfattr(XDR * xdrs,creatverfattr * objp)709 xdr_creatverfattr(XDR *xdrs, creatverfattr *objp)
710 {
711 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->cva_verf))
712 		return (FALSE);
713 	if (!xdr_fattr4(xdrs, &objp->cva_attrs))
714 		return (FALSE);
715 	return (TRUE);
716 }
717 
718 bool_t
xdr_open_claim_delegate_cur4(XDR * xdrs,open_claim_delegate_cur4 * objp)719 xdr_open_claim_delegate_cur4(XDR *xdrs, open_claim_delegate_cur4 *objp)
720 {
721 	if (!xdr_stateid4(xdrs, &objp->delegate_stateid))
722 		return (FALSE);
723 	if (!xdr_component4(xdrs, &objp->file))
724 		return (FALSE);
725 	return (TRUE);
726 }
727 
728 bool_t
xdr_open_claim4(XDR * xdrs,open_claim4 * objp)729 xdr_open_claim4(XDR *xdrs, open_claim4 *objp)
730 {
731 	if (!xdr_open_claim_type4(xdrs, &objp->claim))
732 		return (FALSE);
733 	switch (objp->claim) {
734 	case CLAIM_NULL:
735 		if (!xdr_component4(xdrs, &objp->open_claim4_u.file))
736 			return (FALSE);
737 		break;
738 	case CLAIM_PREVIOUS:
739 		if (!xdr_open_delegation_type4(xdrs,
740 		    &objp->open_claim4_u.delegate_type))
741 			return (FALSE);
742 		break;
743 	case CLAIM_DELEGATE_CUR:
744 		if (!xdr_open_claim_delegate_cur4(xdrs,
745 		    &objp->open_claim4_u.delegate_cur_info))
746 			return (FALSE);
747 		break;
748 	case CLAIM_DELEGATE_PREV:
749 		if (!xdr_component4(xdrs,
750 		    &objp->open_claim4_u.file_delegate_prev))
751 			return (FALSE);
752 		break;
753 	case CLAIM_FH:
754 		break;
755 	case CLAIM_DELEG_PREV_FH:
756 		break;
757 	case CLAIM_DELEG_CUR_FH:
758 		if (!xdr_stateid4(xdrs,
759 		    &objp->open_claim4_u.oc_delegate_stateid))
760 			return (FALSE);
761 		break;
762 	default:
763 		return (FALSE);
764 	}
765 	return (TRUE);
766 }
767 
768 bool_t
xdr_why_no_delegation4(XDR * xdrs,why_no_delegation4 * objp)769 xdr_why_no_delegation4(XDR *xdrs, why_no_delegation4 *objp)
770 {
771 	if (!xdr_enum(xdrs, (enum_t *)objp))
772 		return (FALSE);
773 	return (TRUE);
774 }
775 
776 bool_t
xdr_open_none_delegation4(XDR * xdrs,open_none_delegation4 * objp)777 xdr_open_none_delegation4(XDR *xdrs, open_none_delegation4 *objp)
778 {
779 	if (!xdr_why_no_delegation4(xdrs, &objp->ond_why))
780 		return (FALSE);
781 	switch (objp->ond_why) {
782 	case WND4_CONTENTION:
783 		if (!xdr_bool(xdrs,
784 		    &objp->open_none_delegation4_u.ond_server_will_push_deleg))
785 			return (FALSE);
786 		break;
787 	case WND4_RESOURCE:
788 		if (!xdr_bool(xdrs, &objp->open_none_delegation4_u.
789 		    ond_server_will_signal_avail))
790 			return (FALSE);
791 		break;
792 	}
793 	return (TRUE);
794 }
795 
796 bool_t
xdr_open_delegation4(XDR * xdrs,open_delegation4 * objp)797 xdr_open_delegation4(XDR *xdrs, open_delegation4 *objp)
798 {
799 	if (!xdr_open_delegation_type4(xdrs, &objp->delegation_type))
800 		return (FALSE);
801 	switch (objp->delegation_type) {
802 	case OPEN_DELEGATE_NONE:
803 		break;
804 	case OPEN_DELEGATE_READ:
805 		if (!xdr_open_read_delegation4(xdrs,
806 		    &objp->open_delegation4_u.read))
807 			return (FALSE);
808 		break;
809 	case OPEN_DELEGATE_WRITE:
810 		if (!xdr_open_write_delegation4(xdrs,
811 		    &objp->open_delegation4_u.write))
812 			return (FALSE);
813 		break;
814 	case OPEN_DELEGATE_NONE_EXT:
815 		if (!xdr_open_none_delegation4(xdrs,
816 		    &objp->open_delegation4_u.od_whynone))
817 			return (FALSE);
818 		break;
819 	default:
820 		return (FALSE);
821 	}
822 	return (TRUE);
823 }
824 
825 bool_t
xdr_gsshandle4_t(XDR * xdrs,gsshandle4_t * objp)826 xdr_gsshandle4_t(XDR *xdrs, gsshandle4_t *objp)
827 {
828 	if (!xdr_bytes(xdrs, (char **)&objp->gsshandle4_t_val,
829 	    (uint_t *)&objp->gsshandle4_t_len, ~0))
830 		return (FALSE);
831 	return (TRUE);
832 }
833 
834 bool_t
xdr_gss_cb_handles4(XDR * xdrs,gss_cb_handles4 * objp)835 xdr_gss_cb_handles4(XDR *xdrs, gss_cb_handles4 *objp)
836 {
837 	if (!xdr_rpc_gss_svc_t(xdrs, &objp->gcbp_service))
838 		return (FALSE);
839 	if (!xdr_gsshandle4_t(xdrs, &objp->gcbp_handle_from_server))
840 		return (FALSE);
841 	if (!xdr_gsshandle4_t(xdrs, &objp->gcbp_handle_from_client))
842 		return (FALSE);
843 	return (TRUE);
844 }
845 
846 bool_t
xdr_callback_sec_parms4(XDR * xdrs,callback_sec_parms4 * objp)847 xdr_callback_sec_parms4(XDR *xdrs, callback_sec_parms4 *objp)
848 {
849 	if (!xdr_uint32_t(xdrs, &objp->cb_secflavor))
850 		return (FALSE);
851 	switch (objp->cb_secflavor) {
852 	case AUTH_NONE:
853 		break;
854 	case AUTH_SYS:
855 		if (!xdr_authsys_parms(xdrs,
856 		    &objp->callback_sec_parms4_u.cbsp_sys_cred))
857 			return (FALSE);
858 		break;
859 	case RPCSEC_GSS:
860 		if (!xdr_gss_cb_handles4(xdrs,
861 		    &objp->callback_sec_parms4_u.cbsp_gss_handles))
862 			return (FALSE);
863 		break;
864 	default:
865 		return (FALSE);
866 	}
867 	return (TRUE);
868 }
869 
870 bool_t
xdr_BACKCHANNEL_CTL4args(XDR * xdrs,BACKCHANNEL_CTL4args * objp)871 xdr_BACKCHANNEL_CTL4args(XDR *xdrs, BACKCHANNEL_CTL4args *objp)
872 {
873 	if (!xdr_uint32_t(xdrs, &objp->bca_cb_program))
874 		return (FALSE);
875 	if (!xdr_array(xdrs, (char **)&objp->bca_sec_parms.bca_sec_parms_val,
876 	    (uint_t *)&objp->bca_sec_parms.bca_sec_parms_len, ~0,
877 	    sizeof (callback_sec_parms4), (xdrproc_t)xdr_callback_sec_parms4))
878 		return (FALSE);
879 	return (TRUE);
880 }
881 
882 bool_t
xdr_BACKCHANNEL_CTL4res(XDR * xdrs,BACKCHANNEL_CTL4res * objp)883 xdr_BACKCHANNEL_CTL4res(XDR *xdrs, BACKCHANNEL_CTL4res *objp)
884 {
885 	if (!xdr_nfsstat4(xdrs, &objp->bcr_status))
886 		return (FALSE);
887 	return (TRUE);
888 }
889 
890 bool_t
xdr_channel_dir_from_client4(XDR * xdrs,channel_dir_from_client4 * objp)891 xdr_channel_dir_from_client4(XDR *xdrs, channel_dir_from_client4 *objp)
892 {
893 	if (!xdr_enum(xdrs, (enum_t *)objp))
894 		return (FALSE);
895 	return (TRUE);
896 }
897 
898 bool_t
xdr_BIND_CONN_TO_SESSION4args(XDR * xdrs,BIND_CONN_TO_SESSION4args * objp)899 xdr_BIND_CONN_TO_SESSION4args(XDR *xdrs, BIND_CONN_TO_SESSION4args *objp)
900 {
901 	if (!xdr_sessionid4(xdrs, objp->bctsa_sessid))
902 		return (FALSE);
903 	if (!xdr_channel_dir_from_client4(xdrs, &objp->bctsa_dir))
904 		return (FALSE);
905 	if (!xdr_bool(xdrs, &objp->bctsa_use_conn_in_rdma_mode))
906 		return (FALSE);
907 	return (TRUE);
908 }
909 
910 bool_t
xdr_channel_dir_from_server4(XDR * xdrs,channel_dir_from_server4 * objp)911 xdr_channel_dir_from_server4(XDR *xdrs, channel_dir_from_server4 *objp)
912 {
913 	if (!xdr_enum(xdrs, (enum_t *)objp))
914 		return (FALSE);
915 	return (TRUE);
916 }
917 
918 bool_t
xdr_BIND_CONN_TO_SESSION4resok(XDR * xdrs,BIND_CONN_TO_SESSION4resok * objp)919 xdr_BIND_CONN_TO_SESSION4resok(XDR *xdrs, BIND_CONN_TO_SESSION4resok *objp)
920 {
921 	if (!xdr_sessionid4(xdrs, objp->bctsr_sessid))
922 		return (FALSE);
923 	if (!xdr_channel_dir_from_server4(xdrs, &objp->bctsr_dir))
924 		return (FALSE);
925 	if (!xdr_bool(xdrs, &objp->bctsr_use_conn_in_rdma_mode))
926 		return (FALSE);
927 	return (TRUE);
928 }
929 
930 bool_t
xdr_BIND_CONN_TO_SESSION4res(XDR * xdrs,BIND_CONN_TO_SESSION4res * objp)931 xdr_BIND_CONN_TO_SESSION4res(XDR *xdrs, BIND_CONN_TO_SESSION4res *objp)
932 {
933 	if (!xdr_nfsstat4(xdrs, &objp->bctsr_status))
934 		return (FALSE);
935 	switch (objp->bctsr_status) {
936 	case NFS4_OK:
937 		if (!xdr_BIND_CONN_TO_SESSION4resok(xdrs,
938 		    &objp->BIND_CONN_TO_SESSION4res_u.bctsr_resok4))
939 			return (FALSE);
940 		break;
941 	}
942 	return (TRUE);
943 }
944 
945 bool_t
xdr_state_protect_ops4(XDR * xdrs,state_protect_ops4 * objp)946 xdr_state_protect_ops4(XDR *xdrs, state_protect_ops4 *objp)
947 {
948 	if (!xdr_bitmap4(xdrs, &objp->spo_must_enforce))
949 		return (FALSE);
950 	if (!xdr_bitmap4(xdrs, &objp->spo_must_allow))
951 		return (FALSE);
952 	return (TRUE);
953 }
954 
955 bool_t
xdr_ssv_sp_parms4(XDR * xdrs,ssv_sp_parms4 * objp)956 xdr_ssv_sp_parms4(XDR *xdrs, ssv_sp_parms4 *objp)
957 {
958 	if (!xdr_state_protect_ops4(xdrs, &objp->ssp_ops))
959 		return (FALSE);
960 	if (!xdr_array(xdrs, (char **)&objp->ssp_hash_algs.ssp_hash_algs_val,
961 	    (uint_t *)&objp->ssp_hash_algs.ssp_hash_algs_len, ~0,
962 	    sizeof (sec_oid4), (xdrproc_t)xdr_sec_oid4))
963 		return (FALSE);
964 	if (!xdr_array(xdrs, (char **)&objp->ssp_encr_algs.ssp_encr_algs_val,
965 	    (uint_t *)&objp->ssp_encr_algs.ssp_encr_algs_len, ~0,
966 	    sizeof (sec_oid4), (xdrproc_t)xdr_sec_oid4))
967 		return (FALSE);
968 	if (!xdr_uint32_t(xdrs, &objp->ssp_window))
969 		return (FALSE);
970 	if (!xdr_uint32_t(xdrs, &objp->ssp_num_gss_handles))
971 		return (FALSE);
972 	return (TRUE);
973 }
974 
975 bool_t
xdr_state_protect_how4(XDR * xdrs,state_protect_how4 * objp)976 xdr_state_protect_how4(XDR *xdrs, state_protect_how4 *objp)
977 {
978 	if (!xdr_enum(xdrs, (enum_t *)objp))
979 		return (FALSE);
980 	return (TRUE);
981 }
982 
983 bool_t
xdr_state_protect4_a(XDR * xdrs,state_protect4_a * objp)984 xdr_state_protect4_a(XDR *xdrs, state_protect4_a *objp)
985 {
986 	if (!xdr_state_protect_how4(xdrs, &objp->spa_how))
987 		return (FALSE);
988 	switch (objp->spa_how) {
989 	case SP4_NONE:
990 		break;
991 	case SP4_MACH_CRED:
992 		if (!xdr_state_protect_ops4(xdrs,
993 		    &objp->state_protect4_a_u.spa_mach_ops))
994 			return (FALSE);
995 		break;
996 	case SP4_SSV:
997 		if (!xdr_ssv_sp_parms4(xdrs,
998 		    &objp->state_protect4_a_u.spa_ssv_parms))
999 			return (FALSE);
1000 		break;
1001 	default:
1002 		return (FALSE);
1003 	}
1004 	return (TRUE);
1005 }
1006 
1007 bool_t
xdr_EXCHANGE_ID4args(XDR * xdrs,EXCHANGE_ID4args * objp)1008 xdr_EXCHANGE_ID4args(XDR *xdrs, EXCHANGE_ID4args *objp)
1009 {
1010 	if (!xdr_client_owner4(xdrs, &objp->eia_clientowner))
1011 		return (FALSE);
1012 	if (!xdr_uint32_t(xdrs, &objp->eia_flags))
1013 		return (FALSE);
1014 	if (!xdr_state_protect4_a(xdrs, &objp->eia_state_protect))
1015 		return (FALSE);
1016 	if (!xdr_array(xdrs,
1017 	    (char **)&objp->eia_client_impl_id.eia_client_impl_id_val,
1018 	    (uint_t *)&objp->eia_client_impl_id.eia_client_impl_id_len, 1,
1019 	    sizeof (nfs_impl_id4), (xdrproc_t)xdr_nfs_impl_id4))
1020 		return (FALSE);
1021 	return (TRUE);
1022 }
1023 
1024 bool_t
xdr_ssv_prot_info4(XDR * xdrs,ssv_prot_info4 * objp)1025 xdr_ssv_prot_info4(XDR *xdrs, ssv_prot_info4 *objp)
1026 {
1027 	if (!xdr_state_protect_ops4(xdrs, &objp->spi_ops))
1028 		return (FALSE);
1029 	if (!xdr_uint32_t(xdrs, &objp->spi_hash_alg))
1030 		return (FALSE);
1031 	if (!xdr_uint32_t(xdrs, &objp->spi_encr_alg))
1032 		return (FALSE);
1033 	if (!xdr_uint32_t(xdrs, &objp->spi_ssv_len))
1034 		return (FALSE);
1035 	if (!xdr_uint32_t(xdrs, &objp->spi_window))
1036 		return (FALSE);
1037 	if (!xdr_array(xdrs, (char **)&objp->spi_handles.spi_handles_val,
1038 	    (uint_t *)&objp->spi_handles.spi_handles_len, ~0,
1039 	    sizeof (gsshandle4_t), (xdrproc_t)xdr_gsshandle4_t))
1040 		return (FALSE);
1041 	return (TRUE);
1042 }
1043 
1044 bool_t
xdr_state_protect4_r(XDR * xdrs,state_protect4_r * objp)1045 xdr_state_protect4_r(XDR *xdrs, state_protect4_r *objp)
1046 {
1047 	if (!xdr_state_protect_how4(xdrs, &objp->spr_how))
1048 		return (FALSE);
1049 	switch (objp->spr_how) {
1050 	case SP4_NONE:
1051 		break;
1052 	case SP4_MACH_CRED:
1053 		if (!xdr_state_protect_ops4(xdrs,
1054 		    &objp->state_protect4_r_u.spr_mach_ops))
1055 			return (FALSE);
1056 		break;
1057 	case SP4_SSV:
1058 		if (!xdr_ssv_prot_info4(xdrs,
1059 		    &objp->state_protect4_r_u.spr_ssv_info))
1060 			return (FALSE);
1061 		break;
1062 	default:
1063 		return (FALSE);
1064 	}
1065 	return (TRUE);
1066 }
1067 
1068 bool_t
xdr_EXCHANGE_ID4resok(XDR * xdrs,EXCHANGE_ID4resok * objp)1069 xdr_EXCHANGE_ID4resok(XDR *xdrs, EXCHANGE_ID4resok *objp)
1070 {
1071 	if (!xdr_clientid4(xdrs, &objp->eir_clientid))
1072 		return (FALSE);
1073 	if (!xdr_sequenceid4(xdrs, &objp->eir_sequenceid))
1074 		return (FALSE);
1075 	if (!xdr_uint32_t(xdrs, &objp->eir_flags))
1076 		return (FALSE);
1077 	if (!xdr_state_protect4_r(xdrs, &objp->eir_state_protect))
1078 		return (FALSE);
1079 	if (!xdr_server_owner4(xdrs, &objp->eir_server_owner))
1080 		return (FALSE);
1081 	if (!xdr_bytes(xdrs,
1082 	    (char **)&objp->eir_server_scope.eir_server_scope_val,
1083 	    (uint_t *)&objp->eir_server_scope.eir_server_scope_len,
1084 	    NFS4_OPAQUE_LIMIT))
1085 		return (FALSE);
1086 	if (!xdr_array(xdrs,
1087 	    (char **)&objp->eir_server_impl_id.eir_server_impl_id_val,
1088 	    (uint_t *)&objp->eir_server_impl_id.eir_server_impl_id_len, 1,
1089 	    sizeof (nfs_impl_id4), (xdrproc_t)xdr_nfs_impl_id4))
1090 		return (FALSE);
1091 	return (TRUE);
1092 }
1093 
1094 bool_t
xdr_EXCHANGE_ID4res(XDR * xdrs,EXCHANGE_ID4res * objp)1095 xdr_EXCHANGE_ID4res(XDR *xdrs, EXCHANGE_ID4res *objp)
1096 {
1097 	if (!xdr_nfsstat4(xdrs, &objp->eir_status))
1098 		return (FALSE);
1099 	switch (objp->eir_status) {
1100 	case NFS4_OK:
1101 		if (!xdr_EXCHANGE_ID4resok(xdrs,
1102 		    &objp->EXCHANGE_ID4res_u.eir_resok4))
1103 			return (FALSE);
1104 		break;
1105 	}
1106 	return (TRUE);
1107 }
1108 
1109 bool_t
xdr_channel_attrs4(XDR * xdrs,channel_attrs4 * objp)1110 xdr_channel_attrs4(XDR *xdrs, channel_attrs4 *objp)
1111 {
1112 	if (!xdr_count4(xdrs, &objp->ca_headerpadsize))
1113 		return (FALSE);
1114 	if (!xdr_count4(xdrs, &objp->ca_maxrequestsize))
1115 		return (FALSE);
1116 	if (!xdr_count4(xdrs, &objp->ca_maxresponsesize))
1117 		return (FALSE);
1118 	if (!xdr_count4(xdrs, &objp->ca_maxresponsesize_cached))
1119 		return (FALSE);
1120 	if (!xdr_count4(xdrs, &objp->ca_maxoperations))
1121 		return (FALSE);
1122 	if (!xdr_count4(xdrs, &objp->ca_maxrequests))
1123 		return (FALSE);
1124 	if (!xdr_array(xdrs, (char **)&objp->ca_rdma_ird.ca_rdma_ird_val,
1125 	    (uint_t *)&objp->ca_rdma_ird.ca_rdma_ird_len, 1,
1126 	    sizeof (uint32_t), (xdrproc_t)xdr_uint32_t))
1127 		return (FALSE);
1128 	return (TRUE);
1129 }
1130 
1131 bool_t
xdr_CREATE_SESSION4args(XDR * xdrs,CREATE_SESSION4args * objp)1132 xdr_CREATE_SESSION4args(XDR *xdrs, CREATE_SESSION4args *objp)
1133 {
1134 
1135 	if (!xdr_clientid4(xdrs, &objp->csa_clientid))
1136 		return (FALSE);
1137 	if (!xdr_sequenceid4(xdrs, &objp->csa_sequence))
1138 		return (FALSE);
1139 	if (!xdr_uint32_t(xdrs, &objp->csa_flags))
1140 		return (FALSE);
1141 	if (!xdr_channel_attrs4(xdrs, &objp->csa_fore_chan_attrs))
1142 		return (FALSE);
1143 	if (!xdr_channel_attrs4(xdrs, &objp->csa_back_chan_attrs))
1144 		return (FALSE);
1145 	if (!xdr_uint32_t(xdrs, &objp->csa_cb_program))
1146 		return (FALSE);
1147 	if (!xdr_array(xdrs, (char **)&objp->csa_sec_parms.csa_sec_parms_val,
1148 	    (uint_t *)&objp->csa_sec_parms.csa_sec_parms_len, ~0,
1149 	    sizeof (callback_sec_parms4), (xdrproc_t)xdr_callback_sec_parms4))
1150 		return (FALSE);
1151 	return (TRUE);
1152 }
1153 
1154 bool_t
xdr_CREATE_SESSION4resok(XDR * xdrs,CREATE_SESSION4resok * objp)1155 xdr_CREATE_SESSION4resok(XDR *xdrs, CREATE_SESSION4resok *objp)
1156 {
1157 	if (!xdr_sessionid4(xdrs, objp->csr_sessionid))
1158 		return (FALSE);
1159 	if (!xdr_sequenceid4(xdrs, &objp->csr_sequence))
1160 		return (FALSE);
1161 	if (!xdr_uint32_t(xdrs, &objp->csr_flags))
1162 		return (FALSE);
1163 	if (!xdr_channel_attrs4(xdrs, &objp->csr_fore_chan_attrs))
1164 		return (FALSE);
1165 	if (!xdr_channel_attrs4(xdrs, &objp->csr_back_chan_attrs))
1166 		return (FALSE);
1167 	return (TRUE);
1168 }
1169 
1170 bool_t
xdr_CREATE_SESSION4res(XDR * xdrs,CREATE_SESSION4res * objp)1171 xdr_CREATE_SESSION4res(XDR *xdrs, CREATE_SESSION4res *objp)
1172 {
1173 	if (!xdr_nfsstat4(xdrs, &objp->csr_status))
1174 		return (FALSE);
1175 	switch (objp->csr_status) {
1176 	case NFS4_OK:
1177 		if (!xdr_CREATE_SESSION4resok(xdrs,
1178 		    &objp->CREATE_SESSION4res_u.csr_resok4))
1179 			return (FALSE);
1180 		break;
1181 	}
1182 	return (TRUE);
1183 }
1184 
1185 bool_t
xdr_DESTROY_SESSION4args(XDR * xdrs,DESTROY_SESSION4args * objp)1186 xdr_DESTROY_SESSION4args(XDR *xdrs, DESTROY_SESSION4args *objp)
1187 {
1188 	if (!xdr_sessionid4(xdrs, objp->dsa_sessionid))
1189 		return (FALSE);
1190 	return (TRUE);
1191 }
1192 
1193 bool_t
xdr_DESTROY_SESSION4res(XDR * xdrs,DESTROY_SESSION4res * objp)1194 xdr_DESTROY_SESSION4res(XDR *xdrs, DESTROY_SESSION4res *objp)
1195 {
1196 	if (!xdr_nfsstat4(xdrs, &objp->dsr_status))
1197 		return (FALSE);
1198 	return (TRUE);
1199 }
1200 
1201 bool_t
xdr_FREE_STATEID4args(XDR * xdrs,FREE_STATEID4args * objp)1202 xdr_FREE_STATEID4args(XDR *xdrs, FREE_STATEID4args *objp)
1203 {
1204 	if (!xdr_stateid4(xdrs, &objp->fsa_stateid))
1205 		return (FALSE);
1206 	return (TRUE);
1207 }
1208 
1209 bool_t
xdr_FREE_STATEID4res(XDR * xdrs,FREE_STATEID4res * objp)1210 xdr_FREE_STATEID4res(XDR *xdrs, FREE_STATEID4res *objp)
1211 {
1212 	if (!xdr_nfsstat4(xdrs, &objp->fsr_status))
1213 		return (FALSE);
1214 	return (TRUE);
1215 }
1216 
1217 bool_t
xdr_attr_notice4(XDR * xdrs,attr_notice4 * objp)1218 xdr_attr_notice4(XDR *xdrs, attr_notice4 *objp)
1219 {
1220 	if (!xdr_nfstime4(xdrs, objp))
1221 		return (FALSE);
1222 	return (TRUE);
1223 }
1224 
1225 bool_t
xdr_GET_DIR_DELEGATION4args(XDR * xdrs,GET_DIR_DELEGATION4args * objp)1226 xdr_GET_DIR_DELEGATION4args(XDR *xdrs, GET_DIR_DELEGATION4args *objp)
1227 {
1228 	if (!xdr_bool(xdrs, &objp->gdda_signal_deleg_avail))
1229 		return (FALSE);
1230 	if (!xdr_bitmap4(xdrs, &objp->gdda_notification_types))
1231 		return (FALSE);
1232 	if (!xdr_attr_notice4(xdrs, &objp->gdda_child_attr_delay))
1233 		return (FALSE);
1234 	if (!xdr_attr_notice4(xdrs, &objp->gdda_dir_attr_delay))
1235 		return (FALSE);
1236 	if (!xdr_bitmap4(xdrs, &objp->gdda_child_attributes))
1237 		return (FALSE);
1238 	if (!xdr_bitmap4(xdrs, &objp->gdda_dir_attributes))
1239 		return (FALSE);
1240 	return (TRUE);
1241 }
1242 
1243 bool_t
xdr_GET_DIR_DELEGATION4resok(XDR * xdrs,GET_DIR_DELEGATION4resok * objp)1244 xdr_GET_DIR_DELEGATION4resok(XDR *xdrs, GET_DIR_DELEGATION4resok *objp)
1245 {
1246 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->gddr_cookieverf))
1247 		return (FALSE);
1248 	if (!xdr_stateid4(xdrs, &objp->gddr_stateid))
1249 		return (FALSE);
1250 	if (!xdr_bitmap4(xdrs, &objp->gddr_notification))
1251 		return (FALSE);
1252 	if (!xdr_bitmap4(xdrs, &objp->gddr_child_attributes))
1253 		return (FALSE);
1254 	if (!xdr_bitmap4(xdrs, &objp->gddr_dir_attributes))
1255 		return (FALSE);
1256 	return (TRUE);
1257 }
1258 
1259 bool_t
xdr_gddrnf4_status(XDR * xdrs,gddrnf4_status * objp)1260 xdr_gddrnf4_status(XDR *xdrs, gddrnf4_status *objp)
1261 {
1262 	if (!xdr_enum(xdrs, (enum_t *)objp))
1263 		return (FALSE);
1264 	return (TRUE);
1265 }
1266 
1267 bool_t
xdr_GET_DIR_DELEGATION4res_non_fatal(XDR * xdrs,GET_DIR_DELEGATION4res_non_fatal * objp)1268 xdr_GET_DIR_DELEGATION4res_non_fatal(XDR *xdrs,
1269     GET_DIR_DELEGATION4res_non_fatal *objp)
1270 {
1271 	if (!xdr_gddrnf4_status(xdrs, &objp->gddrnf_status))
1272 		return (FALSE);
1273 	switch (objp->gddrnf_status) {
1274 	case GDD4_OK:
1275 		if (!xdr_GET_DIR_DELEGATION4resok(xdrs,
1276 		    &objp->GET_DIR_DELEGATION4res_non_fatal_u.gddrnf_resok4))
1277 			return (FALSE);
1278 		break;
1279 	case GDD4_UNAVAIL:
1280 		if (!xdr_bool(xdrs, &objp->GET_DIR_DELEGATION4res_non_fatal_u.
1281 		    gddrnf_will_signal_deleg_avail))
1282 			return (FALSE);
1283 		break;
1284 	default:
1285 		return (FALSE);
1286 	}
1287 	return (TRUE);
1288 }
1289 
1290 bool_t
xdr_GET_DIR_DELEGATION4res(XDR * xdrs,GET_DIR_DELEGATION4res * objp)1291 xdr_GET_DIR_DELEGATION4res(XDR *xdrs, GET_DIR_DELEGATION4res *objp)
1292 {
1293 	if (!xdr_nfsstat4(xdrs, &objp->gddr_status))
1294 		return (FALSE);
1295 	switch (objp->gddr_status) {
1296 	case NFS4_OK:
1297 		if (!xdr_GET_DIR_DELEGATION4res_non_fatal(xdrs,
1298 		    &objp->GET_DIR_DELEGATION4res_u.gddr_res_non_fatal4))
1299 			return (FALSE);
1300 		break;
1301 	}
1302 	return (TRUE);
1303 }
1304 
1305 /*
1306  * Special xdr function to encode single word bitmaps for
1307  * notification bitmaps which only need a single word.
1308  */
1309 bool_t
xdr_bitmap4_notify(XDR * xdrs,bitmap4 * objp)1310 xdr_bitmap4_notify(XDR *xdrs, bitmap4 *objp)
1311 {
1312 	int32_t len = 1;
1313 
1314 	ASSERT(xdrs->x_op == XDR_ENCODE);
1315 	if (!XDR_PUTINT32(xdrs, &len))
1316 		return (FALSE);
1317 #if defined(_BIG_ENDIAN)
1318 	return (XDR_PUTINT32(xdrs, (int32_t *)objp));
1319 #elif defined(_LITTLE_ENDIAN)
1320 	return (XDR_PUTINT32(xdrs, (int32_t *)objp+1));
1321 #endif
1322 }
1323 
1324 bool_t
xdr_GETDEVICEINFO4args(XDR * xdrs,GETDEVICEINFO4args * objp)1325 xdr_GETDEVICEINFO4args(XDR *xdrs, GETDEVICEINFO4args *objp)
1326 {
1327 	if (!xdr_deviceid4(xdrs, objp->gdia_device_id))
1328 		return (FALSE);
1329 	if (!xdr_layouttype4(xdrs, &objp->gdia_layout_type))
1330 		return (FALSE);
1331 	if (!xdr_count4(xdrs, &objp->gdia_maxcount))
1332 		return (FALSE);
1333 	if (xdrs->x_op == XDR_ENCODE) {
1334 		if (!xdr_bitmap4_notify(xdrs, &objp->gdia_notify_types))
1335 			return (FALSE);
1336 	} else
1337 		if (!xdr_bitmap4(xdrs, &objp->gdia_notify_types))
1338 			return (FALSE);
1339 	return (TRUE);
1340 }
1341 
1342 bool_t
xdr_GETDEVICEINFO4resok(XDR * xdrs,GETDEVICEINFO4resok * objp)1343 xdr_GETDEVICEINFO4resok(XDR *xdrs, GETDEVICEINFO4resok *objp)
1344 {
1345 	if (!xdr_device_addr4(xdrs, &objp->gdir_device_addr))
1346 		return (FALSE);
1347 	if (xdrs->x_op == XDR_ENCODE) {
1348 		if (!xdr_bitmap4_notify(xdrs, &objp->gdir_notification))
1349 			return (FALSE);
1350 	} else
1351 		if (!xdr_bitmap4(xdrs, &objp->gdir_notification))
1352 			return (FALSE);
1353 	return (TRUE);
1354 }
1355 
1356 bool_t
xdr_GETDEVICEINFO4res(XDR * xdrs,GETDEVICEINFO4res * objp)1357 xdr_GETDEVICEINFO4res(XDR *xdrs, GETDEVICEINFO4res *objp)
1358 {
1359 	if (!xdr_nfsstat4(xdrs, &objp->gdir_status))
1360 		return (FALSE);
1361 	switch (objp->gdir_status) {
1362 	case NFS4_OK:
1363 		if (!xdr_GETDEVICEINFO4resok(xdrs,
1364 		    &objp->GETDEVICEINFO4res_u.gdir_resok4))
1365 			return (FALSE);
1366 		break;
1367 	case NFS4ERR_TOOSMALL:
1368 		if (!xdr_count4(xdrs, &objp->GETDEVICEINFO4res_u.gdir_mincount))
1369 			return (FALSE);
1370 		break;
1371 	}
1372 	return (TRUE);
1373 }
1374 
1375 bool_t
xdr_GETDEVICELIST4args(XDR * xdrs,GETDEVICELIST4args * objp)1376 xdr_GETDEVICELIST4args(XDR *xdrs, GETDEVICELIST4args *objp)
1377 {
1378 	if (!xdr_layouttype4(xdrs, &objp->gdla_layout_type))
1379 		return (FALSE);
1380 	if (!xdr_count4(xdrs, &objp->gdla_maxdevices))
1381 		return (FALSE);
1382 	if (!xdr_nfs_cookie4(xdrs, &objp->gdla_cookie))
1383 		return (FALSE);
1384 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->gdla_cookieverf))
1385 		return (FALSE);
1386 	return (TRUE);
1387 }
1388 
1389 bool_t
xdr_GETDEVICELIST4resok(XDR * xdrs,GETDEVICELIST4resok * objp)1390 xdr_GETDEVICELIST4resok(XDR *xdrs, GETDEVICELIST4resok *objp)
1391 {
1392 	if (!xdr_nfs_cookie4(xdrs, &objp->gdlr_cookie))
1393 		return (FALSE);
1394 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->gdlr_cookieverf))
1395 		return (FALSE);
1396 	if (!xdr_array(xdrs,
1397 	    (char **)&objp->gdlr_deviceid_list.gdlr_deviceid_list_val,
1398 	    (uint_t *)&objp->gdlr_deviceid_list.gdlr_deviceid_list_len,
1399 	    ~0, sizeof (deviceid4), (xdrproc_t)xdr_deviceid4))
1400 		return (FALSE);
1401 	if (!xdr_bool(xdrs, &objp->gdlr_eof))
1402 		return (FALSE);
1403 	return (TRUE);
1404 }
1405 
1406 bool_t
xdr_GETDEVICELIST4res(XDR * xdrs,GETDEVICELIST4res * objp)1407 xdr_GETDEVICELIST4res(XDR *xdrs, GETDEVICELIST4res *objp)
1408 {
1409 	if (!xdr_nfsstat4(xdrs, &objp->gdlr_status))
1410 		return (FALSE);
1411 	switch (objp->gdlr_status) {
1412 	case NFS4_OK:
1413 		if (!xdr_GETDEVICELIST4resok(xdrs,
1414 		    &objp->GETDEVICELIST4res_u.gdlr_resok4))
1415 			return (FALSE);
1416 		break;
1417 	default:
1418 		break;
1419 	}
1420 	return (TRUE);
1421 }
1422 
1423 bool_t
xdr_newtime4(XDR * xdrs,newtime4 * objp)1424 xdr_newtime4(XDR *xdrs, newtime4 *objp)
1425 {
1426 	if (!xdr_bool(xdrs, &objp->nt_timechanged))
1427 		return (FALSE);
1428 	switch (objp->nt_timechanged) {
1429 	case TRUE:
1430 		if (!xdr_nfstime4(xdrs, &objp->newtime4_u.nt_time))
1431 			return (FALSE);
1432 		break;
1433 	case FALSE:
1434 		break;
1435 	default:
1436 		return (FALSE);
1437 	}
1438 	return (TRUE);
1439 }
1440 
1441 bool_t
xdr_newoffset4(XDR * xdrs,newoffset4 * objp)1442 xdr_newoffset4(XDR *xdrs, newoffset4 *objp)
1443 {
1444 	if (!xdr_bool(xdrs, &objp->no_newoffset))
1445 		return (FALSE);
1446 	switch (objp->no_newoffset) {
1447 	case TRUE:
1448 		if (!xdr_offset4(xdrs, &objp->newoffset4_u.no_offset))
1449 			return (FALSE);
1450 		break;
1451 	case FALSE:
1452 		break;
1453 	default:
1454 		return (FALSE);
1455 	}
1456 	return (TRUE);
1457 }
1458 
1459 bool_t
xdr_LAYOUTCOMMIT4args(XDR * xdrs,LAYOUTCOMMIT4args * objp)1460 xdr_LAYOUTCOMMIT4args(XDR *xdrs, LAYOUTCOMMIT4args *objp)
1461 {
1462 	if (!xdr_offset4(xdrs, &objp->loca_offset))
1463 		return (FALSE);
1464 	if (!xdr_length4(xdrs, &objp->loca_length))
1465 		return (FALSE);
1466 	if (!xdr_bool(xdrs, &objp->loca_reclaim))
1467 		return (FALSE);
1468 	if (!xdr_stateid4(xdrs, &objp->loca_stateid))
1469 		return (FALSE);
1470 	if (!xdr_newoffset4(xdrs, &objp->loca_last_write_offset))
1471 		return (FALSE);
1472 	if (!xdr_newtime4(xdrs, &objp->loca_time_modify))
1473 		return (FALSE);
1474 	if (!xdr_layoutupdate4(xdrs, &objp->loca_layoutupdate))
1475 		return (FALSE);
1476 	return (TRUE);
1477 }
1478 
1479 bool_t
xdr_newsize4(XDR * xdrs,newsize4 * objp)1480 xdr_newsize4(XDR *xdrs, newsize4 *objp)
1481 {
1482 	if (!xdr_bool(xdrs, &objp->ns_sizechanged))
1483 		return (FALSE);
1484 	switch (objp->ns_sizechanged) {
1485 	case TRUE:
1486 		if (!xdr_length4(xdrs, &objp->newsize4_u.ns_size))
1487 			return (FALSE);
1488 		break;
1489 	case FALSE:
1490 		break;
1491 	default:
1492 		return (FALSE);
1493 	}
1494 	return (TRUE);
1495 }
1496 
1497 bool_t
xdr_LAYOUTCOMMIT4resok(XDR * xdrs,LAYOUTCOMMIT4resok * objp)1498 xdr_LAYOUTCOMMIT4resok(XDR *xdrs, LAYOUTCOMMIT4resok *objp)
1499 {
1500 	if (!xdr_newsize4(xdrs, &objp->locr_newsize))
1501 		return (FALSE);
1502 	return (TRUE);
1503 }
1504 
1505 bool_t
xdr_LAYOUTCOMMIT4res(XDR * xdrs,LAYOUTCOMMIT4res * objp)1506 xdr_LAYOUTCOMMIT4res(XDR *xdrs, LAYOUTCOMMIT4res *objp)
1507 {
1508 	if (!xdr_nfsstat4(xdrs, &objp->locr_status))
1509 		return (FALSE);
1510 	switch (objp->locr_status) {
1511 	case NFS4_OK:
1512 		if (!xdr_LAYOUTCOMMIT4resok(xdrs,
1513 		    &objp->LAYOUTCOMMIT4res_u.locr_resok4))
1514 			return (FALSE);
1515 		break;
1516 	}
1517 	return (TRUE);
1518 }
1519 
1520 bool_t
xdr_LAYOUTGET4args(XDR * xdrs,LAYOUTGET4args * objp)1521 xdr_LAYOUTGET4args(XDR *xdrs, LAYOUTGET4args *objp)
1522 {
1523 	if (!xdr_bool(xdrs, &objp->loga_signal_layout_avail))
1524 		return (FALSE);
1525 	if (!xdr_layouttype4(xdrs, &objp->loga_layout_type))
1526 		return (FALSE);
1527 	if (!xdr_layoutiomode4(xdrs, &objp->loga_iomode))
1528 		return (FALSE);
1529 	if (!xdr_offset4(xdrs, &objp->loga_offset))
1530 		return (FALSE);
1531 	if (!xdr_length4(xdrs, &objp->loga_length))
1532 		return (FALSE);
1533 	if (!xdr_length4(xdrs, &objp->loga_minlength))
1534 		return (FALSE);
1535 	if (!xdr_stateid4(xdrs, &objp->loga_stateid))
1536 		return (FALSE);
1537 	if (!xdr_count4(xdrs, &objp->loga_maxcount))
1538 		return (FALSE);
1539 	return (TRUE);
1540 }
1541 
1542 bool_t
xdr_LAYOUTGET4resok(XDR * xdrs,LAYOUTGET4resok * objp)1543 xdr_LAYOUTGET4resok(XDR *xdrs, LAYOUTGET4resok *objp)
1544 {
1545 	if (!xdr_bool(xdrs, &objp->logr_return_on_close))
1546 		return (FALSE);
1547 	if (!xdr_stateid4(xdrs, &objp->logr_stateid))
1548 		return (FALSE);
1549 	if (!xdr_array(xdrs, (char **)&objp->logr_layout.logr_layout_val,
1550 	    (uint_t *)&objp->logr_layout.logr_layout_len, ~0,
1551 	    sizeof (layout4), (xdrproc_t)xdr_layout4))
1552 		return (FALSE);
1553 	return (TRUE);
1554 }
1555 
1556 bool_t
xdr_LAYOUTGET4res(XDR * xdrs,LAYOUTGET4res * objp)1557 xdr_LAYOUTGET4res(XDR *xdrs, LAYOUTGET4res *objp)
1558 {
1559 	if (!xdr_nfsstat4(xdrs, &objp->logr_status))
1560 		return (FALSE);
1561 	switch (objp->logr_status) {
1562 	case NFS4_OK:
1563 		if (!xdr_LAYOUTGET4resok(xdrs,
1564 		    &objp->LAYOUTGET4res_u.logr_resok4))
1565 			return (FALSE);
1566 		break;
1567 	case NFS4ERR_LAYOUTTRYLATER:
1568 		if (!xdr_bool(xdrs,
1569 		    &objp->LAYOUTGET4res_u.logr_will_signal_layout_avail))
1570 			return (FALSE);
1571 		break;
1572 	}
1573 	return (TRUE);
1574 }
1575 
1576 bool_t
xdr_LAYOUTRETURN4args(XDR * xdrs,LAYOUTRETURN4args * objp)1577 xdr_LAYOUTRETURN4args(XDR *xdrs, LAYOUTRETURN4args *objp)
1578 {
1579 	if (!xdr_bool(xdrs, &objp->lora_reclaim))
1580 		return (FALSE);
1581 	if (!xdr_layouttype4(xdrs, &objp->lora_layout_type))
1582 		return (FALSE);
1583 	if (!xdr_layoutiomode4(xdrs, &objp->lora_iomode))
1584 		return (FALSE);
1585 	if (!xdr_layoutreturn4(xdrs, &objp->lora_layoutreturn))
1586 		return (FALSE);
1587 	return (TRUE);
1588 }
1589 
1590 bool_t
xdr_layoutreturn_stateid(XDR * xdrs,layoutreturn_stateid * objp)1591 xdr_layoutreturn_stateid(XDR *xdrs, layoutreturn_stateid *objp)
1592 {
1593 	if (!xdr_bool(xdrs, &objp->lrs_present))
1594 		return (FALSE);
1595 	switch (objp->lrs_present) {
1596 	case TRUE:
1597 		if (!xdr_stateid4(xdrs,
1598 		    &objp->layoutreturn_stateid_u.lrs_stateid))
1599 			return (FALSE);
1600 		break;
1601 	case FALSE:
1602 		break;
1603 	default:
1604 		return (FALSE);
1605 	}
1606 	return (TRUE);
1607 }
1608 
1609 bool_t
xdr_LAYOUTRETURN4res(XDR * xdrs,LAYOUTRETURN4res * objp)1610 xdr_LAYOUTRETURN4res(XDR *xdrs, LAYOUTRETURN4res *objp)
1611 {
1612 	if (!xdr_nfsstat4(xdrs, &objp->lorr_status))
1613 		return (FALSE);
1614 	switch (objp->lorr_status) {
1615 	case NFS4_OK:
1616 		if (!xdr_layoutreturn_stateid(xdrs,
1617 		    &objp->LAYOUTRETURN4res_u.lorr_stateid))
1618 			return (FALSE);
1619 		break;
1620 	}
1621 	return (TRUE);
1622 }
1623 
1624 bool_t
xdr_secinfo_style4(XDR * xdrs,secinfo_style4 * objp)1625 xdr_secinfo_style4(XDR *xdrs, secinfo_style4 *objp)
1626 {
1627 	if (!xdr_enum(xdrs, (enum_t *)objp))
1628 		return (FALSE);
1629 	return (TRUE);
1630 }
1631 
1632 bool_t
xdr_SECINFO_NO_NAME4args(XDR * xdrs,SECINFO_NO_NAME4args * objp)1633 xdr_SECINFO_NO_NAME4args(XDR *xdrs, SECINFO_NO_NAME4args *objp)
1634 {
1635 	if (!xdr_secinfo_style4(xdrs, objp))
1636 		return (FALSE);
1637 	return (TRUE);
1638 }
1639 
1640 bool_t
xdr_SECINFO_NO_NAME4res(XDR * xdrs,SECINFO_NO_NAME4res * objp)1641 xdr_SECINFO_NO_NAME4res(XDR *xdrs, SECINFO_NO_NAME4res *objp)
1642 {
1643 	if (!xdr_SECINFO4res(xdrs, objp))
1644 		return (FALSE);
1645 	return (TRUE);
1646 }
1647 
1648 bool_t
xdr_SEQUENCE4args(XDR * xdrs,SEQUENCE4args * objp)1649 xdr_SEQUENCE4args(XDR *xdrs, SEQUENCE4args *objp)
1650 {
1651 	if (!xdr_sessionid4(xdrs, objp->sa_sessionid))
1652 		return (FALSE);
1653 	if (!xdr_sequenceid4(xdrs, &objp->sa_sequenceid))
1654 		return (FALSE);
1655 	if (!xdr_slotid4(xdrs, &objp->sa_slotid))
1656 		return (FALSE);
1657 	if (!xdr_slotid4(xdrs, &objp->sa_highest_slotid))
1658 		return (FALSE);
1659 	if (!xdr_bool(xdrs, &objp->sa_cachethis))
1660 		return (FALSE);
1661 	return (TRUE);
1662 }
1663 
1664 bool_t
xdr_SEQUENCE4resok(XDR * xdrs,SEQUENCE4resok * objp)1665 xdr_SEQUENCE4resok(XDR *xdrs, SEQUENCE4resok *objp)
1666 {
1667 	if (!xdr_sessionid4(xdrs, objp->sr_sessionid))
1668 		return (FALSE);
1669 	if (!xdr_sequenceid4(xdrs, &objp->sr_sequenceid))
1670 		return (FALSE);
1671 	if (!xdr_slotid4(xdrs, &objp->sr_slotid))
1672 		return (FALSE);
1673 	if (!xdr_slotid4(xdrs, &objp->sr_highest_slotid))
1674 		return (FALSE);
1675 	if (!xdr_slotid4(xdrs, &objp->sr_target_highest_slotid))
1676 		return (FALSE);
1677 	if (!xdr_uint32_t(xdrs, &objp->sr_status_flags))
1678 		return (FALSE);
1679 	return (TRUE);
1680 }
1681 
1682 bool_t
xdr_SEQUENCE4res(XDR * xdrs,SEQUENCE4res * objp)1683 xdr_SEQUENCE4res(XDR *xdrs, SEQUENCE4res *objp)
1684 {
1685 	if (!xdr_nfsstat4(xdrs, &objp->sr_status))
1686 		return (FALSE);
1687 	switch (objp->sr_status) {
1688 	case NFS4_OK:
1689 		if (!xdr_SEQUENCE4resok(xdrs, &objp->SEQUENCE4res_u.sr_resok4))
1690 			return (FALSE);
1691 		break;
1692 	}
1693 	return (TRUE);
1694 }
1695 
1696 bool_t
xdr_ssa_digest_input4(XDR * xdrs,ssa_digest_input4 * objp)1697 xdr_ssa_digest_input4(XDR *xdrs, ssa_digest_input4 *objp)
1698 {
1699 	if (!xdr_SEQUENCE4args(xdrs, &objp->sdi_seqargs))
1700 		return (FALSE);
1701 	return (TRUE);
1702 }
1703 
1704 bool_t
xdr_SET_SSV4args(XDR * xdrs,SET_SSV4args * objp)1705 xdr_SET_SSV4args(XDR *xdrs, SET_SSV4args *objp)
1706 {
1707 	if (!xdr_bytes(xdrs, (char **)&objp->ssa_ssv.ssa_ssv_val,
1708 	    (uint_t *)&objp->ssa_ssv.ssa_ssv_len, ~0))
1709 		return (FALSE);
1710 	if (!xdr_bytes(xdrs, (char **)&objp->ssa_digest.ssa_digest_val,
1711 	    (uint_t *)&objp->ssa_digest.ssa_digest_len, ~0))
1712 		return (FALSE);
1713 	return (TRUE);
1714 }
1715 
1716 bool_t
xdr_ssr_digest_input4(XDR * xdrs,ssr_digest_input4 * objp)1717 xdr_ssr_digest_input4(XDR *xdrs, ssr_digest_input4 *objp)
1718 {
1719 	if (!xdr_SEQUENCE4res(xdrs, &objp->sdi_seqres))
1720 		return (FALSE);
1721 	return (TRUE);
1722 }
1723 
1724 bool_t
xdr_SET_SSV4resok(XDR * xdrs,SET_SSV4resok * objp)1725 xdr_SET_SSV4resok(XDR *xdrs, SET_SSV4resok *objp)
1726 {
1727 	if (!xdr_bytes(xdrs, (char **)&objp->ssr_digest.ssr_digest_val,
1728 	    (uint_t *)&objp->ssr_digest.ssr_digest_len, ~0))
1729 		return (FALSE);
1730 	return (TRUE);
1731 }
1732 
1733 bool_t
xdr_SET_SSV4res(XDR * xdrs,SET_SSV4res * objp)1734 xdr_SET_SSV4res(XDR *xdrs, SET_SSV4res *objp)
1735 {
1736 	if (!xdr_nfsstat4(xdrs, &objp->ssr_status))
1737 		return (FALSE);
1738 	switch (objp->ssr_status) {
1739 	case NFS4_OK:
1740 		if (!xdr_SET_SSV4resok(xdrs, &objp->SET_SSV4res_u.ssr_resok4))
1741 			return (FALSE);
1742 		break;
1743 	}
1744 	return (TRUE);
1745 }
1746 
1747 bool_t
xdr_TEST_STATEID4args(XDR * xdrs,TEST_STATEID4args * objp)1748 xdr_TEST_STATEID4args(XDR *xdrs, TEST_STATEID4args *objp)
1749 {
1750 	if (!xdr_array(xdrs, (char **)&objp->ts_stateids.ts_stateids_val,
1751 	    (uint_t *)&objp->ts_stateids.ts_stateids_len, ~0,
1752 	    sizeof (stateid4), (xdrproc_t)xdr_stateid4))
1753 		return (FALSE);
1754 	return (TRUE);
1755 }
1756 
1757 bool_t
xdr_TEST_STATEID4resok(XDR * xdrs,TEST_STATEID4resok * objp)1758 xdr_TEST_STATEID4resok(XDR *xdrs, TEST_STATEID4resok *objp)
1759 {
1760 	if (!xdr_array(xdrs,
1761 	    (char **)&objp->tsr_status_codes.tsr_status_codes_val,
1762 	    (uint_t *)&objp->tsr_status_codes.tsr_status_codes_len, ~0,
1763 	    sizeof (nfsstat4), (xdrproc_t)xdr_nfsstat4))
1764 		return (FALSE);
1765 	return (TRUE);
1766 }
1767 
1768 bool_t
xdr_TEST_STATEID4res(XDR * xdrs,TEST_STATEID4res * objp)1769 xdr_TEST_STATEID4res(XDR *xdrs, TEST_STATEID4res *objp)
1770 {
1771 	if (!xdr_nfsstat4(xdrs, &objp->tsr_status))
1772 		return (FALSE);
1773 	switch (objp->tsr_status) {
1774 	case NFS4_OK:
1775 		if (!xdr_TEST_STATEID4resok(xdrs,
1776 		    &objp->TEST_STATEID4res_u.tsr_resok4))
1777 			return (FALSE);
1778 		break;
1779 	}
1780 	return (TRUE);
1781 }
1782 
1783 bool_t
xdr_deleg_claim4(XDR * xdrs,deleg_claim4 * objp)1784 xdr_deleg_claim4(XDR *xdrs, deleg_claim4 *objp)
1785 {
1786 	if (!xdr_open_claim_type4(xdrs, &objp->dc_claim))
1787 		return (FALSE);
1788 	switch (objp->dc_claim) {
1789 	case CLAIM_FH:
1790 		break;
1791 	case CLAIM_DELEG_PREV_FH:
1792 		break;
1793 	case CLAIM_PREVIOUS:
1794 		if (!xdr_open_delegation_type4(xdrs,
1795 		    &objp->deleg_claim4_u.dc_delegate_type))
1796 			return (FALSE);
1797 		break;
1798 	default:
1799 		return (FALSE);
1800 	}
1801 	return (TRUE);
1802 }
1803 
1804 bool_t
xdr_WANT_DELEGATION4args(XDR * xdrs,WANT_DELEGATION4args * objp)1805 xdr_WANT_DELEGATION4args(XDR *xdrs, WANT_DELEGATION4args *objp)
1806 {
1807 	if (!xdr_uint32_t(xdrs, &objp->wda_want))
1808 		return (FALSE);
1809 	if (!xdr_deleg_claim4(xdrs, &objp->wda_claim))
1810 		return (FALSE);
1811 	return (TRUE);
1812 }
1813 
1814 bool_t
xdr_WANT_DELEGATION4res(XDR * xdrs,WANT_DELEGATION4res * objp)1815 xdr_WANT_DELEGATION4res(XDR *xdrs, WANT_DELEGATION4res *objp)
1816 {
1817 	if (!xdr_nfsstat4(xdrs, &objp->wdr_status))
1818 		return (FALSE);
1819 	switch (objp->wdr_status) {
1820 	case NFS4_OK:
1821 		if (!xdr_open_delegation4(xdrs,
1822 		    &objp->WANT_DELEGATION4res_u.wdr_resok4))
1823 			return (FALSE);
1824 		break;
1825 	}
1826 	return (TRUE);
1827 }
1828 
1829 bool_t
xdr_DESTROY_CLIENTID4args(XDR * xdrs,DESTROY_CLIENTID4args * objp)1830 xdr_DESTROY_CLIENTID4args(XDR *xdrs, DESTROY_CLIENTID4args *objp)
1831 {
1832 	if (!xdr_clientid4(xdrs, &objp->dca_clientid))
1833 		return (FALSE);
1834 	return (TRUE);
1835 }
1836 
1837 bool_t
xdr_DESTROY_CLIENTID4res(XDR * xdrs,DESTROY_CLIENTID4res * objp)1838 xdr_DESTROY_CLIENTID4res(XDR *xdrs, DESTROY_CLIENTID4res *objp)
1839 {
1840 
1841 	if (!xdr_nfsstat4(xdrs, &objp->dcr_status))
1842 		return (FALSE);
1843 	return (TRUE);
1844 }
1845 
1846 bool_t
xdr_RECLAIM_COMPLETE4args(XDR * xdrs,RECLAIM_COMPLETE4args * objp)1847 xdr_RECLAIM_COMPLETE4args(XDR *xdrs, RECLAIM_COMPLETE4args *objp)
1848 {
1849 	if (!xdr_bool(xdrs, &objp->rca_one_fs))
1850 		return (FALSE);
1851 	return (TRUE);
1852 }
1853 
1854 bool_t
xdr_RECLAIM_COMPLETE4res(XDR * xdrs,RECLAIM_COMPLETE4res * objp)1855 xdr_RECLAIM_COMPLETE4res(XDR *xdrs, RECLAIM_COMPLETE4res *objp)
1856 {
1857 	if (!xdr_nfsstat4(xdrs, &objp->rcr_status))
1858 		return (FALSE);
1859 	return (TRUE);
1860 }
1861 
1862 /* new operations for NFSv4.1 */
1863 
1864 bool_t
xdr_nfs4x_argop4(XDR * xdrs,nfs_argop4 * objp)1865 xdr_nfs4x_argop4(XDR *xdrs, nfs_argop4 *objp)
1866 {
1867 	/* nfs_opnum4 has already been xdr'd */
1868 	switch (objp->argop) {
1869 	case OP_BACKCHANNEL_CTL:
1870 		if (!xdr_BACKCHANNEL_CTL4args(xdrs,
1871 		    &objp->nfs_argop4_u.opbackchannel_ctl))
1872 			return (FALSE);
1873 		break;
1874 	case OP_BIND_CONN_TO_SESSION:
1875 		if (!xdr_BIND_CONN_TO_SESSION4args(xdrs,
1876 		    &objp->nfs_argop4_u.opbind_conn_to_session))
1877 			return (FALSE);
1878 		break;
1879 	case OP_EXCHANGE_ID:
1880 		if (!xdr_EXCHANGE_ID4args(xdrs,
1881 		    &objp->nfs_argop4_u.opexchange_id))
1882 			return (FALSE);
1883 		break;
1884 	case OP_CREATE_SESSION:
1885 		if (!xdr_CREATE_SESSION4args(xdrs,
1886 		    &objp->nfs_argop4_u.opcreate_session))
1887 			return (FALSE);
1888 		break;
1889 	case OP_DESTROY_SESSION:
1890 		if (!xdr_DESTROY_SESSION4args(xdrs,
1891 		    &objp->nfs_argop4_u.opdestroy_session))
1892 			return (FALSE);
1893 		break;
1894 	case OP_FREE_STATEID:
1895 		if (!xdr_FREE_STATEID4args(xdrs,
1896 		    &objp->nfs_argop4_u.opfree_stateid))
1897 			return (FALSE);
1898 		break;
1899 	case OP_GET_DIR_DELEGATION:
1900 		if (!xdr_GET_DIR_DELEGATION4args(xdrs,
1901 		    &objp->nfs_argop4_u.opget_dir_delegation))
1902 			return (FALSE);
1903 		break;
1904 	case OP_GETDEVICEINFO:
1905 		if (!xdr_GETDEVICEINFO4args(xdrs,
1906 		    &objp->nfs_argop4_u.opgetdeviceinfo))
1907 			return (FALSE);
1908 		break;
1909 	case OP_GETDEVICELIST:
1910 		if (!xdr_GETDEVICELIST4args(xdrs,
1911 		    &objp->nfs_argop4_u.opgetdevicelist))
1912 			return (FALSE);
1913 		break;
1914 	case OP_LAYOUTCOMMIT:
1915 		if (!xdr_LAYOUTCOMMIT4args(xdrs,
1916 		    &objp->nfs_argop4_u.oplayoutcommit))
1917 			return (FALSE);
1918 		break;
1919 	case OP_LAYOUTGET:
1920 		if (!xdr_LAYOUTGET4args(xdrs,
1921 		    &objp->nfs_argop4_u.oplayoutget))
1922 			return (FALSE);
1923 		break;
1924 	case OP_LAYOUTRETURN:
1925 		if (!xdr_LAYOUTRETURN4args(xdrs,
1926 		    &objp->nfs_argop4_u.oplayoutreturn))
1927 			return (FALSE);
1928 		break;
1929 	case OP_SECINFO_NO_NAME:
1930 		if (!xdr_SECINFO_NO_NAME4args(xdrs,
1931 		    &objp->nfs_argop4_u.opsecinfo_no_name))
1932 			return (FALSE);
1933 		break;
1934 	case OP_SEQUENCE:
1935 		if (!xdr_SEQUENCE4args(xdrs,
1936 		    &objp->nfs_argop4_u.opsequence))
1937 			return (FALSE);
1938 		break;
1939 	case OP_SET_SSV:
1940 		if (!xdr_SET_SSV4args(xdrs,
1941 		    &objp->nfs_argop4_u.opset_ssv))
1942 			return (FALSE);
1943 		break;
1944 	case OP_TEST_STATEID:
1945 		if (!xdr_TEST_STATEID4args(xdrs,
1946 		    &objp->nfs_argop4_u.optest_stateid))
1947 			return (FALSE);
1948 		break;
1949 	case OP_WANT_DELEGATION:
1950 		if (!xdr_WANT_DELEGATION4args(xdrs,
1951 		    &objp->nfs_argop4_u.opwant_delegation))
1952 			return (FALSE);
1953 		break;
1954 	case OP_DESTROY_CLIENTID:
1955 		if (!xdr_DESTROY_CLIENTID4args(xdrs,
1956 		    &objp->nfs_argop4_u.opdestroy_clientid))
1957 			return (FALSE);
1958 		break;
1959 	case OP_RECLAIM_COMPLETE:
1960 		if (!xdr_RECLAIM_COMPLETE4args(xdrs,
1961 		    &objp->nfs_argop4_u.opreclaim_complete))
1962 			return (FALSE);
1963 		break;
1964 	default:
1965 		return (FALSE);
1966 	}
1967 	return (TRUE);
1968 }
1969 
1970 bool_t
xdr_nfs4x_resop4(XDR * xdrs,nfs_resop4 * objp)1971 xdr_nfs4x_resop4(XDR *xdrs, nfs_resop4 *objp)
1972 {
1973 	/* nfs_opnum4 has already been xdr's */
1974 	switch (objp->resop) {
1975 	case OP_BACKCHANNEL_CTL:
1976 		if (!xdr_BACKCHANNEL_CTL4res(xdrs,
1977 		    &objp->nfs_resop4_u.opbackchannel_ctl))
1978 			return (FALSE);
1979 		break;
1980 	case OP_BIND_CONN_TO_SESSION:
1981 		if (!xdr_BIND_CONN_TO_SESSION4res(xdrs,
1982 		    &objp->nfs_resop4_u.opbind_conn_to_session))
1983 			return (FALSE);
1984 		break;
1985 	case OP_EXCHANGE_ID:
1986 		if (!xdr_EXCHANGE_ID4res(xdrs,
1987 		    &objp->nfs_resop4_u.opexchange_id))
1988 			return (FALSE);
1989 		break;
1990 	case OP_CREATE_SESSION:
1991 		if (!xdr_CREATE_SESSION4res(xdrs,
1992 		    &objp->nfs_resop4_u.opcreate_session))
1993 			return (FALSE);
1994 		break;
1995 	case OP_DESTROY_SESSION:
1996 		if (!xdr_DESTROY_SESSION4res(xdrs,
1997 		    &objp->nfs_resop4_u.opdestroy_session))
1998 			return (FALSE);
1999 		break;
2000 	case OP_FREE_STATEID:
2001 		if (!xdr_FREE_STATEID4res(xdrs,
2002 		    &objp->nfs_resop4_u.opfree_stateid))
2003 			return (FALSE);
2004 		break;
2005 	case OP_GET_DIR_DELEGATION:
2006 		if (!xdr_GET_DIR_DELEGATION4res(xdrs,
2007 		    &objp->nfs_resop4_u.opget_dir_delegation))
2008 			return (FALSE);
2009 		break;
2010 	case OP_GETDEVICEINFO:
2011 		if (!xdr_GETDEVICEINFO4res(xdrs,
2012 		    &objp->nfs_resop4_u.opgetdeviceinfo))
2013 			return (FALSE);
2014 		break;
2015 	case OP_GETDEVICELIST:
2016 		if (!xdr_GETDEVICELIST4res(xdrs,
2017 		    &objp->nfs_resop4_u.opgetdevicelist))
2018 			return (FALSE);
2019 		break;
2020 	case OP_LAYOUTCOMMIT:
2021 		if (!xdr_LAYOUTCOMMIT4res(xdrs,
2022 		    &objp->nfs_resop4_u.oplayoutcommit))
2023 			return (FALSE);
2024 		break;
2025 	case OP_LAYOUTGET:
2026 		if (!xdr_LAYOUTGET4res(xdrs,
2027 		    &objp->nfs_resop4_u.oplayoutget))
2028 			return (FALSE);
2029 		break;
2030 	case OP_LAYOUTRETURN:
2031 		if (!xdr_LAYOUTRETURN4res(xdrs,
2032 		    &objp->nfs_resop4_u.oplayoutreturn))
2033 			return (FALSE);
2034 		break;
2035 	case OP_SECINFO_NO_NAME:
2036 		if (!xdr_SECINFO_NO_NAME4res(xdrs,
2037 		    &objp->nfs_resop4_u.opsecinfo_no_name))
2038 			return (FALSE);
2039 		break;
2040 	case OP_SEQUENCE:
2041 		if (!xdr_SEQUENCE4res(xdrs,
2042 		    &objp->nfs_resop4_u.opsequence))
2043 			return (FALSE);
2044 		break;
2045 	case OP_SET_SSV:
2046 		if (!xdr_SET_SSV4res(xdrs,
2047 		    &objp->nfs_resop4_u.opset_ssv))
2048 			return (FALSE);
2049 		break;
2050 	case OP_TEST_STATEID:
2051 		if (!xdr_TEST_STATEID4res(xdrs,
2052 		    &objp->nfs_resop4_u.optest_stateid))
2053 			return (FALSE);
2054 		break;
2055 	case OP_WANT_DELEGATION:
2056 		if (!xdr_WANT_DELEGATION4res(xdrs,
2057 		    &objp->nfs_resop4_u.opwant_delegation))
2058 			return (FALSE);
2059 		break;
2060 	case OP_DESTROY_CLIENTID:
2061 		if (!xdr_DESTROY_CLIENTID4res(xdrs,
2062 		    &objp->nfs_resop4_u.opdestroy_clientid))
2063 			return (FALSE);
2064 		break;
2065 	case OP_RECLAIM_COMPLETE:
2066 		if (!xdr_RECLAIM_COMPLETE4res(xdrs,
2067 		    &objp->nfs_resop4_u.opreclaim_complete))
2068 			return (FALSE);
2069 		break;
2070 	default:
2071 		return (FALSE);
2072 	}
2073 	return (TRUE);
2074 }
2075 
2076 bool_t
xdr_layoutrecall_type4(XDR * xdrs,layoutrecall_type4 * objp)2077 xdr_layoutrecall_type4(XDR *xdrs, layoutrecall_type4 *objp)
2078 {
2079 	if (!xdr_enum(xdrs, (enum_t *)objp))
2080 		return (FALSE);
2081 	return (TRUE);
2082 }
2083 
2084 bool_t
xdr_layoutrecall_file4(XDR * xdrs,layoutrecall_file4 * objp)2085 xdr_layoutrecall_file4(XDR *xdrs, layoutrecall_file4 *objp)
2086 {
2087 	switch (xdrs->x_op) {
2088 	case XDR_ENCODE:
2089 		/* TODO: encode nfs4x_fh */
2090 		return (FALSE);
2091 
2092 	case XDR_DECODE:
2093 		if (!xdr_bytes(xdrs, (char **)&objp->lor_fh.nfs_fh4_val,
2094 		    (uint_t *)&objp->lor_fh.nfs_fh4_len, NFS4_FHSIZE))
2095 			return (FALSE);
2096 		break;
2097 
2098 	case XDR_FREE:
2099 		if (objp->lor_fh.nfs_fh4_val != NULL) {
2100 			if (!xdr_bytes(xdrs,
2101 			    (char **)&objp->lor_fh.nfs_fh4_val,
2102 			    (uint_t *)&objp->lor_fh.nfs_fh4_len,
2103 			    NFS4_FHSIZE))
2104 				return (FALSE);
2105 		}
2106 		break;
2107 	}
2108 
2109 	if (!xdr_offset4(xdrs, &objp->lor_offset))
2110 		return (FALSE);
2111 	if (!xdr_length4(xdrs, &objp->lor_length))
2112 		return (FALSE);
2113 	if (!xdr_stateid4(xdrs, &objp->lor_stateid))
2114 		return (FALSE);
2115 	return (TRUE);
2116 }
2117 
2118 bool_t
xdr_layoutrecall4(XDR * xdrs,layoutrecall4 * objp)2119 xdr_layoutrecall4(XDR *xdrs, layoutrecall4 *objp)
2120 {
2121 	if (!xdr_layoutrecall_type4(xdrs, &objp->lor_recalltype))
2122 		return (FALSE);
2123 	switch (objp->lor_recalltype) {
2124 	case LAYOUTRECALL4_FILE:
2125 		if (!xdr_layoutrecall_file4(xdrs,
2126 		    &objp->layoutrecall4_u.lor_layout))
2127 			return (FALSE);
2128 		break;
2129 	case LAYOUTRECALL4_FSID:
2130 		if (!xdr_fsid4(xdrs, &objp->layoutrecall4_u.lor_fsid))
2131 			return (FALSE);
2132 		break;
2133 	case LAYOUTRECALL4_ALL:
2134 		break;
2135 	default:
2136 		return (FALSE);
2137 	}
2138 	return (TRUE);
2139 }
2140 
2141 bool_t
xdr_CB_LAYOUTRECALL4args(XDR * xdrs,CB_LAYOUTRECALL4args * objp)2142 xdr_CB_LAYOUTRECALL4args(XDR *xdrs, CB_LAYOUTRECALL4args *objp)
2143 {
2144 	if (!xdr_layouttype4(xdrs, &objp->clora_type))
2145 		return (FALSE);
2146 	if (!xdr_layoutiomode4(xdrs, &objp->clora_iomode))
2147 		return (FALSE);
2148 	if (!xdr_bool(xdrs, &objp->clora_changed))
2149 		return (FALSE);
2150 	if (!xdr_layoutrecall4(xdrs, &objp->clora_recall))
2151 		return (FALSE);
2152 	return (TRUE);
2153 }
2154 
2155 bool_t
xdr_CB_LAYOUTRECALL4res(XDR * xdrs,CB_LAYOUTRECALL4res * objp)2156 xdr_CB_LAYOUTRECALL4res(XDR *xdrs, CB_LAYOUTRECALL4res *objp)
2157 {
2158 	if (!xdr_nfsstat4(xdrs, &objp->clorr_status))
2159 		return (FALSE);
2160 	return (TRUE);
2161 }
2162 
2163 bool_t
xdr_notify_type4(XDR * xdrs,notify_type4 * objp)2164 xdr_notify_type4(XDR *xdrs, notify_type4 *objp)
2165 {
2166 	if (!xdr_enum(xdrs, (enum_t *)objp))
2167 		return (FALSE);
2168 	return (TRUE);
2169 }
2170 
2171 bool_t
xdr_notify_entry4(XDR * xdrs,notify_entry4 * objp)2172 xdr_notify_entry4(XDR *xdrs, notify_entry4 *objp)
2173 {
2174 	if (!xdr_component4(xdrs, &objp->ne_file))
2175 		return (FALSE);
2176 	if (!xdr_fattr4(xdrs, &objp->ne_attrs))
2177 		return (FALSE);
2178 	return (TRUE);
2179 }
2180 
2181 bool_t
xdr_prev_entry4(XDR * xdrs,prev_entry4 * objp)2182 xdr_prev_entry4(XDR *xdrs, prev_entry4 *objp)
2183 {
2184 	if (!xdr_notify_entry4(xdrs, &objp->pe_prev_entry))
2185 		return (FALSE);
2186 	if (!xdr_nfs_cookie4(xdrs, &objp->pe_prev_entry_cookie))
2187 		return (FALSE);
2188 	return (TRUE);
2189 }
2190 
2191 bool_t
xdr_notify_remove4(XDR * xdrs,notify_remove4 * objp)2192 xdr_notify_remove4(XDR *xdrs, notify_remove4 *objp)
2193 {
2194 
2195 	if (!xdr_notify_entry4(xdrs, &objp->nrm_old_entry))
2196 		return (FALSE);
2197 	if (!xdr_nfs_cookie4(xdrs, &objp->nrm_old_entry_cookie))
2198 		return (FALSE);
2199 	return (TRUE);
2200 }
2201 
2202 bool_t
xdr_notify_add4(XDR * xdrs,notify_add4 * objp)2203 xdr_notify_add4(XDR *xdrs, notify_add4 *objp)
2204 {
2205 	if (!xdr_array(xdrs, (char **)&objp->nad_old_entry.nad_old_entry_val,
2206 	    (uint_t *)&objp->nad_old_entry.nad_old_entry_len, 1,
2207 	    sizeof (notify_remove4), (xdrproc_t)xdr_notify_remove4))
2208 		return (FALSE);
2209 	if (!xdr_notify_entry4(xdrs, &objp->nad_new_entry))
2210 		return (FALSE);
2211 	if (!xdr_array(xdrs,
2212 	    (char **)&objp->nad_new_entry_cookie.nad_new_entry_cookie_val,
2213 	    (uint_t *)&objp->nad_new_entry_cookie.nad_new_entry_cookie_len, 1,
2214 	    sizeof (nfs_cookie4), (xdrproc_t)xdr_nfs_cookie4))
2215 		return (FALSE);
2216 	if (!xdr_array(xdrs, (char **)&objp->nad_prev_entry.nad_prev_entry_val,
2217 	    (uint_t *)&objp->nad_prev_entry.nad_prev_entry_len, 1,
2218 	    sizeof (prev_entry4), (xdrproc_t)xdr_prev_entry4))
2219 		return (FALSE);
2220 	if (!xdr_bool(xdrs, &objp->nad_last_entry))
2221 		return (FALSE);
2222 	return (TRUE);
2223 }
2224 
2225 bool_t
xdr_notify_attr4(XDR * xdrs,notify_attr4 * objp)2226 xdr_notify_attr4(XDR *xdrs, notify_attr4 *objp)
2227 {
2228 	if (!xdr_notify_entry4(xdrs, &objp->na_changed_entry))
2229 		return (FALSE);
2230 	return (TRUE);
2231 }
2232 
2233 bool_t
xdr_notify_rename4(XDR * xdrs,notify_rename4 * objp)2234 xdr_notify_rename4(XDR *xdrs, notify_rename4 *objp)
2235 {
2236 	if (!xdr_notify_remove4(xdrs, &objp->nrn_old_entry))
2237 		return (FALSE);
2238 	if (!xdr_notify_add4(xdrs, &objp->nrn_new_entry))
2239 		return (FALSE);
2240 	return (TRUE);
2241 }
2242 
2243 bool_t
xdr_notify_verifier4(XDR * xdrs,notify_verifier4 * objp)2244 xdr_notify_verifier4(XDR *xdrs, notify_verifier4 *objp)
2245 {
2246 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->nv_old_cookieverf))
2247 		return (FALSE);
2248 	if (!xdr_verifier4(xdrs, (verifier4 *)&objp->nv_new_cookieverf))
2249 		return (FALSE);
2250 	return (TRUE);
2251 }
2252 
2253 bool_t
xdr_notifylist4(XDR * xdrs,notifylist4 * objp)2254 xdr_notifylist4(XDR *xdrs, notifylist4 *objp)
2255 {
2256 	if (!xdr_bytes(xdrs, (char **)&objp->notifylist4_val,
2257 	    (uint_t *)&objp->notifylist4_len, ~0))
2258 		return (FALSE);
2259 	return (TRUE);
2260 }
2261 
2262 bool_t
xdr_notify4(XDR * xdrs,notify4 * objp)2263 xdr_notify4(XDR *xdrs, notify4 *objp)
2264 {
2265 	if (xdrs->x_op == XDR_ENCODE) {
2266 		if (!xdr_bitmap4_notify(xdrs, &objp->notify_mask))
2267 			return (FALSE);
2268 	} else
2269 		if (!xdr_bitmap4(xdrs, &objp->notify_mask))
2270 			return (FALSE);
2271 	if (!xdr_notifylist4(xdrs, &objp->notify_vals))
2272 		return (FALSE);
2273 	return (TRUE);
2274 }
2275 
2276 bool_t
xdr_CB_NOTIFY4args(XDR * xdrs,CB_NOTIFY4args * objp)2277 xdr_CB_NOTIFY4args(XDR *xdrs, CB_NOTIFY4args *objp)
2278 {
2279 	if (!xdr_stateid4(xdrs, &objp->cna_stateid))
2280 		return (FALSE);
2281 	if (!xdr_nfs_fh4(xdrs, &objp->cna_fh))
2282 		return (FALSE);
2283 	if (!xdr_array(xdrs, (char **)&objp->cna_changes.cna_changes_val,
2284 	    (uint_t *)&objp->cna_changes.cna_changes_len, ~0,
2285 	    sizeof (notify4), (xdrproc_t)xdr_notify4))
2286 		return (FALSE);
2287 	return (TRUE);
2288 }
2289 
2290 bool_t
xdr_CB_NOTIFY4res(XDR * xdrs,CB_NOTIFY4res * objp)2291 xdr_CB_NOTIFY4res(XDR *xdrs, CB_NOTIFY4res *objp)
2292 {
2293 	if (!xdr_nfsstat4(xdrs, &objp->cnr_status))
2294 		return (FALSE);
2295 	return (TRUE);
2296 }
2297 
2298 bool_t
xdr_CB_PUSH_DELEG4args(XDR * xdrs,CB_PUSH_DELEG4args * objp)2299 xdr_CB_PUSH_DELEG4args(XDR *xdrs, CB_PUSH_DELEG4args *objp)
2300 {
2301 	if (!xdr_nfs_fh4(xdrs, &objp->cpda_fh))
2302 		return (FALSE);
2303 	if (!xdr_open_delegation4(xdrs, &objp->cpda_delegation))
2304 		return (FALSE);
2305 	return (TRUE);
2306 }
2307 
2308 bool_t
xdr_CB_PUSH_DELEG4res(XDR * xdrs,CB_PUSH_DELEG4res * objp)2309 xdr_CB_PUSH_DELEG4res(XDR *xdrs, CB_PUSH_DELEG4res *objp)
2310 {
2311 	if (!xdr_nfsstat4(xdrs, &objp->cpdr_status))
2312 		return (FALSE);
2313 	return (TRUE);
2314 }
2315 
2316 bool_t
xdr_CB_RECALL_ANY4args(XDR * xdrs,CB_RECALL_ANY4args * objp)2317 xdr_CB_RECALL_ANY4args(XDR *xdrs, CB_RECALL_ANY4args *objp)
2318 {
2319 	if (!xdr_uint32_t(xdrs, &objp->craa_objects_to_keep))
2320 		return (FALSE);
2321 	if (!xdr_bitmap4(xdrs, &objp->craa_type_mask))
2322 		return (FALSE);
2323 	return (TRUE);
2324 }
2325 
2326 bool_t
xdr_CB_RECALL_ANY4res(XDR * xdrs,CB_RECALL_ANY4res * objp)2327 xdr_CB_RECALL_ANY4res(XDR *xdrs, CB_RECALL_ANY4res *objp)
2328 {
2329 	if (!xdr_nfsstat4(xdrs, &objp->crar_status))
2330 		return (FALSE);
2331 	return (TRUE);
2332 }
2333 
2334 bool_t
xdr_CB_RECALLABLE_OBJ_AVAIL4args(XDR * xdrs,CB_RECALLABLE_OBJ_AVAIL4args * objp)2335 xdr_CB_RECALLABLE_OBJ_AVAIL4args(XDR *xdrs, CB_RECALLABLE_OBJ_AVAIL4args *objp)
2336 {
2337 	if (!xdr_CB_RECALL_ANY4args(xdrs, objp))
2338 		return (FALSE);
2339 	return (TRUE);
2340 }
2341 
2342 bool_t
xdr_CB_RECALLABLE_OBJ_AVAIL4res(XDR * xdrs,CB_RECALLABLE_OBJ_AVAIL4res * objp)2343 xdr_CB_RECALLABLE_OBJ_AVAIL4res(XDR *xdrs, CB_RECALLABLE_OBJ_AVAIL4res *objp)
2344 {
2345 	if (!xdr_nfsstat4(xdrs, &objp->croa_status))
2346 		return (FALSE);
2347 	return (TRUE);
2348 }
2349 
2350 bool_t
xdr_CB_RECALL_SLOT4args(XDR * xdrs,CB_RECALL_SLOT4args * objp)2351 xdr_CB_RECALL_SLOT4args(XDR *xdrs, CB_RECALL_SLOT4args *objp)
2352 {
2353 	if (!xdr_slotid4(xdrs, &objp->rsa_target_highest_slotid))
2354 		return (FALSE);
2355 	return (TRUE);
2356 }
2357 
2358 bool_t
xdr_CB_RECALL_SLOT4res(XDR * xdrs,CB_RECALL_SLOT4res * objp)2359 xdr_CB_RECALL_SLOT4res(XDR *xdrs, CB_RECALL_SLOT4res *objp)
2360 {
2361 	if (!xdr_nfsstat4(xdrs, &objp->rsr_status))
2362 		return (FALSE);
2363 	return (TRUE);
2364 }
2365 
2366 bool_t
xdr_referring_call4(XDR * xdrs,referring_call4 * objp)2367 xdr_referring_call4(XDR *xdrs, referring_call4 *objp)
2368 {
2369 	if (!xdr_sequenceid4(xdrs, &objp->rc_sequenceid))
2370 		return (FALSE);
2371 	if (!xdr_slotid4(xdrs, &objp->rc_slotid))
2372 		return (FALSE);
2373 	return (TRUE);
2374 }
2375 
2376 bool_t
xdr_referring_call_list4(XDR * xdrs,referring_call_list4 * objp)2377 xdr_referring_call_list4(XDR *xdrs, referring_call_list4 *objp)
2378 {
2379 	if (!xdr_sessionid4(xdrs, objp->rcl_sessionid))
2380 		return (FALSE);
2381 	if (!xdr_array(xdrs, (char **)&objp->rcl_referring_calls.
2382 	    rcl_referring_calls_val,
2383 	    (uint_t *)&objp->rcl_referring_calls.rcl_referring_calls_len, ~0,
2384 	    sizeof (referring_call4), (xdrproc_t)xdr_referring_call4))
2385 		return (FALSE);
2386 	return (TRUE);
2387 }
2388 
2389 bool_t
xdr_CB_SEQUENCE4args(XDR * xdrs,CB_SEQUENCE4args * objp)2390 xdr_CB_SEQUENCE4args(XDR *xdrs, CB_SEQUENCE4args *objp)
2391 {
2392 	if (!xdr_sessionid4(xdrs, objp->csa_sessionid))
2393 		return (FALSE);
2394 	if (!xdr_sequenceid4(xdrs, &objp->csa_sequenceid))
2395 		return (FALSE);
2396 	if (!xdr_slotid4(xdrs, &objp->csa_slotid))
2397 		return (FALSE);
2398 	if (!xdr_slotid4(xdrs, &objp->csa_highest_slotid))
2399 		return (FALSE);
2400 	if (!xdr_bool(xdrs, &objp->csa_cachethis))
2401 		return (FALSE);
2402 	if (!xdr_array(xdrs, (char **)&objp->csa_referring_call_lists.
2403 	    csa_referring_call_lists_val,
2404 	    (uint_t *)&objp->csa_referring_call_lists.
2405 	    csa_referring_call_lists_len, ~0, sizeof (referring_call_list4),
2406 	    (xdrproc_t)xdr_referring_call_list4))
2407 		return (FALSE);
2408 	return (TRUE);
2409 }
2410 
2411 bool_t
xdr_CB_SEQUENCE4resok(XDR * xdrs,CB_SEQUENCE4resok * objp)2412 xdr_CB_SEQUENCE4resok(XDR *xdrs, CB_SEQUENCE4resok *objp)
2413 {
2414 	if (!xdr_sessionid4(xdrs, objp->csr_sessionid))
2415 		return (FALSE);
2416 	if (!xdr_sequenceid4(xdrs, &objp->csr_sequenceid))
2417 		return (FALSE);
2418 	if (!xdr_slotid4(xdrs, &objp->csr_slotid))
2419 		return (FALSE);
2420 	if (!xdr_slotid4(xdrs, &objp->csr_highest_slotid))
2421 		return (FALSE);
2422 	if (!xdr_slotid4(xdrs, &objp->csr_target_highest_slotid))
2423 		return (FALSE);
2424 	return (TRUE);
2425 }
2426 
2427 bool_t
xdr_CB_SEQUENCE4res(XDR * xdrs,CB_SEQUENCE4res * objp)2428 xdr_CB_SEQUENCE4res(XDR *xdrs, CB_SEQUENCE4res *objp)
2429 {
2430 	if (!xdr_nfsstat4(xdrs, &objp->csr_status))
2431 		return (FALSE);
2432 	switch (objp->csr_status) {
2433 	case NFS4_OK:
2434 		if (!xdr_CB_SEQUENCE4resok(xdrs,
2435 		    &objp->CB_SEQUENCE4res_u.csr_resok4))
2436 			return (FALSE);
2437 		break;
2438 	}
2439 	return (TRUE);
2440 }
2441 
2442 bool_t
xdr_CB_WANTS_CANCELLED4args(XDR * xdrs,CB_WANTS_CANCELLED4args * objp)2443 xdr_CB_WANTS_CANCELLED4args(XDR *xdrs, CB_WANTS_CANCELLED4args *objp)
2444 {
2445 	if (!xdr_bool(xdrs, &objp->cwca_contended_wants_cancelled))
2446 		return (FALSE);
2447 	if (!xdr_bool(xdrs, &objp->cwca_resourced_wants_cancelled))
2448 		return (FALSE);
2449 	return (TRUE);
2450 }
2451 
2452 bool_t
xdr_CB_WANTS_CANCELLED4res(XDR * xdrs,CB_WANTS_CANCELLED4res * objp)2453 xdr_CB_WANTS_CANCELLED4res(XDR *xdrs, CB_WANTS_CANCELLED4res *objp)
2454 {
2455 	if (!xdr_nfsstat4(xdrs, &objp->cwcr_status))
2456 		return (FALSE);
2457 	return (TRUE);
2458 }
2459 
2460 bool_t
xdr_CB_NOTIFY_LOCK4args(XDR * xdrs,CB_NOTIFY_LOCK4args * objp)2461 xdr_CB_NOTIFY_LOCK4args(XDR *xdrs, CB_NOTIFY_LOCK4args *objp)
2462 {
2463 	if (!xdr_nfs_fh4(xdrs, &objp->cnla_fh))
2464 		return (FALSE);
2465 	if (!xdr_lock_owner4(xdrs, &objp->cnla_lock_owner))
2466 		return (FALSE);
2467 	return (TRUE);
2468 }
2469 
2470 bool_t
xdr_CB_NOTIFY_LOCK4res(XDR * xdrs,CB_NOTIFY_LOCK4res * objp)2471 xdr_CB_NOTIFY_LOCK4res(XDR *xdrs, CB_NOTIFY_LOCK4res *objp)
2472 {
2473 	if (!xdr_nfsstat4(xdrs, &objp->cnlr_status))
2474 		return (FALSE);
2475 	return (TRUE);
2476 }
2477 
2478 bool_t
xdr_notify_deviceid_type4(XDR * xdrs,notify_deviceid_type4 * objp)2479 xdr_notify_deviceid_type4(XDR *xdrs, notify_deviceid_type4 *objp)
2480 {
2481 
2482 	if (!xdr_enum(xdrs, (enum_t *)objp))
2483 		return (FALSE);
2484 	return (TRUE);
2485 }
2486 
2487 bool_t
xdr_notify_deviceid_delete4(XDR * xdrs,notify_deviceid_delete4 * objp)2488 xdr_notify_deviceid_delete4(XDR *xdrs, notify_deviceid_delete4 *objp)
2489 {
2490 	if (!xdr_layouttype4(xdrs, &objp->ndd_layouttype))
2491 		return (FALSE);
2492 	if (!xdr_deviceid4(xdrs, objp->ndd_deviceid))
2493 		return (FALSE);
2494 	return (TRUE);
2495 }
2496 
2497 bool_t
xdr_notify_deviceid_change4(XDR * xdrs,notify_deviceid_change4 * objp)2498 xdr_notify_deviceid_change4(XDR *xdrs, notify_deviceid_change4 *objp)
2499 {
2500 
2501 	if (!xdr_layouttype4(xdrs, &objp->ndc_layouttype))
2502 		return (FALSE);
2503 	if (!xdr_deviceid4(xdrs, objp->ndc_deviceid))
2504 		return (FALSE);
2505 	if (!xdr_bool(xdrs, &objp->ndc_immediate))
2506 		return (FALSE);
2507 	return (TRUE);
2508 }
2509 
2510 bool_t
xdr_CB_NOTIFY_DEVICEID4args(XDR * xdrs,CB_NOTIFY_DEVICEID4args * objp)2511 xdr_CB_NOTIFY_DEVICEID4args(XDR *xdrs, CB_NOTIFY_DEVICEID4args *objp)
2512 {
2513 	if (!xdr_array(xdrs, (char **)&objp->cnda_changes.cnda_changes_val,
2514 	    (uint_t *)&objp->cnda_changes.cnda_changes_len, ~0,
2515 	    sizeof (notify4), (xdrproc_t)xdr_notify4))
2516 		return (FALSE);
2517 	return (TRUE);
2518 }
2519 
2520 bool_t
xdr_CB_NOTIFY_DEVICEID4res(XDR * xdrs,CB_NOTIFY_DEVICEID4res * objp)2521 xdr_CB_NOTIFY_DEVICEID4res(XDR *xdrs, CB_NOTIFY_DEVICEID4res *objp)
2522 {
2523 	if (!xdr_nfsstat4(xdrs, &objp->cndr_status))
2524 		return (FALSE);
2525 	return (TRUE);
2526 }
2527 
2528 /* Callback operations new to NFSv4.1 */
2529 
2530 bool_t
xdr_nfs_cb_argop4(XDR * xdrs,nfs_cb_argop4 * objp)2531 xdr_nfs_cb_argop4(XDR *xdrs, nfs_cb_argop4 *objp)
2532 {
2533 	/* argop has already been xdr'd */
2534 	switch (objp->argop) {
2535 	case OP_CB_LAYOUTRECALL:
2536 		if (!xdr_CB_LAYOUTRECALL4args(xdrs,
2537 		    &objp->nfs_cb_argop4_u.opcblayoutrecall))
2538 			return (FALSE);
2539 		break;
2540 	case OP_CB_NOTIFY:
2541 		if (!xdr_CB_NOTIFY4args(xdrs,
2542 		    &objp->nfs_cb_argop4_u.opcbnotify))
2543 			return (FALSE);
2544 		break;
2545 	case OP_CB_PUSH_DELEG:
2546 		if (!xdr_CB_PUSH_DELEG4args(xdrs,
2547 		    &objp->nfs_cb_argop4_u.opcbpush_deleg))
2548 			return (FALSE);
2549 		break;
2550 	case OP_CB_RECALL_ANY:
2551 		if (!xdr_CB_RECALL_ANY4args(xdrs,
2552 		    &objp->nfs_cb_argop4_u.opcbrecall_any))
2553 			return (FALSE);
2554 		break;
2555 	case OP_CB_RECALLABLE_OBJ_AVAIL:
2556 		if (!xdr_CB_RECALLABLE_OBJ_AVAIL4args(xdrs,
2557 		    &objp->nfs_cb_argop4_u.opcbrecallable_obj_avail))
2558 			return (FALSE);
2559 		break;
2560 	case OP_CB_RECALL_SLOT:
2561 		if (!xdr_CB_RECALL_SLOT4args(xdrs,
2562 		    &objp->nfs_cb_argop4_u.opcbrecall_slot))
2563 			return (FALSE);
2564 		break;
2565 	case OP_CB_SEQUENCE:
2566 		if (!xdr_CB_SEQUENCE4args(xdrs,
2567 		    &objp->nfs_cb_argop4_u.opcbsequence))
2568 			return (FALSE);
2569 		break;
2570 	case OP_CB_WANTS_CANCELLED:
2571 		if (!xdr_CB_WANTS_CANCELLED4args(xdrs,
2572 		    &objp->nfs_cb_argop4_u.opcbwants_cancelled))
2573 			return (FALSE);
2574 		break;
2575 	case OP_CB_NOTIFY_LOCK:
2576 		if (!xdr_CB_NOTIFY_LOCK4args(xdrs,
2577 		    &objp->nfs_cb_argop4_u.opcbnotify_lock))
2578 			return (FALSE);
2579 		break;
2580 	case OP_CB_NOTIFY_DEVICEID:
2581 		if (!xdr_CB_NOTIFY_DEVICEID4args(xdrs,
2582 		    &objp->nfs_cb_argop4_u.opcbnotify_deviceid))
2583 			return (FALSE);
2584 		break;
2585 	default:
2586 		return (FALSE);
2587 	}
2588 	return (TRUE);
2589 }
2590 
2591 bool_t
xdr_CB_GETATTR4res(XDR * xdrs,CB_GETATTR4res * objp)2592 xdr_CB_GETATTR4res(XDR *xdrs, CB_GETATTR4res *objp)
2593 {
2594 	if (!xdr_nfsstat4(xdrs, &objp->status))
2595 		return (FALSE);
2596 
2597 	switch (objp->status) {
2598 	case NFS4_OK:
2599 		if (!xdr_fattr4(xdrs, &objp->obj_attributes))
2600 			return (FALSE);
2601 		break;
2602 	}
2603 	return (TRUE);
2604 }
2605 
2606 bool_t
xdr_CB_RECALL4res(XDR * xdrs,CB_RECALL4res * objp)2607 xdr_CB_RECALL4res(XDR *xdrs, CB_RECALL4res *objp)
2608 {
2609 	if (!xdr_nfsstat4(xdrs, &objp->status))
2610 		return (FALSE);
2611 	return (TRUE);
2612 }
2613 
2614 bool_t
xdr_CB_ILLEGAL4res(XDR * xdrs,CB_ILLEGAL4res * objp)2615 xdr_CB_ILLEGAL4res(XDR *xdrs, CB_ILLEGAL4res *objp)
2616 {
2617 	if (!xdr_nfsstat4(xdrs, &objp->status))
2618 		return (FALSE);
2619 	return (TRUE);
2620 }
2621 
2622 bool_t
xdr_nfs_cb_resop4(XDR * xdrs,nfs_cb_resop4 * objp)2623 xdr_nfs_cb_resop4(XDR *xdrs, nfs_cb_resop4 *objp)
2624 {
2625 	if (!xdr_u_int(xdrs, &objp->resop))
2626 		return (FALSE);
2627 
2628 	switch (objp->resop) {
2629 	case OP_CB_GETATTR:
2630 		if (!xdr_CB_GETATTR4res(xdrs,
2631 		    &objp->nfs_cb_resop4_u.opcbgetattr))
2632 			return (FALSE);
2633 		break;
2634 	case OP_CB_RECALL:
2635 		if (!xdr_CB_RECALL4res(xdrs,
2636 		    &objp->nfs_cb_resop4_u.opcbrecall))
2637 			return (FALSE);
2638 		break;
2639 	case OP_CB_LAYOUTRECALL:
2640 		if (!xdr_CB_LAYOUTRECALL4res(xdrs,
2641 		    &objp->nfs_cb_resop4_u.opcblayoutrecall))
2642 			return (FALSE);
2643 		break;
2644 	case OP_CB_NOTIFY:
2645 		if (!xdr_CB_NOTIFY4res(xdrs,
2646 		    &objp->nfs_cb_resop4_u.opcbnotify))
2647 			return (FALSE);
2648 		break;
2649 	case OP_CB_PUSH_DELEG:
2650 		if (!xdr_CB_PUSH_DELEG4res(xdrs,
2651 		    &objp->nfs_cb_resop4_u.opcbpush_deleg))
2652 			return (FALSE);
2653 		break;
2654 	case OP_CB_RECALL_ANY:
2655 		if (!xdr_CB_RECALL_ANY4res(xdrs,
2656 		    &objp->nfs_cb_resop4_u.opcbrecall_any))
2657 			return (FALSE);
2658 		break;
2659 	case OP_CB_RECALLABLE_OBJ_AVAIL:
2660 		if (!xdr_CB_RECALLABLE_OBJ_AVAIL4res(xdrs,
2661 		    &objp->nfs_cb_resop4_u.opcbrecallable_obj_avail))
2662 			return (FALSE);
2663 		break;
2664 	case OP_CB_RECALL_SLOT:
2665 		if (!xdr_CB_RECALL_SLOT4res(xdrs,
2666 		    &objp->nfs_cb_resop4_u.opcbrecall_slot))
2667 			return (FALSE);
2668 		break;
2669 	case OP_CB_SEQUENCE:
2670 		if (!xdr_CB_SEQUENCE4res(xdrs,
2671 		    &objp->nfs_cb_resop4_u.opcbsequence))
2672 			return (FALSE);
2673 		break;
2674 	case OP_CB_WANTS_CANCELLED:
2675 		if (!xdr_CB_WANTS_CANCELLED4res(xdrs,
2676 		    &objp->nfs_cb_resop4_u.opcbwants_cancelled))
2677 			return (FALSE);
2678 		break;
2679 	case OP_CB_NOTIFY_LOCK:
2680 		if (!xdr_CB_NOTIFY_LOCK4res(xdrs,
2681 		    &objp->nfs_cb_resop4_u.opcbnotify_lock))
2682 			return (FALSE);
2683 		break;
2684 	case OP_CB_NOTIFY_DEVICEID:
2685 		if (!xdr_CB_NOTIFY_DEVICEID4res(xdrs,
2686 		    &objp->nfs_cb_resop4_u.opcbnotify_deviceid))
2687 			return (FALSE);
2688 		break;
2689 	case OP_CB_ILLEGAL:
2690 		if (!xdr_CB_ILLEGAL4res(xdrs,
2691 		    &objp->nfs_cb_resop4_u.opcbillegal))
2692 			return (FALSE);
2693 		break;
2694 	default:
2695 		return (FALSE);
2696 	}
2697 	return (TRUE);
2698 }
2699 
2700 /*
2701  * Additional common NFSv4 XDR
2702  */
2703 
2704 bool_t
xdr_clientid4(XDR * xdrs,clientid4 * objp)2705 xdr_clientid4(XDR *xdrs, clientid4 *objp)
2706 {
2707 	if (!xdr_uint64_t(xdrs, objp))
2708 		return (FALSE);
2709 	return (TRUE);
2710 }
2711 
2712 bool_t
xdr_component4(XDR * xdrs,component4 * objp)2713 xdr_component4(XDR *xdrs, component4 *objp)
2714 {
2715 	if (!xdr_utf8string(xdrs, objp))
2716 		return (FALSE);
2717 	return (TRUE);
2718 }
2719 
2720 bool_t
xdr_count4(XDR * xdrs,count4 * objp)2721 xdr_count4(XDR *xdrs, count4 *objp)
2722 {
2723 	if (!xdr_uint32_t(xdrs, objp))
2724 		return (FALSE);
2725 	return (TRUE);
2726 }
2727 
2728 bool_t
xdr_fsid4(XDR * xdrs,fsid4 * objp)2729 xdr_fsid4(XDR *xdrs, fsid4 *objp)
2730 {
2731 	if (!xdr_uint64_t(xdrs, &objp->major))
2732 		return (FALSE);
2733 	if (!xdr_uint64_t(xdrs, &objp->minor))
2734 		return (FALSE);
2735 	return (TRUE);
2736 }
2737 
2738 bool_t
xdr_length4(XDR * xdrs,length4 * objp)2739 xdr_length4(XDR *xdrs, length4 *objp)
2740 {
2741 	if (!xdr_uint64_t(xdrs, objp))
2742 		return (FALSE);
2743 	return (TRUE);
2744 }
2745 
2746 bool_t
xdr_limit_by4(XDR * xdrs,limit_by4 * objp)2747 xdr_limit_by4(XDR *xdrs, limit_by4 *objp)
2748 {
2749 	if (!xdr_enum(xdrs, (enum_t *)objp))
2750 		return (FALSE);
2751 	return (TRUE);
2752 }
2753 
2754 bool_t
xdr_lock_owner4(XDR * xdrs,lock_owner4 * objp)2755 xdr_lock_owner4(XDR *xdrs, lock_owner4 *objp)
2756 {
2757 	if (!xdr_clientid4(xdrs, &objp->clientid))
2758 		return (FALSE);
2759 	if (!xdr_bytes(xdrs, (char **)&objp->owner_val,
2760 	    (uint_t *)&objp->owner_len, NFS4_OPAQUE_LIMIT))
2761 		return (FALSE);
2762 	return (TRUE);
2763 }
2764 
2765 bool_t
xdr_mode4(XDR * xdrs,mode4 * objp)2766 xdr_mode4(XDR *xdrs, mode4 *objp)
2767 {
2768 	if (!xdr_uint32_t(xdrs, objp))
2769 		return (FALSE);
2770 	return (TRUE);
2771 }
2772 
2773 bool_t
xdr_netaddr4(XDR * xdrs,netaddr4 * objp)2774 xdr_netaddr4(XDR *xdrs, netaddr4 *objp)
2775 {
2776 	if (!xdr_string(xdrs, &objp->na_r_netid, ~0))
2777 		return (FALSE);
2778 	if (!xdr_string(xdrs, &objp->na_r_addr, ~0))
2779 		return (FALSE);
2780 	return (TRUE);
2781 }
2782 
2783 bool_t
xdr_nfs_cookie4(XDR * xdrs,nfs_cookie4 * objp)2784 xdr_nfs_cookie4(XDR *xdrs, nfs_cookie4 *objp)
2785 {
2786 	if (!xdr_uint64_t(xdrs, objp))
2787 		return (FALSE);
2788 	return (TRUE);
2789 }
2790 
2791 
2792 bool_t
xdr_nfs_modified_limit4(XDR * xdrs,nfs_modified_limit4 * objp)2793 xdr_nfs_modified_limit4(XDR *xdrs, nfs_modified_limit4 *objp)
2794 {
2795 	if (!xdr_uint32_t(xdrs, &objp->num_blocks))
2796 		return (FALSE);
2797 	if (!xdr_uint32_t(xdrs, &objp->bytes_per_block))
2798 		return (FALSE);
2799 	return (TRUE);
2800 }
2801 
2802 
2803 bool_t
xdr_nfs_space_limit4(XDR * xdrs,nfs_space_limit4 * objp)2804 xdr_nfs_space_limit4(XDR *xdrs, nfs_space_limit4 *objp)
2805 {
2806 	if (!xdr_limit_by4(xdrs, &objp->limitby))
2807 		return (FALSE);
2808 	switch (objp->limitby) {
2809 	case NFS_LIMIT_SIZE:
2810 		if (!xdr_uint64_t(xdrs, &objp->nfs_space_limit4_u.filesize))
2811 			return (FALSE);
2812 		break;
2813 	case NFS_LIMIT_BLOCKS:
2814 		if (!xdr_nfs_modified_limit4(xdrs,
2815 		    &objp->nfs_space_limit4_u.mod_blocks))
2816 			return (FALSE);
2817 		break;
2818 	default:
2819 		return (FALSE);
2820 	}
2821 	return (TRUE);
2822 }
2823 
2824 bool_t
xdr_nfsstat4(XDR * xdrs,nfsstat4 * objp)2825 xdr_nfsstat4(XDR *xdrs, nfsstat4 *objp)
2826 {
2827 	if (!xdr_enum(xdrs, (enum_t *)objp))
2828 		return (FALSE);
2829 	return (TRUE);
2830 }
2831 
2832 bool_t
xdr_offset4(XDR * xdrs,offset4 * objp)2833 xdr_offset4(XDR *xdrs, offset4 *objp)
2834 {
2835 	if (!xdr_uint64_t(xdrs, objp))
2836 		return (FALSE);
2837 	return (TRUE);
2838 }
2839 
2840 bool_t
xdr_open_claim_type4(XDR * xdrs,open_claim_type4 * objp)2841 xdr_open_claim_type4(XDR *xdrs, open_claim_type4 *objp)
2842 {
2843 	if (!xdr_enum(xdrs, (enum_t *)objp))
2844 		return (FALSE);
2845 	return (TRUE);
2846 }
2847 
2848 bool_t
xdr_open_delegation_type4(XDR * xdrs,open_delegation_type4 * objp)2849 xdr_open_delegation_type4(XDR *xdrs, open_delegation_type4 *objp)
2850 {
2851 	if (!xdr_enum(xdrs, (enum_t *)objp))
2852 		return (FALSE);
2853 	return (TRUE);
2854 }
2855 
2856 bool_t
xdr_open_read_delegation4(XDR * xdrs,open_read_delegation4 * objp)2857 xdr_open_read_delegation4(XDR *xdrs, open_read_delegation4 *objp)
2858 {
2859 	if (!xdr_stateid4(xdrs, &objp->stateid))
2860 		return (FALSE);
2861 	if (!xdr_bool(xdrs, &objp->recall))
2862 		return (FALSE);
2863 	if (!xdr_nfsace4(xdrs, &objp->permissions))
2864 		return (FALSE);
2865 	return (TRUE);
2866 }
2867 
2868 bool_t
xdr_open_write_delegation4(XDR * xdrs,open_write_delegation4 * objp)2869 xdr_open_write_delegation4(XDR *xdrs, open_write_delegation4 *objp)
2870 {
2871 	if (!xdr_stateid4(xdrs, &objp->stateid))
2872 		return (FALSE);
2873 	if (!xdr_bool(xdrs, &objp->recall))
2874 		return (FALSE);
2875 	if (!xdr_nfs_space_limit4(xdrs, &objp->space_limit))
2876 		return (FALSE);
2877 	if (!xdr_nfsace4(xdrs, &objp->permissions))
2878 		return (FALSE);
2879 	return (TRUE);
2880 }
2881 
2882 bool_t
xdr_pathname4(XDR * xdrs,pathname4 * objp)2883 xdr_pathname4(XDR *xdrs, pathname4 *objp)
2884 {
2885 	if (!xdr_array(xdrs, (char **)&objp->pathname4_val,
2886 	    (uint_t *)&objp->pathname4_len, ~0, sizeof (component4),
2887 	    (xdrproc_t)xdr_component4))
2888 		return (FALSE);
2889 	return (TRUE);
2890 }
2891 
2892 bool_t
xdr_sec_oid4(XDR * xdrs,sec_oid4 * objp)2893 xdr_sec_oid4(XDR *xdrs, sec_oid4 *objp)
2894 {
2895 	if (!xdr_bytes(xdrs, (char **)&objp->sec_oid4_val,
2896 	    (uint_t *)&objp->sec_oid4_len, ~0))
2897 		return (FALSE);
2898 	return (TRUE);
2899 }
2900 
2901 bool_t
xdr_rpc_gss_svc_t(XDR * xdrs,rpc_gss_svc_t * objp)2902 xdr_rpc_gss_svc_t(XDR *xdrs, rpc_gss_svc_t *objp)
2903 {
2904 	if (!xdr_enum(xdrs, (enum_t *)objp))
2905 		return (FALSE);
2906 	return (TRUE);
2907 }
2908 
2909 bool_t
xdr_stateid4(XDR * xdrs,stateid4 * objp)2910 xdr_stateid4(XDR *xdrs, stateid4 *objp)
2911 {
2912 	if (!xdr_uint32_t(xdrs, &objp->seqid))
2913 		return (FALSE);
2914 	if (!xdr_opaque(xdrs, objp->other, 12))
2915 		return (FALSE);
2916 	return (TRUE);
2917 }
2918 
2919 bool_t
xdr_utf8str_cis(XDR * xdrs,utf8str_cis * objp)2920 xdr_utf8str_cis(XDR *xdrs, utf8str_cis *objp)
2921 {
2922 	if (!xdr_utf8string(xdrs, objp))
2923 		return (FALSE);
2924 	return (TRUE);
2925 }
2926 
2927 bool_t
xdr_utf8str_cs(XDR * xdrs,utf8str_cs * objp)2928 xdr_utf8str_cs(XDR *xdrs, utf8str_cs *objp)
2929 {
2930 	if (!xdr_utf8string(xdrs, objp))
2931 		return (FALSE);
2932 	return (TRUE);
2933 }
2934 
2935 /* End of additional common NFSv4 XDR */
2936