* may copy or modify Sun RPC without charge, but are not authorized
* to license or distribute it to anyone else except as part of a product or
* program developed by the user.
- *
+ *
* SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
* WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
* PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
- *
+ *
* Sun RPC is provided with no support and without any obligation on the
* part of Sun Microsystems, Inc. to assist in its use, correction,
* modification or enhancement.
- *
+ *
* SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
* INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
* OR ANY PART THEREOF.
- *
+ *
* In no event will Sun Microsystems, Inc. be liable for any lost revenue
* or profits or other special, indirect and consequential damages, even if
* Sun has been advised of the possibility of such damages.
- *
+ *
* Sun Microsystems, Inc.
* 2550 Garcia Avenue
* Mountain View, California 94043
#endif /* !TRUE */
#define __dontcare__ -1
+#if defined(AFS_NBSD50_ENV)
+# if !defined(DEF_CADDR_T)
+typedef char * caddr_t;
+#define DEF_CADDR_T
+# endif
+#endif
+
#ifndef mem_alloc
#define mem_alloc(bsize) malloc(bsize)
#endif
#define mem_free(ptr, bsize) free(ptr)
#endif
-#ifdef KERNEL
-#define osi_alloc afs_osi_Alloc
-#define osi_free afs_osi_Free
-
-/* keep here for now, 64 bit issues */
-extern void *afs_osi_Alloc(size_t x);
-extern void *afs_osi_Alloc_NoSleep(size_t x);
-extern void afs_osi_Free(void *x, size_t asize);
-
-#ifndef UKERNEL
+#if !defined(AFS_NT40_ENV)
+#define xdr_alloc afs_xdr_alloc
+#define xdr_free afs_xdr_free
#define xdr_void afs_xdr_void
#define xdr_int afs_xdr_int
#define xdr_u_int afs_xdr_u_int
#define xdr_vector afs_xdr_vector
#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
+#define osi_alloc afs_osi_Alloc
+#define osi_free afs_osi_Free
+
+/* keep here for now, 64 bit issues */
+#ifndef AFS_OBSD44_ENV
+extern void *afs_osi_Alloc(size_t x);
+extern void afs_osi_Free(void *x, size_t asize);
+#endif
+
#endif
-#ifndef major /* ouch! */
+#ifndef major /* ouch! */
#include <sys/types.h>
#endif
* request.
*/
enum xdr_op {
- XDR_ENCODE=0,
- XDR_DECODE=1,
- XDR_FREE=2
+ XDR_ENCODE = 0,
+ XDR_DECODE = 1,
+ XDR_FREE = 2
};
/*
* allocate dynamic storage of the appropriate size and return it.
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
-#if 0
-typedef bool_t (*xdrproc_t)();
+
+/* We need a different prototype for i386 Linux kernel code, because it
+ * uses a register (rather than stack) based calling convention. The
+ * normal va_args prototype results in the arguments being placed on the
+ * stack, where they aren't accessible to the 'real' function.
+ */
+#if defined(AFS_I386_LINUX26_ENV) && defined(KERNEL) && !defined(UKERNEL)
+typedef bool_t(*xdrproc_t) (void *, caddr_t, u_int);
#else
-typedef bool_t (*xdrproc_t) (void *, ...);
+typedef bool_t(*xdrproc_t) (void *, ...);
#endif
-
/*
* The XDR handle.
* Contains operation which is being applied to the stream,
* 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(AFS_SGI61_ENV) && defined(KERNEL) && (_MIPS_SZLONG != _MIPS_SZINT)
+
+#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 /* AFS_SGI61_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 */
- caddr_t x_private; /* pointer to private data */
- caddr_t x_base; /* private used for position info */
- int x_handy; /* extra private word */
+ } *x_ops;
+ caddr_t x_public; /* users' data */
+ caddr_t x_private; /* pointer to private data */
+ caddr_t x_base; /* private used for position info */
+ int x_handy; /* extra private word */
} XDR;
/*
* u_int len;
* u_int pos;
*/
-#if defined(AFS_SGI61_ENV) && defined(KERNEL) && (_MIPS_SZLONG != _MIPS_SZINT)
+#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_putint64)(xdrs, int64p)
#define xdr_putint64(xdrs, int64p) \
(*(xdrs)->x_ops->x_putint64)(xdrs, int64p)
-#endif /* defined(AFS_SGI61_ENV) && KERNEL && (_MIPS_SZLONG != _MIPS_SZINT) */
+#endif /* AFS_XDR_64BITOPS */
#define XDR_GETINT32(xdrs, int32p) \
(*(xdrs)->x_ops->x_getint32)(xdrs, int32p)
*/
#define NULL_xdrproc_t ((xdrproc_t)0)
struct xdr_discrim {
- int value;
- xdrproc_t proc;
+ int value;
+ xdrproc_t proc;
};
/*
#define IXDR_PUT_U_SHORT(buf, v) IXDR_PUT_INT32((buf), ((afs_int32)(v)))
#include "xdr_prototypes.h"
-
#endif /* __XDR_INCLUDE__ */