xdr_proc_t really is different on linux26_i386
[openafs.git] / src / rx / xdr.c
index 4819b6e..e05293e 100644 (file)
@@ -35,8 +35,6 @@
 #include <string.h>
 #endif
 
-RCSID
-    ("$Header$");
 
 /*
  * xdr.c, Generic XDR routines implementation.
@@ -50,7 +48,7 @@ RCSID
 
 #ifndef        NeXT
 
-#ifdef KERNEL
+#if defined(KERNEL) && !defined(UKERNEL)
 #include <sys/param.h>
 #ifndef AFS_LINUX20_ENV
 #include <sys/systm.h>
@@ -59,7 +57,6 @@ RCSID
 #include <stdio.h>
 #endif
 #include "xdr.h"
-#include "rx_internal.h"
 #include "rx.h"
 
 /*
@@ -122,10 +119,10 @@ xdr_u_int(XDR * xdrs, u_int * uip)
 
     case XDR_ENCODE:
        l = (afs_uint32) * uip;
-       return (XDR_PUTINT32(xdrs, &l));
+       return (XDR_PUTINT32(xdrs, (afs_int32 *) &l));
 
     case XDR_DECODE:
-       if (!XDR_GETINT32(xdrs, &l)) {
+       if (!XDR_GETINT32(xdrs, (afs_int32 *) &l)) {
            return (FALSE);
        }
        *uip = (u_int) l;
@@ -177,10 +174,10 @@ xdr_u_long(XDR * xdrs, u_long * ulp)
 
     case XDR_ENCODE:
        l = (afs_uint32) * ulp;
-       return (XDR_PUTINT32(xdrs, &l));
+       return (XDR_PUTINT32(xdrs, (afs_int32 *)&l));
 
     case XDR_DECODE:
-       if (!XDR_GETINT32(xdrs, &l)) {
+       if (!XDR_GETINT32(xdrs, (afs_int32 *)&l)) {
            return (FALSE);
        }
        *ulp = (u_long) l;
@@ -232,10 +229,10 @@ xdr_u_char(XDR * xdrs, u_char * usp)
 
     case XDR_ENCODE:
        l = (afs_uint32) * usp;
-       return (XDR_PUTINT32(xdrs, &l));
+       return (XDR_PUTINT32(xdrs, (afs_int32 *)&l));
 
     case XDR_DECODE:
-       if (!XDR_GETINT32(xdrs, &l)) {
+       if (!XDR_GETINT32(xdrs, (afs_int32 *)&l)) {
            return (FALSE);
        }
        *usp = (u_char) l;
@@ -287,10 +284,10 @@ xdr_u_short(XDR * xdrs, u_short * usp)
 
     case XDR_ENCODE:
        l = (afs_uint32) * usp;
-       return (XDR_PUTINT32(xdrs, &l));
+       return (XDR_PUTINT32(xdrs, (afs_int32 *)&l));
 
     case XDR_DECODE:
-       if (!XDR_GETINT32(xdrs, &l)) {
+       if (!XDR_GETINT32(xdrs, (afs_int32 *)&l)) {
            return (FALSE);
        }
        *usp = (u_short) l;
@@ -585,9 +582,24 @@ xdr_wrapstring(XDR * xdrs, char **cpp)
 }
 #endif
 
-void 
-xdr_free(void *x, afs_int32 size)
+void *
+xdr_alloc(afs_int32 size)
 {
-    osi_free(x, size);
+    return osi_alloc(size);
+}
+
+void
+xdr_free(xdrproc_t proc, void *obj)
+{
+    XDR x;
+
+    x.x_op = XDR_FREE;
+
+    /* See note in xdr.h for the method behind this madness */
+#if defined(AFS_I386_LINUX26_ENV) && defined(KERNEL) && !defined(UKERNEL)
+    (*proc)(&x, obj, 0);
+#else
+    (*proc)(&x, obj);
+#endif
 }
 #endif /* NeXT */