#endif /* !TRUE */
#define __dontcare__ -1
+#if defined(KERNEL)
+/*
+ * kernel version needs to agree with <rpc/xdr.h>
+ * except on Linux which does XDR differently from everyone else
+ */
+# if defined(AFS_LINUX20_ENV) && !defined(UKERNEL)
+# define AFS_XDRS_T void *
+# else
+# define AFS_XDRS_T XDR *
+# endif
+# if defined(AFS_SUN57_ENV)
+# define AFS_RPC_INLINE_T rpc_inline_t
+# elif defined(AFS_DUX40_ENV)
+# define AFS_RPC_INLINE_T int
+# elif defined(AFS_LINUX20_ENV) && !defined(UKERNEL)
+# define AFS_RPC_INLINE_T afs_int32
+# elif defined(AFS_LINUX20_ENV)
+# define AFS_RPC_INLINE_T int32_t *
+# else
+# define AFS_RPC_INLINE_T long
+# endif
+#else /* KERNEL */
+/*
+ * user version needs to agree with "xdr.h", i.e. <rx/xdr.h>
+ */
+# define AFS_XDRS_T void *
+# define AFS_RPC_INLINE_T afs_int32
+#endif /* KERNEL */
+
#ifndef mem_alloc
#define mem_alloc(bsize) malloc(bsize)
#endif
#define xdr_int64 afs_xdr_int64
#define xdr_uint64 afs_xdr_uint64
#define xdr_pointer afs_xdr_pointer
+#define xdrmem_create afs_xdrmem_create
#endif
#ifdef KERNEL
*
*/
-#include "xdr.h"
-#ifndef AFS_NT40_ENV
-#include <netinet/in.h>
-#else
+#include <string.h>
#include <limits.h>
+#ifndef AFS_NT40_ENV
+# include <netinet/in.h>
#endif
-static bool_t xdrmem_getint32();
-static bool_t xdrmem_putint32();
-static bool_t xdrmem_getbytes();
-static bool_t xdrmem_putbytes();
-static u_int xdrmem_getpos();
-static bool_t xdrmem_setpos();
-static afs_int32 *xdrmem_inline();
-static void xdrmem_destroy();
+#include "xdr.h"
+
+static bool_t xdrmem_getint32(AFS_XDRS_T, afs_int32 *);
+static bool_t xdrmem_putint32(AFS_XDRS_T, afs_int32 *);
+static bool_t xdrmem_getbytes(AFS_XDRS_T, caddr_t, u_int);
+static bool_t xdrmem_putbytes(AFS_XDRS_T, caddr_t, u_int);
+static u_int xdrmem_getpos(AFS_XDRS_T);
+static bool_t xdrmem_setpos(AFS_XDRS_T, u_int);
+static afs_int32 *xdrmem_inline(AFS_XDRS_T, u_int);
+static void xdrmem_destroy(AFS_XDRS_T);
static struct xdr_ops xdrmem_ops = {
#ifdef AFS_NT40_ENV
.x_putint32 = xdrmem_putint32,
.x_getbytes = xdrmem_getbytes,
.x_putbytes = xdrmem_putbytes,
- .x_getpos = xdrmem_getpos,
- .x_setpos = xdrmem_setpos,
+ .x_getpostn = xdrmem_getpos,
+ .x_setpostn = xdrmem_setpos,
.x_inline = xdrmem_inline,
.x_destroy = xdrmem_destroy
#endif
}
static void
-xdrmem_destroy(void)
+xdrmem_destroy(AFS_XDRS_T axdrs)
{
}
static bool_t
-xdrmem_getint32(XDR * xdrs, afs_int32 * lp)
+xdrmem_getint32(AFS_XDRS_T axdrs, afs_int32 * lp)
{
+ XDR * xdrs = (XDR *)axdrs;
+
if (xdrs->x_handy < sizeof(afs_int32))
return (FALSE);
else
}
static bool_t
-xdrmem_putint32(XDR * xdrs, afs_int32 * lp)
+xdrmem_putint32(AFS_XDRS_T axdrs, afs_int32 * lp)
{
+ XDR * xdrs = (XDR *)axdrs;
+
if (xdrs->x_handy < sizeof(afs_int32))
return (FALSE);
else
}
static bool_t
-xdrmem_getbytes(XDR * xdrs, caddr_t addr, u_int len)
+xdrmem_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
{
+ XDR * xdrs = (XDR *)axdrs;
+
if (xdrs->x_handy < len)
return (FALSE);
else
}
static bool_t
-xdrmem_putbytes(XDR * xdrs, caddr_t addr, u_int len)
+xdrmem_putbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
{
+ XDR * xdrs = (XDR *)axdrs;
+
if (xdrs->x_handy < len)
return (FALSE);
else
}
static u_int
-xdrmem_getpos(XDR * xdrs)
+xdrmem_getpos(AFS_XDRS_T axdrs)
{
+ XDR * xdrs = (XDR *)axdrs;
+
return ((u_int)(xdrs->x_private - xdrs->x_base));
}
static bool_t
-xdrmem_setpos(XDR * xdrs, u_int pos)
+xdrmem_setpos(AFS_XDRS_T axdrs, u_int pos)
{
+ XDR * xdrs = (XDR *)axdrs;
+
caddr_t newaddr = xdrs->x_base + pos;
caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
}
static afs_int32 *
-xdrmem_inline(XDR * xdrs, int len)
+xdrmem_inline(AFS_XDRS_T axdrs, u_int len)
{
+ XDR * xdrs = (XDR *)axdrs;
+
afs_int32 *buf = 0;
if (len >= 0 && xdrs->x_handy >= len) {