135ae9291SPawel Jakub Dawidek /*
235ae9291SPawel Jakub Dawidek * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
335ae9291SPawel Jakub Dawidek * unrestricted use provided that this legend is included on all tape
435ae9291SPawel Jakub Dawidek * media and as a part of the software program in whole or part. Users
535ae9291SPawel Jakub Dawidek * may copy or modify Sun RPC without charge, but are not authorized
635ae9291SPawel Jakub Dawidek * to license or distribute it to anyone else except as part of a product or
735ae9291SPawel Jakub Dawidek * program developed by the user.
835ae9291SPawel Jakub Dawidek *
935ae9291SPawel Jakub Dawidek * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
1035ae9291SPawel Jakub Dawidek * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
1135ae9291SPawel Jakub Dawidek * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
1235ae9291SPawel Jakub Dawidek *
1335ae9291SPawel Jakub Dawidek * Sun RPC is provided with no support and without any obligation on the
1435ae9291SPawel Jakub Dawidek * part of Sun Microsystems, Inc. to assist in its use, correction,
1535ae9291SPawel Jakub Dawidek * modification or enhancement.
1635ae9291SPawel Jakub Dawidek *
1735ae9291SPawel Jakub Dawidek * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
1835ae9291SPawel Jakub Dawidek * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
1935ae9291SPawel Jakub Dawidek * OR ANY PART THEREOF.
2035ae9291SPawel Jakub Dawidek *
2135ae9291SPawel Jakub Dawidek * In no event will Sun Microsystems, Inc. be liable for any lost revenue
2235ae9291SPawel Jakub Dawidek * or profits or other special, indirect and consequential damages, even if
2335ae9291SPawel Jakub Dawidek * Sun has been advised of the possibility of such damages.
2435ae9291SPawel Jakub Dawidek *
2535ae9291SPawel Jakub Dawidek * Sun Microsystems, Inc.
2635ae9291SPawel Jakub Dawidek * 2550 Garcia Avenue
2735ae9291SPawel Jakub Dawidek * Mountain View, California 94043
2835ae9291SPawel Jakub Dawidek */
2935ae9291SPawel Jakub Dawidek
3035ae9291SPawel Jakub Dawidek #ifndef _OPENSOLARIS_RPC_XDR_H_
3135ae9291SPawel Jakub Dawidek #define _OPENSOLARIS_RPC_XDR_H_
3235ae9291SPawel Jakub Dawidek
3335ae9291SPawel Jakub Dawidek #include_next <rpc/xdr.h>
3435ae9291SPawel Jakub Dawidek
3535ae9291SPawel Jakub Dawidek #ifndef _KERNEL
3635ae9291SPawel Jakub Dawidek
3735ae9291SPawel Jakub Dawidek #include <assert.h>
3835ae9291SPawel Jakub Dawidek
3935ae9291SPawel Jakub Dawidek /*
4035ae9291SPawel Jakub Dawidek * Taken from sys/xdr/xdr_mem.c.
4135ae9291SPawel Jakub Dawidek *
4235ae9291SPawel Jakub Dawidek * FreeBSD's userland XDR doesn't implement control method (only the kernel),
4335ae9291SPawel Jakub Dawidek * but OpenSolaris nvpair still depend on it, so we have to implement it here.
4435ae9291SPawel Jakub Dawidek */
4535ae9291SPawel Jakub Dawidek static __inline bool_t
xdrmem_control(XDR * xdrs,int request,void * info)4635ae9291SPawel Jakub Dawidek xdrmem_control(XDR *xdrs, int request, void *info)
4735ae9291SPawel Jakub Dawidek {
4835ae9291SPawel Jakub Dawidek xdr_bytesrec *xptr;
4935ae9291SPawel Jakub Dawidek
5035ae9291SPawel Jakub Dawidek switch (request) {
5135ae9291SPawel Jakub Dawidek case XDR_GET_BYTES_AVAIL:
5235ae9291SPawel Jakub Dawidek xptr = (xdr_bytesrec *)info;
5335ae9291SPawel Jakub Dawidek xptr->xc_is_last_record = TRUE;
5435ae9291SPawel Jakub Dawidek xptr->xc_num_avail = xdrs->x_handy;
5535ae9291SPawel Jakub Dawidek return (TRUE);
5635ae9291SPawel Jakub Dawidek default:
5735ae9291SPawel Jakub Dawidek assert(!"unexpected request");
5835ae9291SPawel Jakub Dawidek }
5935ae9291SPawel Jakub Dawidek return (FALSE);
6035ae9291SPawel Jakub Dawidek }
6135ae9291SPawel Jakub Dawidek
6235ae9291SPawel Jakub Dawidek #undef XDR_CONTROL
6335ae9291SPawel Jakub Dawidek #define XDR_CONTROL(xdrs, req, op) \
6435ae9291SPawel Jakub Dawidek (((xdrs)->x_ops->x_control == NULL) ? \
6535ae9291SPawel Jakub Dawidek xdrmem_control((xdrs), (req), (op)) : \
6635ae9291SPawel Jakub Dawidek (*(xdrs)->x_ops->x_control)(xdrs, req, op))
6735ae9291SPawel Jakub Dawidek
6835ae9291SPawel Jakub Dawidek #endif /* !_KERNEL */
6935ae9291SPawel Jakub Dawidek
7035ae9291SPawel Jakub Dawidek #endif /* !_OPENSOLARIS_RPC_XDR_H_ */
71