/* * XDR unsigned long long integers */ bool_t xdr_u_longlong_t(XDR *xdrs, u_longlong_t *hp) { if (xdrs->x_op == XDR_ENCODE) { #if defined(_LITTLE_ENDIAN) if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)hp)); } #elif defined(_BIG_ENDIAN) if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); } #endif return (FALSE); } if (xdrs->x_op == XDR_DECODE) { #if defined(_LITTLE_ENDIAN) if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)hp)); } #elif defined(_BIG_ENDIAN) if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); } #endif return (FALSE); } return (TRUE); }
/* * XDR long long integers */ bool_t xdr_longlong_t(XDR *xdrs, longlong_t *hp) { if (xdrs->x_op == XDR_ENCODE) { #if BYTE_ORDER == _LITTLE_ENDIAN if (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)hp)); } #else if (XDR_PUTINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_PUTINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); } #endif return (FALSE); } if (xdrs->x_op == XDR_DECODE) { #if BYTE_ORDER == _LITTLE_ENDIAN if (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)hp)); } #else if (XDR_GETINT32(xdrs, (int32_t *)hp) == TRUE) { return (XDR_GETINT32(xdrs, (int32_t *)((char *)hp + BYTES_PER_XDR_UNIT))); } #endif return (FALSE); } return (TRUE); }
/* * xdr_time_t sends time_t value over the wire. * Due to RPC Protocol limitation, it can only send * up to 32-bit integer quantity over the wire. * */ bool_t xdr_time_t(XDR *xdrs, time_t *tp) { int32_t i; switch (xdrs->x_op) { case XDR_ENCODE: /* * Check for the time overflow, when encoding it. * Don't want to send OTW the time value too large to * handle by the protocol. */ #if defined(_LP64) if (*tp > INT32_MAX) *tp = INT32_MAX; else if (*tp < INT32_MIN) *tp = INT32_MIN; #endif i = (int32_t)*tp; return (XDR_PUTINT32(xdrs, &i)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, &i)) return (FALSE); *tp = (time_t)i; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR unsigned afs_int32 integers * same as xdr_long - open coded to save a proc call! */ bool_t xdr_afs_uint32(XDR * xdrs, afs_uint32 * ulp) { if (xdrs->x_op == XDR_DECODE) return (XDR_GETINT32(xdrs, (afs_int32 *)ulp)); if (xdrs->x_op == XDR_ENCODE) return (XDR_PUTINT32(xdrs, (afs_int32 *)ulp)); if (xdrs->x_op == XDR_FREE) return (TRUE); return (FALSE); }
/* * XDR unsigned integers */ bool_t xdr_u_int(XDR *xdrs, uint_t *up) { switch (xdrs->x_op) { case XDR_ENCODE: return (XDR_PUTINT32(xdrs, (int *)up)); case XDR_DECODE: return (XDR_GETINT32(xdrs, (int *)up)); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR integers * * PSARC 2003/523 Contract Private Interface * xdr_int * Changes must be reviewed by Solaris File Sharing * Changes must be communicated to [email protected] */ bool_t xdr_int(XDR *xdrs, int *ip) { if (xdrs->x_op == XDR_ENCODE) return (XDR_PUTINT32(xdrs, ip)); if (xdrs->x_op == XDR_DECODE) return (XDR_GETINT32(xdrs, ip)); if (xdrs->x_op == XDR_FREE) return (TRUE); return (FALSE); }
/* * XDR unsigned integers * * PSARC 2003/523 Contract Private Interface * xdr_u_int * Changes must be reviewed by Solaris File Sharing * Changes must be communicated to [email protected] */ bool_t xdr_u_int(XDR *xdrs, uint_t *up) { if (xdrs->x_op == XDR_ENCODE) return (XDR_PUTINT32(xdrs, (int32_t *)up)); if (xdrs->x_op == XDR_DECODE) return (XDR_GETINT32(xdrs, (int32_t *)up)); if (xdrs->x_op == XDR_FREE) return (TRUE); return (FALSE); }
bool_t xdr_hyper(XDR *xdrs, longlong_t *hp) { if (xdrs->x_op == XDR_ENCODE) { #if BYTE_ORDER == BIG_ENDIAN if (XDR_PUTINT32(xdrs, (int *)hp) == TRUE) /* LINTED pointer cast */ return (XDR_PUTINT32(xdrs, (int *)((char *)hp + BYTES_PER_XDR_UNIT))); #else /* LINTED pointer cast */ if (XDR_PUTINT32(xdrs, (int *)((char *)hp + BYTES_PER_XDR_UNIT)) == TRUE) return (XDR_PUTINT32(xdrs, (int32_t *)hp)); #endif return (FALSE); } if (xdrs->x_op == XDR_DECODE) { #if BYTE_ORDER == BIG_ENDIAN if (XDR_GETINT32(xdrs, (int *)hp) == FALSE || /* LINTED pointer cast */ (XDR_GETINT32(xdrs, (int *)((char *)hp + BYTES_PER_XDR_UNIT)) == FALSE)) return (FALSE); #else /* LINTED pointer cast */ if ((XDR_GETINT32(xdrs, (int *)((char *)hp + BYTES_PER_XDR_UNIT)) == FALSE) || (XDR_GETINT32(xdrs, (int *)hp) == FALSE)) return (FALSE); #endif return (TRUE); } return (TRUE); }
/* * XDR booleans */ bool_t xdr_bool(XDR *xdrs, bool_t *bp) { int i; switch (xdrs->x_op) { case XDR_ENCODE: i = *bp ? XDR_TRUE : XDR_FALSE; return (XDR_PUTINT32(xdrs, &i)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, &i)) return (FALSE); *bp = (i == XDR_FALSE) ? FALSE : TRUE; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR an unsigned char */ bool_t xdr_u_char(XDR *xdrs, uchar_t *cp) { int i; switch (xdrs->x_op) { case XDR_ENCODE: i = (*cp); return (XDR_PUTINT32(xdrs, &i)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, &i)) return (FALSE); *cp = (uchar_t)i; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR unsigned short integers */ bool_t xdr_u_short(XDR *xdrs, ushort_t *usp) { uint_t i; switch (xdrs->x_op) { case XDR_ENCODE: i = (uint_t)*usp; return (XDR_PUTINT32(xdrs, (int *)&i)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, (int *)&i)) return (FALSE); *usp = (ushort_t)i; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR short integers */ bool_t xdr_short(XDR *xdrs, short *sp) { int32_t l; switch (xdrs->x_op) { case XDR_ENCODE: l = (int32_t)*sp; return (XDR_PUTINT32(xdrs, &l)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, &l)) return (FALSE); *sp = (short)l; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR unsigned long integers * same as xdr_long */ bool_t xdr_u_long(XDR *xdrs, ulong_t *ulp) { uint32_t ui; switch (xdrs->x_op) { case XDR_ENCODE: #if defined(_LP64) if (*ulp > UINT32_MAX) return (FALSE); #endif ui = (uint32_t)*ulp; return (XDR_PUTINT32(xdrs, (int32_t *)&ui)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, (int32_t *)&ui)) return (FALSE); *ulp = (ulong_t)ui; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * The definition of xdr_long()/xdr_u_long() is kept for backward * compatibitlity. * XDR long integers, same as xdr_u_long */ bool_t xdr_long(XDR *xdrs, long *lp) { int32_t i; switch (xdrs->x_op) { case XDR_ENCODE: #if defined(_LP64) if ((*lp > INT32_MAX) || (*lp < INT32_MIN)) return (FALSE); #endif i = (int32_t)*lp; return (XDR_PUTINT32(xdrs, &i)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, &i)) return (FALSE); *lp = (long)i; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR booleans * * PSARC 2003/523 Contract Private Interface * xdr_bool * Changes must be reviewed by Solaris File Sharing * Changes must be communicated to [email protected] */ bool_t xdr_bool(XDR *xdrs, bool_t *bp) { int32_t i32b; switch (xdrs->x_op) { case XDR_ENCODE: i32b = *bp ? XDR_TRUE : XDR_FALSE; return (XDR_PUTINT32(xdrs, &i32b)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, &i32b)) { return (FALSE); } *bp = (i32b == XDR_FALSE) ? FALSE : TRUE; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
/* * XDR unsigned short integers */ bool_t xdr_u_short(XDR *xdrs, ushort_t *usp) { uint32_t l; switch (xdrs->x_op) { case XDR_ENCODE: l = (uint32_t)*usp; return (XDR_PUTINT32(xdrs, (int32_t *)&l)); case XDR_DECODE: if (!XDR_GETINT32(xdrs, (int32_t *)&l)) { return (FALSE); } *usp = (ushort_t)l; return (TRUE); case XDR_FREE: return (TRUE); } return (FALSE); }
bool xdr_rquota(XDR * xdrs, rquota * objp) { register int32_t *buf; if (xdrs->x_op == XDR_ENCODE) { buf = xdr_inline_encode(xdrs, 10 * BYTES_PER_XDR_UNIT); if (buf != NULL) { /* most likely */ IXDR_PUT_INT32(buf, objp->rq_bsize); IXDR_PUT_BOOL(buf, objp->rq_active); IXDR_PUT_U_INT32(buf, objp->rq_bhardlimit); IXDR_PUT_U_INT32(buf, objp->rq_bsoftlimit); IXDR_PUT_U_INT32(buf, objp->rq_curblocks); IXDR_PUT_U_INT32(buf, objp->rq_fhardlimit); IXDR_PUT_U_INT32(buf, objp->rq_fsoftlimit); IXDR_PUT_U_INT32(buf, objp->rq_curfiles); IXDR_PUT_U_INT32(buf, objp->rq_btimeleft); IXDR_PUT_U_INT32(buf, objp->rq_ftimeleft); } else { if (!XDR_PUTINT32(xdrs, objp->rq_bsize)) return false; if (!XDR_PUTBOOL(xdrs, objp->rq_active)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_bhardlimit)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_bsoftlimit)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_curblocks)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_fhardlimit)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_fsoftlimit)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_curfiles)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_btimeleft)) return false; if (!XDR_PUTUINT32(xdrs, objp->rq_ftimeleft)) return false; } return true; } if (xdrs->x_op == XDR_DECODE) { buf = xdr_inline_decode(xdrs, 10 * BYTES_PER_XDR_UNIT); if (buf != NULL) { /* most likely */ objp->rq_bsize = IXDR_GET_INT32(buf); objp->rq_active = IXDR_GET_BOOL(buf); objp->rq_bhardlimit = IXDR_GET_U_INT32(buf); objp->rq_bsoftlimit = IXDR_GET_U_INT32(buf); objp->rq_curblocks = IXDR_GET_U_INT32(buf); objp->rq_fhardlimit = IXDR_GET_U_INT32(buf); objp->rq_fsoftlimit = IXDR_GET_U_INT32(buf); objp->rq_curfiles = IXDR_GET_U_INT32(buf); objp->rq_btimeleft = IXDR_GET_U_INT32(buf); objp->rq_ftimeleft = IXDR_GET_U_INT32(buf); } else { if (!XDR_GETINT32(xdrs, &objp->rq_bsize)) return false; if (!XDR_GETBOOL(xdrs, &objp->rq_active)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_bhardlimit)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_bsoftlimit)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_curblocks)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_fhardlimit)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_fsoftlimit)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_curfiles)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_btimeleft)) return false; if (!XDR_GETUINT32(xdrs, &objp->rq_ftimeleft)) return false; } return true; } if (!xdr_int(xdrs, &objp->rq_bsize)) return false; if (!xdr_bool(xdrs, &objp->rq_active)) return false; if (!xdr_u_int(xdrs, &objp->rq_bhardlimit)) return false; if (!xdr_u_int(xdrs, &objp->rq_bsoftlimit)) return false; if (!xdr_u_int(xdrs, &objp->rq_curblocks)) return false; if (!xdr_u_int(xdrs, &objp->rq_fhardlimit)) return false; if (!xdr_u_int(xdrs, &objp->rq_fsoftlimit)) return false; if (!xdr_u_int(xdrs, &objp->rq_curfiles)) return false; if (!xdr_u_int(xdrs, &objp->rq_btimeleft)) return false; if (!xdr_u_int(xdrs, &objp->rq_ftimeleft)) return false; return true; }