XDR: decouple from system XDR implementation
authorAndrew Deason <adeason@sinenomine.net>
Mon, 2 Aug 2010 18:23:34 +0000 (13:23 -0500)
committerDerrick Brashear <shadow@dementia.org>
Sun, 10 Apr 2011 13:15:21 +0000 (06:15 -0700)
Since commit 7293ddf325b149cae60d3abe7199d08f196bd2b9 we have stopped
trying to use the system-provided XDR implementation, but the xdr_ops
structure was still structured to accomodate for the old limitations
of the system XDR. Change xdr_ops so it is just always one consistent
structure.

This removes:

 - The AFS_XDR_64BITOPS define and all related code, since we never
   call the 64-bit versions of getint and putint ourselves

 - The rearrangement of getint32/putint32 depending if we are in
   Solaris kernel-land or not

 - The .x_control field

Change-Id: I59b7579da1ea728eaba6b426011adbe4f7a331b6
Reviewed-on: http://gerrit.openafs.org/2503
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>

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 04236b1..61df7a1 100644 (file)
@@ -198,36 +198,17 @@ typedef bool_t(*xdrproc_t) (void *, ...);
  * and two private fields for the use of the particular impelementation.
  */
 
-#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.
- */
-#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) (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) (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) (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 */
     caddr_t x_private;         /* pointer to private data */
@@ -244,18 +225,6 @@ typedef struct __afs_xdr {
  * u_int        len;
  * u_int        pos;
  */
-#ifdef AFS_XDR_64BITOPS
-#define XDR_GETINT64(xdrs, int64p)                     \
-       (*(xdrs)->x_ops->x_getint64)(xdrs, int64p)
-#define xdr_getint64(xdrs, int64p)                     \
-       (*(xdrs)->x_ops->x_getint64)(xdrs, int64p)
-
-#define XDR_PUTINT64(xdrs, int64p)                     \
-       (*(xdrs)->x_ops->x_putint64)(xdrs, int64p)
-#define xdr_putint64(xdrs, int64p)                     \
-       (*(xdrs)->x_ops->x_putint64)(xdrs, int64p)
-#endif /* AFS_XDR_64BITOPS */
-
 #define XDR_GETINT32(xdrs, int32p)                     \
        (*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
 #define xdr_getint32(xdrs, int32p)                     \
index b3af0dc..5de15d0 100644 (file)
@@ -85,31 +85,16 @@ xdrlen_inline(XDR *xdrs, u_int len)
 
 static struct xdr_ops xdrlen_ops = {
 #ifndef HAVE_STRUCT_LABEL_SUPPORT
-#ifdef AFS_XDR_64BITOPS
-    NULL,
-    NULL,
-#endif
     /* Windows does not support labeled assigments */
-#if !(defined(KERNEL) && defined(AFS_SUN57_ENV))
     xdrlen_getint32,    /* not supported */
     xdrlen_putint32,    /* serialize an afs_int32 */
-#endif
     xdrlen_getbytes,    /* not supported */
     xdrlen_putbytes,    /* serialize counted bytes */
     xdrlen_getpos,      /* get offset in the stream */
     xdrlen_setpos,      /* set offset in the stream */
     xdrlen_inline,      /* not supported */
     xdrlen_destroy,     /* destroy stream */
-#if (defined(KERNEL) && defined(AFS_SUN57_ENV))
-    NULL,               /* control - not implemented */
-    xdrlen_getint32,    /* not supported */
-    xdrlen_putint32,    /* serialize an afs_int32 */
-#endif
 #else
-#ifdef AFS_XDR_64BITOPS
-    .x_getint64 = NULL,
-    .x_putint64 = NULL,
-#endif
     .x_getint32 = xdrlen_getint32,
     .x_putint32 = xdrlen_putint32,
     .x_getbytes = xdrlen_getbytes,
index f6af534..94e618b 100644 (file)
@@ -60,31 +60,16 @@ static void xdrmem_destroy(XDR *);
 
 static struct xdr_ops xdrmem_ops = {
 #ifndef HAVE_STRUCT_LABEL_SUPPORT
-#ifdef AFS_XDR_64BITOPS
-    NULL,
-    NULL,
-#endif
     /* Windows does not support labeled assigments */
-#if !(defined(KERNEL) && defined(AFS_SUN57_ENV))
     xdrmem_getint32,    /* deserialize an afs_int32 */
     xdrmem_putint32,    /* serialize an afs_int32 */
-#endif
     xdrmem_getbytes,    /* deserialize counted bytes */
     xdrmem_putbytes,    /* serialize counted bytes */
     xdrmem_getpos,      /* get offset in the stream: not supported. */
     xdrmem_setpos,      /* set offset in the stream: not supported. */
     xdrmem_inline,      /* prime stream for inline macros */
     xdrmem_destroy,     /* destroy stream */
-#if (defined(KERNEL) && defined(AFS_SUN57_ENV))
-    NULL,               /* control - not implemented */
-    xdrmem_getint32,    /* not supported */
-    xdrmem_putint32,    /* serialize an afs_int32 */
-#endif
 #else
-#ifdef AFS_XDR_64BITOPS
-    .x_getint64 = NULL,
-    .x_putint64 = NULL,
-#endif
     .x_getint32 = xdrmem_getint32,
     .x_putint32 = xdrmem_putint32,
     .x_getbytes = xdrmem_getbytes,
index 6f14cb7..587ee3e 100644 (file)
@@ -107,10 +107,6 @@ 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 */
 #if !(defined(KERNEL) && defined(AFS_SUN57_ENV))
     xdrrec_getint32,    /* deserialize an afs_int32 */
@@ -128,10 +124,6 @@ static struct xdr_ops xdrrec_ops = {
     xdrrec_putint32,    /* serialize an afs_int32 */
 #endif
 #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 a6e8e0c..b7a2426 100644 (file)
 #include "xdr.h"
 
 /* Static prototypes */
-#ifdef 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(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,
@@ -59,31 +54,16 @@ static afs_int32 *xdrrx_inline(XDR *axdrs, u_int len);
  */
 static struct xdr_ops xdrrx_ops = {
 #ifndef HAVE_STRUCT_LABEL_SUPPORT
-#ifdef AFS_XDR_64BITOPS
-    xdrrx_getint64,     /* deserialize an afs_int64 */
-    xdrrx_putint64,     /* serialize an afs_int64 */
-#endif
     /* Windows does not support labeled assigments */
-#if !(defined(KERNEL) && defined(AFS_SUN57_ENV))
     xdrrx_getint32,    /* deserialize an afs_int32 */
     xdrrx_putint32,    /* serialize an afs_int32 */
-#endif
     xdrrx_getbytes,    /* deserialize counted bytes */
     xdrrx_putbytes,    /* serialize counted bytes */
     NULL,              /* get offset in the stream: not supported. */
     NULL,              /* set offset in the stream: not supported. */
     xdrrx_inline,      /* prime stream for inline macros */
     NULL,              /* destroy stream */
-#if (defined(KERNEL) && defined(AFS_SUN57_ENV))
-    NULL,               /* control - not implemented */
-    xdrrx_getint32,     /* not supported */
-    xdrrx_putint32,     /* serialize an afs_int32 */
-#endif
 #else
-#ifdef AFS_XDR_64BITOPS
-    .x_getint64 = xdrrx_getint64,
-    .x_putint64 = xdrrx_putint64,
-#endif /* AFS_XDR_64BITOPS */
     .x_getint32 = xdrrx_getint32,      /* deserialize an afs_int32 */
     .x_putint32 = xdrrx_putint32,      /* serialize an afs_int32 */
     .x_getbytes = xdrrx_getbytes,      /* deserialize counted bytes */
@@ -92,9 +72,6 @@ static struct xdr_ops xdrrx_ops = {
     .x_setpostn = NULL,                /* set offset in the stream: not supported. */
     .x_inline = xdrrx_inline,          /* prime stream for inline macros */
     .x_destroy = NULL,                 /* destroy stream */
-#if defined(KERNEL) && defined(AFS_SUN57_ENV)
-    .x_control = NULL,
-#endif
 #endif
 };
 
@@ -116,33 +93,6 @@ xdrrx_create(XDR * xdrs, struct rx_call *call,
 int rx_pin_failed = 0;
 #endif
 
-#ifdef AFS_XDR_64BITOPS
-static bool_t
-xdrrx_getint64(XDR *axdrs, long *lp)
-{
-    XDR * xdrs = (XDR *)axdrs;
-    struct rx_call *call = ((struct rx_call *)(xdrs)->x_private);
-    afs_int32 i;
-
-    if (rx_Read32(call, &i) == sizeof(i)) {
-       *lp = ntohl(i);
-       return TRUE;
-    }
-    return FALSE;
-}
-
-static bool_t
-xdrrx_putint64(XDR *axdrs, long *lp)
-{
-    XDR * xdrs = (XDR *)axdrs;
-    afs_int32 code, i = htonl(*lp);
-    struct rx_call *call = ((struct rx_call *)(xdrs)->x_private);
-
-    code = (rx_Write32(call, &i) == sizeof(i));
-    return code;
-}
-#endif /* AFS_XDR_64BITOPS */
-
 static bool_t
 xdrrx_getint32(XDR *axdrs, afs_int32 * lp)
 {
index bca9086..21197e6 100644 (file)
@@ -59,10 +59,6 @@ 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 */
 #if !(defined(KERNEL) && defined(AFS_SUN57_ENV))
     xdrstdio_getint32,         /* deserialize an afs_int32 */
@@ -80,10 +76,6 @@ static struct xdr_ops xdrstdio_ops = {
     xdrstdio_putint32,    /* serialize an afs_int32 */
 #endif
 #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 */