Path: blob/main/sys/cddl/compat/opensolaris/rpc/xdr.h
48383 views
/*1* Sun RPC is a product of Sun Microsystems, Inc. and is provided for2* unrestricted use provided that this legend is included on all tape3* media and as a part of the software program in whole or part. Users4* may copy or modify Sun RPC without charge, but are not authorized5* to license or distribute it to anyone else except as part of a product or6* program developed by the user.7*8* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE9* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR10* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.11*12* Sun RPC is provided with no support and without any obligation on the13* part of Sun Microsystems, Inc. to assist in its use, correction,14* modification or enhancement.15*16* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE17* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC18* OR ANY PART THEREOF.19*20* In no event will Sun Microsystems, Inc. be liable for any lost revenue21* or profits or other special, indirect and consequential damages, even if22* Sun has been advised of the possibility of such damages.23*24* Sun Microsystems, Inc.25* 2550 Garcia Avenue26* Mountain View, California 9404327*/2829#ifndef _OPENSOLARIS_RPC_XDR_H_30#define _OPENSOLARIS_RPC_XDR_H_3132#include_next <rpc/xdr.h>3334#ifndef _KERNEL3536#include <assert.h>3738/*39* Taken from sys/xdr/xdr_mem.c.40*41* FreeBSD's userland XDR doesn't implement control method (only the kernel),42* but OpenSolaris nvpair still depend on it, so we have to implement it here.43*/44static __inline bool_t45xdrmem_control(XDR *xdrs, int request, void *info)46{47xdr_bytesrec *xptr;4849switch (request) {50case XDR_GET_BYTES_AVAIL:51xptr = (xdr_bytesrec *)info;52xptr->xc_is_last_record = TRUE;53xptr->xc_num_avail = xdrs->x_handy;54return (TRUE);55default:56assert(!"unexpected request");57}58return (FALSE);59}6061#undef XDR_CONTROL62#define XDR_CONTROL(xdrs, req, op) \63(((xdrs)->x_ops->x_control == NULL) ? \64xdrmem_control((xdrs), (req), (op)) : \65(*(xdrs)->x_ops->x_control)(xdrs, req, op))6667#endif /* !_KERNEL */6869#endif /* !_OPENSOLARIS_RPC_XDR_H_ */707172