#include <rpc/types.h>
#include <rpc/xdr.h>
+#ifdef __LP64__
+#define xdrlong_t int
+#else
+#define xdrlong_t long
+#endif
+
typedef quad_t longlong_t; /* ANSI long long type */
typedef u_quad_t u_longlong_t; /* ANSI unsigned long long type */
/*
* constants specific to the xdr "protocol"
*/
+#ifdef __LP64__
+#define XDR_FALSE ((int) 0)
+#define XDR_TRUE ((int) 1)
+#else
#define XDR_FALSE ((long) 0)
#define XDR_TRUE ((long) 1)
+#endif
#define LASTUNSIGNED ((u_int) 0-1)
/*
XDR *xdrs;
int *ip;
{
- long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (long) *ip;
- return (XDR_PUTLONG(xdrs, &l));
+ l = *ip;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *ip = (int) l;
+ *ip = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
u_int *up;
{
- u_long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (u_long) *up;
- return (XDR_PUTLONG(xdrs, (long *)&l));
+ l = *up;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, (long *)&l)) {
+ if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *up = (u_int) l;
+ *up = l;
return (TRUE);
case XDR_FREE:
bool_t
xdr_long(xdrs, lp)
XDR *xdrs;
+#ifdef __LP64__
+ int *lp;
+#else
long *lp;
+#endif
{
switch (xdrs->x_op) {
case XDR_ENCODE:
bool_t
xdr_u_long(xdrs, ulp)
XDR *xdrs;
+#ifdef __LP64__
+ unsigned int *ulp;
+#else
u_long *ulp;
-{
+#endif
+{
switch (xdrs->x_op) {
case XDR_ENCODE:
- return (XDR_PUTLONG(xdrs, (long *)ulp));
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)ulp));
case XDR_DECODE:
- return (XDR_GETLONG(xdrs, (long *)ulp));
+ return (XDR_GETLONG(xdrs, (xdrlong_t *)ulp));
case XDR_FREE:
return (TRUE);
}
XDR *xdrs;
int32_t *int32_p;
{
- long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (long) *int32_p;
- return (XDR_PUTLONG(xdrs, &l));
+ l = *int32_p;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *int32_p = (int32_t) l;
+ *int32_p = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
u_int32_t *u_int32_p;
{
- u_long l;
+ u_int32_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (u_long) *u_int32_p;
- return (XDR_PUTLONG(xdrs, (long *)&l));
+ l = *u_int32_p;
+ return (XDR_PUTLONG(xdrs, (xdrlong_t *)&l));
case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, (long *)&l)) {
- return (FALSE);
- }
- *u_int32_p = (u_int32_t) l;
+ if (!XDR_GETLONG(xdrs, (xdrlong_t *)&l)) return (FALSE);
+ *u_int32_p = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
short *sp;
{
- long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (long) *sp;
- return (XDR_PUTLONG(xdrs, &l));
+ l = *sp;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *sp = (short) l;
+ *sp = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
u_short *usp;
{
- u_long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (u_long) *usp;
- return (XDR_PUTLONG(xdrs, (long *)&l));
+ l = *usp;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, (long *)&l)) {
+ if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *usp = (u_short) l;
+ *usp = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
int16_t *int16_p;
{
- long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (long) *int16_p;
- return (XDR_PUTLONG(xdrs, &l));
+ l = *int16_p;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *int16_p = (int16_t) l;
+ *int16_p = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
u_int16_t *u_int16_p;
{
- u_long l;
+ xdrlong_t l;
switch (xdrs->x_op) {
case XDR_ENCODE:
- l = (u_long) *u_int16_p;
- return (XDR_PUTLONG(xdrs, (long *)&l));
+ l = *u_int16_p;
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&l));
case XDR_DECODE:
- if (!XDR_GETLONG(xdrs, (long *)&l)) {
+ if (!XDR_GETLONG(xdrs, &l)) {
return (FALSE);
}
- *u_int16_p = (u_int16_t) l;
+ *u_int16_p = l;
return (TRUE);
case XDR_FREE:
XDR *xdrs;
u_char *cp;
{
- u_int u;
+ u_int32_t u;
u = (*cp);
if (!xdr_u_int(xdrs, &u)) {
XDR *xdrs;
bool_t *bp;
{
- long lb;
+ xdrlong_t lb;
switch (xdrs->x_op) {
case XDR_ENCODE:
lb = *bp ? XDR_TRUE : XDR_FALSE;
- return (XDR_PUTLONG(xdrs, &lb));
+ return (XDR_PUTLONG(xdrs, (const xdrlong_t *)&lb));
case XDR_DECODE:
if (!XDR_GETLONG(xdrs, &lb)) {
/*
* enums are treated as ints
*/
- /* LINTED */ if (sizeof (enum sizecheck) == sizeof (long)) {
- return (xdr_long(xdrs, (long *)(void *)ep));
+ /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) {
+ return (xdr_long(xdrs, (xdrlong_t *)(void *)ep));
} else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (int)) {
return (xdr_int(xdrs, (int *)(void *)ep));
} else /* LINTED */ if (sizeof (enum sizecheck) == sizeof (short)) {
caddr_t cp;
u_int cnt;
{
- u_int rndup;
+ u_int32_t rndup;
static int crud[BYTES_PER_XDR_UNIT];
/*
u_int maxsize;
{
char *sp = *cpp; /* sp is the actual string pointer */
- u_int nodesize;
+ u_int32_t nodesize;
/*
* first deal with the length since xdr bytes are counted
u_int maxsize;
{
char *sp = *cpp; /* sp is the actual string pointer */
- u_int size;
- u_int nodesize;
+ u_int32_t size;
+ u_int32_t nodesize;
/*
* first deal with the length since xdr strings are counted-strings
XDR *xdrs;
int64_t *llp;
{
- u_long ul[2];
+ u_int32_t ul[2];
switch (xdrs->x_op) {
case XDR_ENCODE:
- ul[0] = (u_long)((u_int64_t)*llp >> 32) & 0xffffffff;
- ul[1] = (u_long)((u_int64_t)*llp) & 0xffffffff;
- if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
+ ul[0] = (u_int32_t)((u_int64_t)*llp >> 32) & 0xffffffff;
+ ul[1] = (u_int32_t)((u_int64_t)*llp) & 0xffffffff;
+ if (XDR_PUTLONG(xdrs, (xdrlong_t *)&ul[0]) == FALSE)
return (FALSE);
- return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
+ return (XDR_PUTLONG(xdrs, (xdrlong_t *)&ul[1]));
case XDR_DECODE:
- if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE)
+ if (XDR_GETLONG(xdrs, (xdrlong_t *)&ul[0]) == FALSE)
return (FALSE);
- if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
+ if (XDR_GETLONG(xdrs, (xdrlong_t *)&ul[1]) == FALSE)
return (FALSE);
*llp = (int64_t)
(((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
XDR *xdrs;
u_int64_t *ullp;
{
- u_long ul[2];
+ u_int32_t ul[2];
switch (xdrs->x_op) {
case XDR_ENCODE:
- ul[0] = (u_long)(*ullp >> 32) & 0xffffffff;
- ul[1] = (u_long)(*ullp) & 0xffffffff;
- if (XDR_PUTLONG(xdrs, (long *)&ul[0]) == FALSE)
+ ul[0] = (u_int32_t)(*ullp >> 32) & 0xffffffff;
+ ul[1] = (u_int32_t)(*ullp) & 0xffffffff;
+ if (XDR_PUTLONG(xdrs, (xdrlong_t *)&ul[0]) == FALSE)
return (FALSE);
- return (XDR_PUTLONG(xdrs, (long *)&ul[1]));
+ return (XDR_PUTLONG(xdrs, (xdrlong_t *)&ul[1]));
case XDR_DECODE:
- if (XDR_GETLONG(xdrs, (long *)&ul[0]) == FALSE)
+ if (XDR_GETLONG(xdrs, (xdrlong_t *)&ul[0]) == FALSE)
return (FALSE);
- if (XDR_GETLONG(xdrs, (long *)&ul[1]) == FALSE)
+ if (XDR_GETLONG(xdrs, (xdrlong_t *)&ul[1]) == FALSE)
return (FALSE);
*ullp = (u_int64_t)
(((u_int64_t)ul[0] << 32) | ((u_int64_t)ul[1]));
XDR *xdrs;
longlong_t *llp;
{
-
/*
* Don't bother open-coding this; it's a fair amount of code. Just
* call xdr_int64_t().
XDR *xdrs;
u_longlong_t *ullp;
{
-
/*
* Don't bother open-coding this; it's a fair amount of code. Just
* call xdr_u_int64_t().
XDR *xdrs;
longlong_t *llp;
{
-
/*
* Don't bother open-coding this; it's a fair amount of code. Just
* call xdr_int64_t().