XDR: Stop the madness
authorSimon Wilkinson <sxw@your-file-system.com>
Thu, 18 Feb 2010 00:04:22 +0000 (00:04 +0000)
committerDerrick Brashear <shadow@dementia.org>
Mon, 22 Mar 2010 21:54:43 +0000 (14:54 -0700)
We currently attempt to align our XDR implementation with what may
be provided by the host system. This leads to a huge amount of parameter
fudging, and general pain and misfortune. However, the only place that
we still actually use the system XDR is for UKERNEL builds.

Change this so that we use our XDR everywhere. Fix all of our type and
function definitions so that they're standard. Remove the warning
inhibitions.

Change-Id: I53f4539e50eacb4e0691d8d3d6546bbfb7438358
Reviewed-on: http://gerrit.openafs.org/1340
Reviewed-by: Chaz Chandler
Tested-by: Chaz Chandler
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
Reviewed-by: Simon Wilkinson <sxw@inf.ed.ac.uk>

README.WARNINGS
src/libuafs/Makefile.common.in
src/rx/xdr.h
src/rx/xdr_len.c
src/rx/xdr_mem.c
src/rx/xdr_rec.c
src/rx/xdr_rx.c
src/rx/xdr_stdio.c

index f3ff13f..50918ff 100644 (file)
@@ -58,12 +58,6 @@ libadmin/samples/rxstat_query_peer.c : all : util_RPCStatsStateGet types
 libadmin/samples/rxstat_query_process.c : all : util_RPCStatsStateGet types
 libadmin/test/client.c : all         : util_RPCStatsStateGet types
 rx/rx.c                     : all (pthread) : rxkad_global_stats_init not proto'd
-rx/xdr_len.c         : all (ukernel) : Prototypes don't match due to AFS_XDR_T 
-                                      not being used in the xdr header
-rx/xdr_mem.c         : all (ukernel) : Prototypes don't match due to AFS_XDR_T 
-                                      not being used in the xdr header
-rx/xdr_rx.c          : all (ukernel) : Prototypes don't match due to AFS_XDR_T 
-                                      not being used in the xdr header
 ubik/beacon.c        : all           : Ubik uses signed/unsigned 
                                       interchangably for IP addresses, a 
                                       fix will require API changes.
index 4e3c1c8..1c6a63c 100644 (file)
@@ -746,7 +746,7 @@ $(UOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
 $(UOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE1)
 $(UOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
-       $(CRULE1) @CFLAGS_NOERROR@
+       $(CRULE1)
 $(UOBJ)/xdr_int32.o: $(TOP_SRC_RX)/xdr_int32.c
        $(CRULE1)
 $(UOBJ)/xdr_int64.o: $(TOP_SRC_RX)/xdr_int64.c
@@ -870,9 +870,9 @@ $(UOBJ)/Krxstat.ss.o: $(TOP_OBJ_RXSTAT)/Krxstat.ss.c
 $(UOBJ)/Krxstat.xdr.o: $(TOP_OBJ_RXSTAT)/Krxstat.xdr.c
        $(CRULE1)
 $(UOBJ)/xdr_mem.o: $(TOP_SRC_RX)/xdr_mem.c
-       $(CRULE1) @CFLAGS_NOERROR@
+       $(CRULE1)
 $(UOBJ)/xdr_len.o: $(TOP_SRC_RX)/xdr_len.c
-       $(CRULE1) @CFLAGS_NOERROR@
+       $(CRULE1)
 
 # These files are for the netscape plugin
 
@@ -1017,7 +1017,7 @@ $(WEBOBJ)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
 $(WEBOBJ)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE2)
 $(WEBOBJ)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
-       $(CRULE2) @CFLAGS_NOERROR@
+       $(CRULE2)
 $(WEBOBJ)/afs_usrops.o: $(TOP_SRC_AFS)/UKERNEL/afs_usrops.c
        $(CRULE2)
 $(WEBOBJ)/afs_uuid.o: $(TOP_SRCDIR)/util/uuid.c
@@ -1144,9 +1144,9 @@ $(WEBOBJ)/Krxstat.ss.o: $(TOP_OBJ_RXSTAT)/Krxstat.ss.c
 $(WEBOBJ)/Krxstat.xdr.o: $(TOP_OBJ_RXSTAT)/Krxstat.xdr.c
        $(CRULE2)
 $(WEBOBJ)/xdr_mem.o: $(TOP_SRC_RX)/xdr_mem.c
-       $(CRULE2) @CFLAGS_NOERROR@
+       $(CRULE2)
 $(WEBOBJ)/xdr_len.o: $(TOP_SRC_RX)/xdr_len.c
-       $(CRULE2) @CFLAGS_NOERROR@
+       $(CRULE2)
 
 # These are for libjuafs.a 
 # Used for linking with libafsauthent and libafsrpc
@@ -1292,7 +1292,7 @@ $(JUAFS)/rx_packet.o: $(TOP_SRC_RX)/rx_packet.c
 $(JUAFS)/rx_conncache.o: $(TOP_SRCDIR)/rx/rx_conncache.c
        $(CRULE1)
 $(JUAFS)/xdr_rx.o: $(TOP_SRC_RX)/xdr_rx.c
-       $(CRULE1) @CFLAGS_NOERROR@
+       $(CRULE1)
 $(JUAFS)/xdr_int64.o: $(TOP_SRC_RX)/xdr_int64.c
        $(CRULE1)
 $(JUAFS)/afs_usrops.o: $(TOP_SRC_AFS)/UKERNEL/afs_usrops.c
@@ -1412,9 +1412,9 @@ $(JUAFS)/Krxstat.ss.o: $(TOP_OBJ_RXSTAT)/Krxstat.ss.c
 $(JUAFS)/Krxstat.xdr.o: $(TOP_OBJ_RXSTAT)/Krxstat.xdr.c
        $(CRULE1)
 $(JUAFS)/xdr_mem.o: $(TOP_SRC_RX)/xdr_mem.c
-       $(CRULE1) @CFLAGS_NOERROR@
+       $(CRULE1)
 $(JUAFS)/xdr_len.o: $(TOP_SRC_RX)/xdr_len.c
-       $(CRULE1) @CFLAGS_NOERROR@
+       $(CRULE1)
 
 clean:
        -$(RM) -rf UAFS* JUAFS* AFSWEB* nsapi des afs afsint config rx
index 655e684..babffe7 100644 (file)
 #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
@@ -222,31 +193,36 @@ typedef bool_t(*xdrproc_t) (void *, ...);
  * an operations vector for the paticular implementation (e.g. see xdr_mem.c),
  * and two private fields for the use of the particular impelementation.
  */
-typedef struct {
-    enum xdr_op x_op;          /* operation; fast additional param */
-    struct xdr_ops {
+
 #if defined(KERNEL) && ((defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV))
 /* NOTE: SGI 6.1 adds two routines to the xdr_ops if the size of a long is
  * 64 bits. I've only done this for the kernel, since other changes may
  * be necessary if we make a 64 bit user version of AFS.
  */
-       bool_t(*x_getint64) (void *xdrs, afs_int64 * lp);       /* get 32 bits into a long */
-       bool_t(*x_putint64) (void *xdrs, afs_int64 * lp);       /* send 32 bits of a long */
-#endif                         /* defined(KERNEL) && ((defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV)) */
+#define AFS_XDR_64BITOPS 1
+#endif
+
+typedef struct __afs_xdr {
+    enum xdr_op x_op;          /* operation; fast additional param */
+    struct xdr_ops {
+#ifdef AFS_XDR_64BITOPS
+       bool_t(*x_getint64) (struct __afs_xdr *xdrs, afs_int64 * lp);   /* get 32 bits into a long */
+       bool_t(*x_putint64) (struct __afs_xdr *xdrs, afs_int64 * lp);   /* send 32 bits of a long */
+#endif
 #if !(defined(KERNEL) && defined(AFS_SUN57_ENV))
-       bool_t(*x_getint32) (void *xdrs, afs_int32 * lp);       /* get an afs_int32 from underlying stream */
-       bool_t(*x_putint32) (void *xdrs, afs_int32 * lp);       /* put an afs_int32 to " */
+       bool_t(*x_getint32) (struct __afs_xdr *xdrs, afs_int32 * lp);   /* get an afs_int32 from underlying stream */
+       bool_t(*x_putint32) (struct __afs_xdr *xdrs, afs_int32 * lp);   /* put an afs_int32 to " */
 #endif
-       bool_t(*x_getbytes) (void *xdrs, caddr_t addr, u_int len);      /* get some bytes from " */
-       bool_t(*x_putbytes) (void *xdrs, caddr_t addr, u_int len);      /* put some bytes to " */
-       u_int(*x_getpostn) (void *xdrs);        /* returns bytes off from beginning */
-       bool_t(*x_setpostn) (void *xdrs, u_int pos);    /* lets you reposition the stream */
-       afs_int32 *(*x_inline) (void *xdrs, u_int len); /* buf quick ptr to buffered data */
-       void (*x_destroy) (void *xdrs); /* free privates of this xdr_stream */
+       bool_t(*x_getbytes) (struct __afs_xdr *xdrs, caddr_t addr, u_int len);  /* get some bytes from " */
+       bool_t(*x_putbytes) (struct __afs_xdr *xdrs, caddr_t addr, u_int len);  /* put some bytes to " */
+       u_int(*x_getpostn) (struct __afs_xdr *xdrs);    /* returns bytes off from beginning */
+       bool_t(*x_setpostn) (struct __afs_xdr *xdrs, u_int pos);        /* lets you reposition the stream */
+       afs_int32 *(*x_inline) (struct __afs_xdr *xdrs, u_int len);     /* buf quick ptr to buffered data */
+       void (*x_destroy) (struct __afs_xdr *xdrs);     /* free privates of this xdr_stream */
 #if defined(KERNEL) && defined(AFS_SUN57_ENV)
-         bool_t(*x_control) (void *xdrs);
-         bool_t(*x_getint32) (void *xdrs, afs_int32 * lp);
-         bool_t(*x_putint32) (void *xdrs, afs_int32 * lp);
+         bool_t(*x_control) (struct __afs_xdr *xdrs);
+         bool_t(*x_getint32) (struct __afs_xdr *xdrs, afs_int32 * lp);
+         bool_t(*x_putint32) (struct __afs_xdr *xdrs, afs_int32 * lp);
 #endif
     } *x_ops;
     caddr_t x_public;          /* users' data */
@@ -264,7 +240,7 @@ typedef struct {
  * u_int        len;
  * u_int        pos;
  */
-#if defined(AFS_SGI61_ENV) && defined(KERNEL) && (_MIPS_SZLONG != _MIPS_SZINT) || defined(AFS_HPUX_64BIT_ENV)
+#ifdef AFS_XDR_64BITOPS
 #define XDR_GETINT64(xdrs, int64p)                     \
        (*(xdrs)->x_ops->x_getint64)(xdrs, int64p)
 #define xdr_getint64(xdrs, int64p)                     \
@@ -274,7 +250,7 @@ typedef struct {
        (*(xdrs)->x_ops->x_putint64)(xdrs, int64p)
 #define xdr_putint64(xdrs, int64p)                     \
        (*(xdrs)->x_ops->x_putint64)(xdrs, int64p)
-#endif /* defined(KERNEL) && ((defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV)) */
+#endif /* AFS_XDR_64BITOPS */
 
 #define XDR_GETINT32(xdrs, int32p)                     \
        (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
index b3f0748..3b266ba 100644 (file)
 # include <stdlib.h>
 #endif
 
-#ifndef KERNEL
 #include "xdr.h"
-#elif !defined(UKERNEL)
-#include "rx/xdr.h"
-#else
-#include "rpc/types.h"
-#include "rpc/xdr.h"
-#define AFS_XDRS_T XDR *
-#endif
 
 static void
-xdrlen_destroy(AFS_XDRS_T axdrs)
+xdrlen_destroy(XDR *xdrs)
 {
 }
 
 static bool_t
-xdrlen_getint32(AFS_XDRS_T axdrs, afs_int32 * lp)
+xdrlen_getint32(XDR *xdrs, afs_int32 * lp)
 {
     return (FALSE);
 }
 
 static bool_t
-xdrlen_putint32(AFS_XDRS_T axdrs, afs_int32 * lp)
+xdrlen_putint32(XDR *xdrs, afs_int32 * lp)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     xdrs->x_handy += sizeof(afs_int32);
     return (TRUE);
 }
 
 static bool_t
-xdrlen_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
+xdrlen_getbytes(XDR *xdrs, caddr_t addr, u_int len)
 {
     return (FALSE);
 }
 
 static bool_t
-xdrlen_putbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
+xdrlen_putbytes(XDR *xdrs, caddr_t addr, u_int len)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     xdrs->x_handy += len;
     return (TRUE);
 }
 
 static u_int
-xdrlen_getpos(AFS_XDRS_T axdrs)
+xdrlen_getpos(XDR *xdrs)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     return xdrs->x_handy;
 }
 
 static bool_t
-xdrlen_setpos(AFS_XDRS_T axdrs, u_int pos)
+xdrlen_setpos(XDR *xdrs, u_int pos)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     xdrs->x_handy = pos;
     return (TRUE);
 }
 
 static afs_int32 *
-xdrlen_inline(AFS_XDRS_T axdrs, u_int len)
+xdrlen_inline(XDR *xdrs, u_int len)
 {
     return NULL;
 }
 
 static struct xdr_ops xdrlen_ops = {
 #if defined(AFS_NT40_ENV) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifdef AFS_XDR_64BITOPS
+    NULL,
+    NULL,
+#endif
     /* Windows does not support labeled assigments */
     xdrlen_getint32,    /* not supported */
     xdrlen_putint32,    /* serialize an afs_int32 */
@@ -111,13 +99,12 @@ static struct xdr_ops xdrlen_ops = {
     xdrlen_inline,      /* not supported */
     xdrlen_destroy      /* destroy stream */
 #else
-#if defined(UKERNEL)
-    .x_getlong = xdrlen_getint32,
-    .x_putlong = xdrlen_putint32,
-#else
+#ifdef AFS_XDR_64BITOPS
+    .x_getint64 = NULL,
+    .x_putint64 = NULL,
+#endif
     .x_getint32 = xdrlen_getint32,
     .x_putint32 = xdrlen_putint32,
-#endif
     .x_getbytes = xdrlen_getbytes,
     .x_putbytes = xdrlen_putbytes,
     .x_getpostn = xdrlen_getpos,
index de43262..d2f96b7 100644 (file)
 # endif
 #endif
 
-#ifndef KERNEL
 #include "xdr.h"
-#elif !defined(UKERNEL)
-#include "rx/xdr.h"
-#else
-#include "rpc/types.h"
-#include "rpc/xdr.h"
-#define AFS_XDRS_T XDR *
-#endif
 
-static bool_t xdrmem_getint32(AFS_XDRS_T axdrs, afs_int32 * lp);
-static bool_t xdrmem_putint32(AFS_XDRS_T axdrs, afs_int32 * lp);
-static bool_t xdrmem_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len);
-static bool_t xdrmem_putbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len);
-static u_int xdrmem_getpos(AFS_XDRS_T axdrs);
-static bool_t xdrmem_setpos(AFS_XDRS_T axdrs, u_int pos);
-static afs_int32 *xdrmem_inline(AFS_XDRS_T axdrs, u_int len);
-static void xdrmem_destroy(AFS_XDRS_T axdrs);
+static bool_t xdrmem_getint32(XDR *, afs_int32 *);
+static bool_t xdrmem_putint32(XDR *, afs_int32 *);
+static bool_t xdrmem_getbytes(XDR *, caddr_t, u_int);
+static bool_t xdrmem_putbytes(XDR *, caddr_t, u_int);
+static u_int xdrmem_getpos(XDR *);
+static bool_t xdrmem_setpos(XDR *, u_int);
+static afs_int32 *xdrmem_inline(XDR *, u_int);
+static void xdrmem_destroy(XDR *);
 
 static struct xdr_ops xdrmem_ops = {
 #if defined(AFS_NT40_ENV) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifdef AFS_XDR_64BITOPS
+    NULL,
+    NULL,
+#endif
     /* Windows does not support labeled assigments */
     xdrmem_getint32,    /* deserialize an afs_int32 */
     xdrmem_putint32,    /* serialize an afs_int32 */
@@ -81,13 +77,12 @@ static struct xdr_ops xdrmem_ops = {
     xdrmem_inline,      /* prime stream for inline macros */
     xdrmem_destroy      /* destroy stream */
 #else
-#if defined(UKERNEL)
-    .x_getlong = xdrmem_getint32,
-    .x_putlong = xdrmem_putint32,
-#else
-    .x_getint32 = xdrmem_getint32,       /* deserialize an afs_int32 */
-    .x_putint32 = xdrmem_putint32,       /* serialize an afs_int32 */
+#ifdef AFS_XDR_64BITOPS
+    .x_getint64 = NULL,
+    .x_putint64 = NULL,
 #endif
+    .x_getint32 = xdrmem_getint32,
+    .x_putint32 = xdrmem_putint32,
     .x_getbytes = xdrmem_getbytes,
     .x_putbytes = xdrmem_putbytes,
     .x_getpostn = xdrmem_getpos,
@@ -111,15 +106,13 @@ xdrmem_create(XDR * xdrs, caddr_t addr, u_int size, enum xdr_op op)
 }
 
 static void
-xdrmem_destroy(AFS_XDRS_T axdrs)
+xdrmem_destroy(XDR *xdrs)
 {
 }
 
 static bool_t
-xdrmem_getint32(AFS_XDRS_T axdrs, afs_int32 * lp)
+xdrmem_getint32(XDR *xdrs, afs_int32 * lp)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     if (xdrs->x_handy < sizeof(afs_int32))
        return (FALSE);
     else
@@ -130,10 +123,8 @@ xdrmem_getint32(AFS_XDRS_T axdrs, afs_int32 * lp)
 }
 
 static bool_t
-xdrmem_putint32(AFS_XDRS_T axdrs, afs_int32 * lp)
+xdrmem_putint32(XDR *xdrs, afs_int32 * lp)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     if (xdrs->x_handy < sizeof(afs_int32))
        return (FALSE);
     else
@@ -144,10 +135,8 @@ xdrmem_putint32(AFS_XDRS_T axdrs, afs_int32 * lp)
 }
 
 static bool_t
-xdrmem_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
+xdrmem_getbytes(XDR *xdrs, caddr_t addr, u_int len)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     if (xdrs->x_handy < len)
        return (FALSE);
     else
@@ -158,10 +147,8 @@ xdrmem_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
 }
 
 static bool_t
-xdrmem_putbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
+xdrmem_putbytes(XDR *xdrs, caddr_t addr, u_int len)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     if (xdrs->x_handy < len)
        return (FALSE);
     else
@@ -172,18 +159,14 @@ xdrmem_putbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
 }
 
 static u_int
-xdrmem_getpos(AFS_XDRS_T axdrs)
+xdrmem_getpos(XDR *xdrs)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
-    return ((u_int)((char *)xdrs->x_private - xdrs->x_base));
+    return ((u_int)(xdrs->x_private - xdrs->x_base));
 }
 
 static bool_t
-xdrmem_setpos(AFS_XDRS_T axdrs, u_int pos)
+xdrmem_setpos(XDR *xdrs, u_int pos)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     caddr_t newaddr = xdrs->x_base + pos;
     caddr_t lastaddr = xdrs->x_private + xdrs->x_handy;
 
@@ -195,10 +178,8 @@ xdrmem_setpos(AFS_XDRS_T axdrs, u_int pos)
 }
 
 static afs_int32 *
-xdrmem_inline(AFS_XDRS_T axdrs, u_int len)
+xdrmem_inline(XDR *xdrs, u_int len)
 {
-    XDR * xdrs = (XDR *)axdrs;
-
     afs_int32 *buf = 0;
 
     if (len >= 0 && xdrs->x_handy >= len) {
index 885e6be..a99cfb1 100644 (file)
@@ -118,6 +118,10 @@ static u_int fix_buf_size(u_int s);
 
 static struct xdr_ops xdrrec_ops = {
 #ifdef AFS_NT40_ENV
+#ifdef AFS_XDR_64BITOPS
+    NULL,
+    NULL,
+#endif
     /* Windows does not support labeled assignments */
     xdrrec_getint32,    /* deserialize an afs_int32 */
     xdrrec_putint32,    /* serialize an afs_int32 */
@@ -128,6 +132,10 @@ static struct xdr_ops xdrrec_ops = {
     xdrrec_inline,      /* prime stream for inline macros */
     xdrrec_destroy      /* destroy stream */
 #else
+#ifdef AFS_XDR_64BITOPS
+    .x_getint64 = NULL,
+    .x_putint64 = NULL,
+#endif
     .x_getint32 = xdrrec_getint32,
     .x_putint32 = xdrrec_putint32,
     .x_getbytes = xdrrec_getbytes,
index 7a2ed7e..01e2a3b 100644 (file)
 
 
 #ifdef KERNEL
-#include "afs/sysincludes.h"
-#ifndef UKERNEL
-#include "h/types.h"
-#include "h/uio.h"
-#ifdef AFS_OSF_ENV
-#include <net/net_globals.h>
-#endif /* AFS_OSF_ENV */
-#ifdef AFS_LINUX20_ENV
-#include "h/socket.h"
-#else
-#include "rpc/types.h"
-#endif
-#ifdef  AFS_OSF_ENV
-#undef kmem_alloc
-#undef kmem_free
-#undef mem_alloc
-#undef mem_free
-#undef register
-#endif /* AFS_OSF_ENV */
-#ifdef AFS_LINUX22_ENV
-#ifndef quad_t
-#define quad_t __quad_t
-#define u_quad_t __u_quad_t
-#endif
-#endif
-#include "rx/xdr.h"
-#include "netinet/in.h"
-#else /* !UKERNEL */
-#include "rpc/types.h"
-#include "rpc/xdr.h"
-#endif /* !UKERNEL */
-#include "rx/rx.h"
+# include "afs/sysincludes.h"
+# ifndef UKERNEL
+#  include "h/types.h"
+#  include "h/uio.h"
+#  ifdef AFS_OSF_ENV
+#   include <net/net_globals.h>
+#  endif /* AFS_OSF_ENV */
+#  ifdef AFS_LINUX20_ENV
+#   include "h/socket.h"
+#  else
+#   include "rpc/types.h"
+#  endif
+#  ifdef  AFS_OSF_ENV
+#   undef kmem_alloc
+#   undef kmem_free
+#   undef mem_alloc
+#   undef mem_free
+#   undef register
+#  endif /* AFS_OSF_ENV */
+#  ifdef AFS_LINUX22_ENV
+#   ifndef quad_t
+#    define quad_t __quad_t
+#    define u_quad_t __u_quad_t
+#   endif
+#  endif
+#  include "rx/xdr.h"
+#  include "netinet/in.h"
+# endif /* !UKERNEL */
+# include "rx/xdr.h"
+# include "rx/rx.h"
 
 #else /* KERNEL */
-#include <sys/types.h>
-#include <stdio.h>
-#ifndef AFS_NT40_ENV
-#include <netinet/in.h>
-#endif
-#include "rx.h"
-#include "xdr.h"
-#endif /* KERNEL */
-
-/*
- * This section should really go in the param.*.h files.
- */
-#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
+# include <sys/types.h>
+# include <stdio.h>
+# ifndef AFS_NT40_ENV
+#  include <netinet/in.h>
 # 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
+# include "rx.h"
+# include "xdr.h"
 #endif /* KERNEL */
 
 /* Static prototypes */
-#if (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV)
-static bool_t xdrrx_getint64(AFS_XDRS_T axdrs, long *lp);
-static bool_t xdrrx_putint64(AFS_XDRS_T axdrs, long *lp);
-#endif /* (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV) */
+#if AFS_XDR_64BITOPS
+static bool_t xdrrx_getint64(XDR *axdrs, long *lp);
+static bool_t xdrrx_putint64(XDR *axdrs, long *lp);
+#endif /* AFS_XDR_64BITOPS */
 
-static bool_t xdrrx_getint32(AFS_XDRS_T axdrs, afs_int32 * lp);
-static bool_t xdrrx_putint32(AFS_XDRS_T axdrs, afs_int32 * lp);
-static bool_t xdrrx_getbytes(AFS_XDRS_T axdrs, caddr_t addr,
+static bool_t xdrrx_getint32(XDR *axdrs, afs_int32 * lp);
+static bool_t xdrrx_putint32(XDR *axdrs, afs_int32 * lp);
+static bool_t xdrrx_getbytes(XDR *axdrs, caddr_t addr,
                             u_int len);
-static bool_t xdrrx_putbytes(AFS_XDRS_T axdrs, caddr_t addr,
+static bool_t xdrrx_putbytes(XDR *axdrs, caddr_t addr,
                             u_int len);
-static AFS_RPC_INLINE_T *xdrrx_inline(AFS_XDRS_T axdrs, u_int len);
+static afs_int32 *xdrrx_inline(XDR *axdrs, u_int len);
 
 
 /*
@@ -115,6 +81,10 @@ static AFS_RPC_INLINE_T *xdrrx_inline(AFS_XDRS_T axdrs, u_int len);
  */
 static struct xdr_ops xdrrx_ops = {
 #if defined(AFS_NT40_ENV) || (defined(AFS_SGI_ENV) && !defined(__c99))
+#ifdef AFS_XDR_64BITOPS
+    xdrrx_getint64,     /* deserialize an afs_int64 */
+    xdrrx_putint64,     /* serialize an afs_int64 */
+#endif
     /* Windows does not support labeled assigments */
     xdrrx_getint32,    /* deserialize an afs_int32 */
     xdrrx_putint32,    /* serialize an afs_int32 */
@@ -125,17 +95,12 @@ static struct xdr_ops xdrrx_ops = {
     xdrrx_inline,      /* prime stream for inline macros */
     NULL               /* destroy stream */
 #else
-#if defined(KERNEL) && ((defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV))
+#ifdef AFS_XDR_64BITOPS
     .x_getint64 = xdrrx_getint64,
     .x_putint64 = xdrrx_putint64,
-#endif /* defined(KERNEL) && ((defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV)) */
-#if defined(UKERNEL)
-    .x_getlong = xdrrx_getint32,
-    .x_putlong = xdrrx_putint32,
-#elif !(defined(KERNEL) && defined(AFS_SUN57_ENV))
+#endif /* AFS_XDR_64BITOPS */
     .x_getint32 = xdrrx_getint32,      /* deserialize an afs_int32 */
     .x_putint32 = xdrrx_putint32,      /* serialize an afs_int32 */
-#endif
     .x_getbytes = xdrrx_getbytes,      /* deserialize counted bytes */
     .x_putbytes = xdrrx_putbytes,      /* serialize counted bytes */
     .x_getpostn = NULL,                /* get offset in the stream: not supported. */
@@ -144,8 +109,6 @@ static struct xdr_ops xdrrx_ops = {
     .x_destroy = NULL,                 /* destroy stream */
 #if defined(KERNEL) && defined(AFS_SUN57_ENV)
     .x_control = NULL,
-    .x_getint32 = xdrrx_getint32,      /* deserialize an afs_int32 */
-    .x_putint32 = xdrrx_putint32,      /* serialize an afs_int32 */
 #endif
 #endif
 };
@@ -168,9 +131,9 @@ xdrrx_create(XDR * xdrs, struct rx_call *call,
 int rx_pin_failed = 0;
 #endif
 
-#if (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV)
+#ifdef AFS_XDR_64BITOPS
 static bool_t
-xdrrx_getint64(AFS_XDRS_T axdrs, long *lp)
+xdrrx_getint64(XDR *axdrs, long *lp)
 {
     XDR * xdrs = (XDR *)axdrs;
     struct rx_call *call = ((struct rx_call *)(xdrs)->x_private);
@@ -184,7 +147,7 @@ xdrrx_getint64(AFS_XDRS_T axdrs, long *lp)
 }
 
 static bool_t
-xdrrx_putint64(AFS_XDRS_T axdrs, long *lp)
+xdrrx_putint64(XDR *axdrs, long *lp)
 {
     XDR * xdrs = (XDR *)axdrs;
     afs_int32 code, i = htonl(*lp);
@@ -193,10 +156,10 @@ xdrrx_putint64(AFS_XDRS_T axdrs, long *lp)
     code = (rx_Write32(call, &i) == sizeof(i));
     return code;
 }
-#endif /* (defined(AFS_SGI61_ENV) && (_MIPS_SZLONG != _MIPS_SZINT)) || defined(AFS_HPUX_64BIT_ENV) */
+#endif /* AFS_XDR_64BITOPS */
 
 static bool_t
-xdrrx_getint32(AFS_XDRS_T axdrs, afs_int32 * lp)
+xdrrx_getint32(XDR *axdrs, afs_int32 * lp)
 {
     afs_int32 l;
     XDR * xdrs = (XDR *)axdrs;
@@ -235,7 +198,7 @@ xdrrx_getint32(AFS_XDRS_T axdrs, afs_int32 * lp)
 }
 
 static bool_t
-xdrrx_putint32(AFS_XDRS_T axdrs, afs_int32 * lp)
+xdrrx_putint32(XDR *axdrs, afs_int32 * lp)
 {
     afs_int32 code, l = htonl(*lp);
     XDR * xdrs = (XDR *)axdrs;
@@ -266,7 +229,7 @@ xdrrx_putint32(AFS_XDRS_T axdrs, afs_int32 * lp)
 }
 
 static bool_t
-xdrrx_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
+xdrrx_getbytes(XDR *axdrs, caddr_t addr, u_int len)
 {
     afs_int32 code;
     XDR * xdrs = (XDR *)axdrs;
@@ -298,7 +261,7 @@ xdrrx_getbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
 }
 
 static bool_t
-xdrrx_putbytes(AFS_XDRS_T axdrs, caddr_t addr, u_int len)
+xdrrx_putbytes(XDR *axdrs, caddr_t addr, u_int len)
 {
     afs_int32 code;
     XDR * xdrs = (XDR *)axdrs;
@@ -345,8 +308,8 @@ xdrrx_setpos(XDR * xdrs, u_int pos)
 }
 #endif
 
-static AFS_RPC_INLINE_T *
-xdrrx_inline(AFS_XDRS_T axdrs, u_int len)
+static afs_int32 *
+xdrrx_inline(XDR *axdrs, u_int len)
 {
     /* I don't know what this routine is supposed to do, but the stdio module returns null, so we will, too */
     return (0);
index f5886fa..da280b8 100644 (file)
@@ -59,6 +59,10 @@ static void xdrstdio_destroy();
  */
 static struct xdr_ops xdrstdio_ops = {
 #ifdef AFS_NT40_ENV
+#ifdef AFS_XDR_64BITOPS
+    NULL,
+    NULL,
+#endif
     /* Windows does not support labeled assignments */
     xdrstdio_getint32,         /* deserialize an afs_int32 */
     xdrstdio_putint32,         /* serialize an afs_int32 */
@@ -69,6 +73,10 @@ static struct xdr_ops xdrstdio_ops = {
     xdrstdio_inline,           /* prime stream for inline macros */
     xdrstdio_destroy           /* destroy stream */
 #else
+#ifdef AFS_XDR_64BITOPS
+    .x_getint64 = NULL,
+    .x_putint64 = NULL,
+#endif
     .x_getint32 = xdrstdio_getint32,   /* deserialize an afs_int32 */
     .x_putint32 = xdrstdio_putint32,   /* serialize an afs_int32 */
     .x_getbytes = xdrstdio_getbytes,   /* deserialize counted bytes */