Use ANSI C prototypes.
This commit is contained in:
parent
aef373ce38
commit
d660d38da5
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=283833
@ -76,9 +76,7 @@ static const char xdr_zero[BYTES_PER_XDR_UNIT] = { 0, 0, 0, 0 };
|
||||
* Not a filter, but a convenient utility nonetheless
|
||||
*/
|
||||
void
|
||||
xdr_free(proc, objp)
|
||||
xdrproc_t proc;
|
||||
void *objp;
|
||||
xdr_free(xdrproc_t proc, void *objp)
|
||||
{
|
||||
XDR x;
|
||||
|
||||
@ -101,9 +99,7 @@ xdr_void(void)
|
||||
* XDR integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_int(xdrs, ip)
|
||||
XDR *xdrs;
|
||||
int *ip;
|
||||
xdr_int(XDR *xdrs, int *ip)
|
||||
{
|
||||
long l;
|
||||
|
||||
@ -131,9 +127,7 @@ xdr_int(xdrs, ip)
|
||||
* XDR unsigned integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_int(xdrs, up)
|
||||
XDR *xdrs;
|
||||
u_int *up;
|
||||
xdr_u_int(XDR *xdrs, u_int *up)
|
||||
{
|
||||
u_long l;
|
||||
|
||||
@ -163,9 +157,7 @@ xdr_u_int(xdrs, up)
|
||||
* same as xdr_u_long - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_long(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
long *lp;
|
||||
xdr_long(XDR *xdrs, long *lp)
|
||||
{
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_ENCODE:
|
||||
@ -184,9 +176,7 @@ xdr_long(xdrs, lp)
|
||||
* same as xdr_long - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_long(xdrs, ulp)
|
||||
XDR *xdrs;
|
||||
u_long *ulp;
|
||||
xdr_u_long(XDR *xdrs, u_long *ulp)
|
||||
{
|
||||
switch (xdrs->x_op) {
|
||||
case XDR_ENCODE:
|
||||
@ -206,9 +196,7 @@ xdr_u_long(xdrs, ulp)
|
||||
* same as xdr_u_int32_t - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_int32_t(xdrs, int32_p)
|
||||
XDR *xdrs;
|
||||
int32_t *int32_p;
|
||||
xdr_int32_t(XDR *xdrs, int32_t *int32_p)
|
||||
{
|
||||
long l;
|
||||
|
||||
@ -237,9 +225,7 @@ xdr_int32_t(xdrs, int32_p)
|
||||
* same as xdr_int32_t - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_int32_t(xdrs, u_int32_p)
|
||||
XDR *xdrs;
|
||||
u_int32_t *u_int32_p;
|
||||
xdr_u_int32_t(XDR *xdrs, u_int32_t *u_int32_p)
|
||||
{
|
||||
u_long l;
|
||||
|
||||
@ -268,9 +254,7 @@ xdr_u_int32_t(xdrs, u_int32_p)
|
||||
* same as xdr_int32_t - open coded to save a proc call!
|
||||
*/
|
||||
bool_t
|
||||
xdr_uint32_t(xdrs, u_int32_p)
|
||||
XDR *xdrs;
|
||||
uint32_t *u_int32_p;
|
||||
xdr_uint32_t(XDR *xdrs, uint32_t *u_int32_p)
|
||||
{
|
||||
u_long l;
|
||||
|
||||
@ -298,9 +282,7 @@ xdr_uint32_t(xdrs, u_int32_p)
|
||||
* XDR short integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_short(xdrs, sp)
|
||||
XDR *xdrs;
|
||||
short *sp;
|
||||
xdr_short(XDR *xdrs, short *sp)
|
||||
{
|
||||
long l;
|
||||
|
||||
@ -328,9 +310,7 @@ xdr_short(xdrs, sp)
|
||||
* XDR unsigned short integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_short(xdrs, usp)
|
||||
XDR *xdrs;
|
||||
u_short *usp;
|
||||
xdr_u_short(XDR *xdrs, u_short *usp)
|
||||
{
|
||||
u_long l;
|
||||
|
||||
@ -359,9 +339,7 @@ xdr_u_short(xdrs, usp)
|
||||
* XDR 16-bit integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_int16_t(xdrs, int16_p)
|
||||
XDR *xdrs;
|
||||
int16_t *int16_p;
|
||||
xdr_int16_t(XDR *xdrs, int16_t *int16_p)
|
||||
{
|
||||
long l;
|
||||
|
||||
@ -389,9 +367,7 @@ xdr_int16_t(xdrs, int16_p)
|
||||
* XDR unsigned 16-bit integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_int16_t(xdrs, u_int16_p)
|
||||
XDR *xdrs;
|
||||
u_int16_t *u_int16_p;
|
||||
xdr_u_int16_t(XDR *xdrs, u_int16_t *u_int16_p)
|
||||
{
|
||||
u_long l;
|
||||
|
||||
@ -419,9 +395,7 @@ xdr_u_int16_t(xdrs, u_int16_p)
|
||||
* XDR unsigned 16-bit integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_uint16_t(xdrs, u_int16_p)
|
||||
XDR *xdrs;
|
||||
uint16_t *u_int16_p;
|
||||
xdr_uint16_t(XDR *xdrs, uint16_t *u_int16_p)
|
||||
{
|
||||
u_long l;
|
||||
|
||||
@ -450,9 +424,7 @@ xdr_uint16_t(xdrs, u_int16_p)
|
||||
* XDR a char
|
||||
*/
|
||||
bool_t
|
||||
xdr_char(xdrs, cp)
|
||||
XDR *xdrs;
|
||||
char *cp;
|
||||
xdr_char(XDR *xdrs, char *cp)
|
||||
{
|
||||
int i;
|
||||
|
||||
@ -468,9 +440,7 @@ xdr_char(xdrs, cp)
|
||||
* XDR an unsigned char
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_char(xdrs, cp)
|
||||
XDR *xdrs;
|
||||
u_char *cp;
|
||||
xdr_u_char(XDR *xdrs, u_char *cp)
|
||||
{
|
||||
u_int u;
|
||||
|
||||
@ -486,9 +456,7 @@ xdr_u_char(xdrs, cp)
|
||||
* XDR booleans
|
||||
*/
|
||||
bool_t
|
||||
xdr_bool(xdrs, bp)
|
||||
XDR *xdrs;
|
||||
bool_t *bp;
|
||||
xdr_bool(XDR *xdrs, bool_t *bp)
|
||||
{
|
||||
long lb;
|
||||
|
||||
@ -516,9 +484,7 @@ xdr_bool(xdrs, bp)
|
||||
* XDR enumerations
|
||||
*/
|
||||
bool_t
|
||||
xdr_enum(xdrs, ep)
|
||||
XDR *xdrs;
|
||||
enum_t *ep;
|
||||
xdr_enum(XDR *xdrs, enum_t *ep)
|
||||
{
|
||||
enum sizecheck { SIZEVAL }; /* used to find the size of an enum */
|
||||
|
||||
@ -542,10 +508,7 @@ xdr_enum(xdrs, ep)
|
||||
* cp points to the opaque object and cnt gives the byte length.
|
||||
*/
|
||||
bool_t
|
||||
xdr_opaque(xdrs, cp, cnt)
|
||||
XDR *xdrs;
|
||||
caddr_t cp;
|
||||
u_int cnt;
|
||||
xdr_opaque(XDR *xdrs, caddr_t cp, u_int cnt)
|
||||
{
|
||||
u_int rndup;
|
||||
static int crud[BYTES_PER_XDR_UNIT];
|
||||
@ -594,11 +557,7 @@ xdr_opaque(xdrs, cp, cnt)
|
||||
* If *cpp is NULL maxsize bytes are allocated
|
||||
*/
|
||||
bool_t
|
||||
xdr_bytes(xdrs, cpp, sizep, maxsize)
|
||||
XDR *xdrs;
|
||||
char **cpp;
|
||||
u_int *sizep;
|
||||
u_int maxsize;
|
||||
xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
|
||||
{
|
||||
char *sp = *cpp; /* sp is the actual string pointer */
|
||||
u_int nodesize;
|
||||
@ -650,9 +609,7 @@ xdr_bytes(xdrs, cpp, sizep, maxsize)
|
||||
* Implemented here due to commonality of the object.
|
||||
*/
|
||||
bool_t
|
||||
xdr_netobj(xdrs, np)
|
||||
XDR *xdrs;
|
||||
struct netobj *np;
|
||||
xdr_netobj(XDR *xdrs, struct netobj *np)
|
||||
{
|
||||
|
||||
return (xdr_bytes(xdrs, &np->n_bytes, &np->n_len, MAX_NETOBJ_SZ));
|
||||
@ -670,12 +627,14 @@ xdr_netobj(xdrs, np)
|
||||
* If there is no specific or default routine an error is returned.
|
||||
*/
|
||||
bool_t
|
||||
xdr_union(xdrs, dscmp, unp, choices, dfault)
|
||||
XDR *xdrs;
|
||||
enum_t *dscmp; /* enum to decide which arm to work on */
|
||||
char *unp; /* the union itself */
|
||||
const struct xdr_discrim *choices; /* [value, xdr proc] for each arm */
|
||||
xdrproc_t dfault; /* default xdr routine */
|
||||
xdr_union(XDR *xdrs, enum_t *dscmp, char *unp, const struct xdr_discrim *choices, xdrproc_t dfault)
|
||||
/*
|
||||
* XDR *xdrs;
|
||||
* enum_t *dscmp; // enum to decide which arm to work on
|
||||
* char *unp; // the union itself
|
||||
* const struct xdr_discrim *choices; // [value, xdr proc] for each arm
|
||||
* xdrproc_t dfault; // default xdr routine
|
||||
*/
|
||||
{
|
||||
enum_t dscm;
|
||||
|
||||
@ -719,10 +678,7 @@ xdr_union(xdrs, dscmp, unp, choices, dfault)
|
||||
* of the string as specified by a protocol.
|
||||
*/
|
||||
bool_t
|
||||
xdr_string(xdrs, cpp, maxsize)
|
||||
XDR *xdrs;
|
||||
char **cpp;
|
||||
u_int maxsize;
|
||||
xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
|
||||
{
|
||||
char *sp = *cpp; /* sp is the actual string pointer */
|
||||
u_int size;
|
||||
@ -786,9 +742,7 @@ xdr_string(xdrs, cpp, maxsize)
|
||||
* routines like clnt_call
|
||||
*/
|
||||
bool_t
|
||||
xdr_wrapstring(xdrs, cpp)
|
||||
XDR *xdrs;
|
||||
char **cpp;
|
||||
xdr_wrapstring(XDR *xdrs, char **cpp)
|
||||
{
|
||||
return xdr_string(xdrs, cpp, LASTUNSIGNED);
|
||||
}
|
||||
@ -805,9 +759,7 @@ xdr_wrapstring(xdrs, cpp)
|
||||
* XDR 64-bit integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_int64_t(xdrs, llp)
|
||||
XDR *xdrs;
|
||||
int64_t *llp;
|
||||
xdr_int64_t(XDR *xdrs, int64_t *llp)
|
||||
{
|
||||
u_long ul[2];
|
||||
|
||||
@ -838,9 +790,7 @@ xdr_int64_t(xdrs, llp)
|
||||
* XDR unsigned 64-bit integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_int64_t(xdrs, ullp)
|
||||
XDR *xdrs;
|
||||
u_int64_t *ullp;
|
||||
xdr_u_int64_t(XDR *xdrs, u_int64_t *ullp)
|
||||
{
|
||||
u_long ul[2];
|
||||
|
||||
@ -870,9 +820,7 @@ xdr_u_int64_t(xdrs, ullp)
|
||||
* XDR unsigned 64-bit integers
|
||||
*/
|
||||
bool_t
|
||||
xdr_uint64_t(xdrs, ullp)
|
||||
XDR *xdrs;
|
||||
uint64_t *ullp;
|
||||
xdr_uint64_t(XDR *xdrs, uint64_t *ullp)
|
||||
{
|
||||
u_long ul[2];
|
||||
|
||||
@ -903,9 +851,7 @@ xdr_uint64_t(xdrs, ullp)
|
||||
* XDR hypers
|
||||
*/
|
||||
bool_t
|
||||
xdr_hyper(xdrs, llp)
|
||||
XDR *xdrs;
|
||||
longlong_t *llp;
|
||||
xdr_hyper(XDR *xdrs, longlong_t *llp)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -920,9 +866,7 @@ xdr_hyper(xdrs, llp)
|
||||
* XDR unsigned hypers
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_hyper(xdrs, ullp)
|
||||
XDR *xdrs;
|
||||
u_longlong_t *ullp;
|
||||
xdr_u_hyper(XDR *xdrs, u_longlong_t *ullp)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -937,9 +881,7 @@ xdr_u_hyper(xdrs, ullp)
|
||||
* XDR longlong_t's
|
||||
*/
|
||||
bool_t
|
||||
xdr_longlong_t(xdrs, llp)
|
||||
XDR *xdrs;
|
||||
longlong_t *llp;
|
||||
xdr_longlong_t(XDR *xdrs, longlong_t *llp)
|
||||
{
|
||||
|
||||
/*
|
||||
@ -954,9 +896,7 @@ xdr_longlong_t(xdrs, llp)
|
||||
* XDR u_longlong_t's
|
||||
*/
|
||||
bool_t
|
||||
xdr_u_longlong_t(xdrs, ullp)
|
||||
XDR *xdrs;
|
||||
u_longlong_t *ullp;
|
||||
xdr_u_longlong_t(XDR *xdrs, u_longlong_t *ullp)
|
||||
{
|
||||
|
||||
/*
|
||||
|
@ -64,13 +64,15 @@ __FBSDID("$FreeBSD$");
|
||||
* xdr procedure to call to handle each element of the array.
|
||||
*/
|
||||
bool_t
|
||||
xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
|
||||
XDR *xdrs;
|
||||
caddr_t *addrp; /* array pointer */
|
||||
u_int *sizep; /* number of elements */
|
||||
u_int maxsize; /* max numberof elements */
|
||||
u_int elsize; /* size in bytes of each element */
|
||||
xdrproc_t elproc; /* xdr routine to handle each element */
|
||||
xdr_array(XDR *xdrs, caddr_t *addrp, u_int *sizep, u_int maxsize, u_int elsize, xdrproc_t elproc)
|
||||
/*
|
||||
* XDR *xdrs;
|
||||
* caddr_t *addrp; // array pointer
|
||||
* u_int *sizep; // number of elements
|
||||
* u_int maxsize; // max numberof elements
|
||||
* u_int elsize; // size in bytes of each element
|
||||
* xdrproc_t elproc; // xdr routine to handle each element
|
||||
*/
|
||||
{
|
||||
u_int i;
|
||||
caddr_t target = *addrp;
|
||||
@ -142,12 +144,7 @@ xdr_array(xdrs, addrp, sizep, maxsize, elsize, elproc)
|
||||
* > xdr_elem: routine to XDR each element
|
||||
*/
|
||||
bool_t
|
||||
xdr_vector(xdrs, basep, nelem, elemsize, xdr_elem)
|
||||
XDR *xdrs;
|
||||
char *basep;
|
||||
u_int nelem;
|
||||
u_int elemsize;
|
||||
xdrproc_t xdr_elem;
|
||||
xdr_vector(XDR *xdrs, char *basep, u_int nelem, u_int elemsize, xdrproc_t xdr_elem)
|
||||
{
|
||||
u_int i;
|
||||
char *elptr;
|
||||
|
@ -204,9 +204,7 @@ static struct dbl_limits {
|
||||
|
||||
|
||||
bool_t
|
||||
xdr_double(xdrs, dp)
|
||||
XDR *xdrs;
|
||||
double *dp;
|
||||
xdr_double(XDR *xdrs, double *dp)
|
||||
{
|
||||
#ifdef IEEEFP
|
||||
int32_t *i32p;
|
||||
|
@ -98,11 +98,7 @@ static const struct xdr_ops xdrmem_ops_unaligned = {
|
||||
* memory buffer.
|
||||
*/
|
||||
void
|
||||
xdrmem_create(xdrs, addr, size, op)
|
||||
XDR *xdrs;
|
||||
char *addr;
|
||||
u_int size;
|
||||
enum xdr_op op;
|
||||
xdrmem_create(XDR *xdrs, char *addr, u_int size, enum xdr_op op)
|
||||
{
|
||||
|
||||
xdrs->x_op = op;
|
||||
@ -114,16 +110,13 @@ xdrmem_create(xdrs, addr, size, op)
|
||||
|
||||
/*ARGSUSED*/
|
||||
static void
|
||||
xdrmem_destroy(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrmem_destroy(XDR *xdrs)
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_getlong_aligned(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
long *lp;
|
||||
xdrmem_getlong_aligned(XDR *xdrs, long *lp)
|
||||
{
|
||||
|
||||
if (xdrs->x_handy < sizeof(int32_t))
|
||||
@ -135,9 +128,7 @@ xdrmem_getlong_aligned(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_putlong_aligned(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
const long *lp;
|
||||
xdrmem_putlong_aligned(XDR *xdrs, const long *lp)
|
||||
{
|
||||
|
||||
if (xdrs->x_handy < sizeof(int32_t))
|
||||
@ -149,9 +140,7 @@ xdrmem_putlong_aligned(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_getlong_unaligned(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
long *lp;
|
||||
xdrmem_getlong_unaligned(XDR *xdrs, long *lp)
|
||||
{
|
||||
u_int32_t l;
|
||||
|
||||
@ -165,9 +154,7 @@ xdrmem_getlong_unaligned(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_putlong_unaligned(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
const long *lp;
|
||||
xdrmem_putlong_unaligned(XDR *xdrs, const long *lp)
|
||||
{
|
||||
u_int32_t l;
|
||||
|
||||
@ -181,10 +168,7 @@ xdrmem_putlong_unaligned(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_getbytes(xdrs, addr, len)
|
||||
XDR *xdrs;
|
||||
char *addr;
|
||||
u_int len;
|
||||
xdrmem_getbytes(XDR *xdrs, char *addr, u_int len)
|
||||
{
|
||||
|
||||
if (xdrs->x_handy < len)
|
||||
@ -196,10 +180,7 @@ xdrmem_getbytes(xdrs, addr, len)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_putbytes(xdrs, addr, len)
|
||||
XDR *xdrs;
|
||||
const char *addr;
|
||||
u_int len;
|
||||
xdrmem_putbytes(XDR *xdrs, const char *addr, u_int len)
|
||||
{
|
||||
|
||||
if (xdrs->x_handy < len)
|
||||
@ -211,8 +192,7 @@ xdrmem_putbytes(xdrs, addr, len)
|
||||
}
|
||||
|
||||
static u_int
|
||||
xdrmem_getpos(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrmem_getpos(XDR *xdrs)
|
||||
{
|
||||
|
||||
/* XXX w/64-bit pointers, u_int not enough! */
|
||||
@ -220,9 +200,7 @@ xdrmem_getpos(xdrs)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrmem_setpos(xdrs, pos)
|
||||
XDR *xdrs;
|
||||
u_int pos;
|
||||
xdrmem_setpos(XDR *xdrs, u_int pos)
|
||||
{
|
||||
char *newaddr = xdrs->x_base + pos;
|
||||
char *lastaddr = (char *)xdrs->x_private + xdrs->x_handy;
|
||||
@ -235,9 +213,7 @@ xdrmem_setpos(xdrs, pos)
|
||||
}
|
||||
|
||||
static int32_t *
|
||||
xdrmem_inline_aligned(xdrs, len)
|
||||
XDR *xdrs;
|
||||
u_int len;
|
||||
xdrmem_inline_aligned(XDR *xdrs, u_int len)
|
||||
{
|
||||
int32_t *buf = 0;
|
||||
|
||||
@ -251,9 +227,7 @@ xdrmem_inline_aligned(xdrs, len)
|
||||
|
||||
/* ARGSUSED */
|
||||
static int32_t *
|
||||
xdrmem_inline_unaligned(xdrs, len)
|
||||
XDR *xdrs;
|
||||
u_int len;
|
||||
xdrmem_inline_unaligned(XDR *xdrs, u_int len)
|
||||
{
|
||||
|
||||
return (0);
|
||||
|
@ -161,15 +161,18 @@ static bool_t realloc_stream(RECSTREAM *, int);
|
||||
* calls expect that they take an opaque handle rather than an fd.
|
||||
*/
|
||||
void
|
||||
xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
||||
XDR *xdrs;
|
||||
u_int sendsize;
|
||||
u_int recvsize;
|
||||
void *tcp_handle;
|
||||
/* like read, but pass it a tcp_handle, not sock */
|
||||
int (*readit)(void *, void *, int);
|
||||
/* like write, but pass it a tcp_handle, not sock */
|
||||
int (*writeit)(void *, void *, int);
|
||||
xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, void *tcp_handle,
|
||||
int (*readit)(void *, void *, int), int (*writeit)(void *, void *, int))
|
||||
/*
|
||||
* XDR *xdrs;
|
||||
* u_int sendsize;
|
||||
* u_int recvsize;
|
||||
* void *tcp_handle;
|
||||
* // like read, but pass it a tcp_handle, not sock
|
||||
* int (*readit)(void *, void *, int);
|
||||
* // like write, but pass it a tcp_handle, not sock
|
||||
* int (*writeit)(void *, void *, int);
|
||||
*/
|
||||
{
|
||||
RECSTREAM *rstrm = mem_alloc(sizeof(RECSTREAM));
|
||||
|
||||
@ -229,9 +232,7 @@ xdrrec_create(xdrs, sendsize, recvsize, tcp_handle, readit, writeit)
|
||||
*/
|
||||
|
||||
static bool_t
|
||||
xdrrec_getlong(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
long *lp;
|
||||
xdrrec_getlong(XDR *xdrs, long *lp)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
int32_t *buflp = (int32_t *)(void *)(rstrm->in_finger);
|
||||
@ -253,9 +254,7 @@ xdrrec_getlong(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrrec_putlong(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
const long *lp;
|
||||
xdrrec_putlong(XDR *xdrs, const long *lp)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
int32_t *dest_lp = ((int32_t *)(void *)(rstrm->out_finger));
|
||||
@ -277,10 +276,7 @@ xdrrec_putlong(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t /* must manage buffers, fragments, and records */
|
||||
xdrrec_getbytes(xdrs, addr, len)
|
||||
XDR *xdrs;
|
||||
char *addr;
|
||||
u_int len;
|
||||
xdrrec_getbytes(XDR *xdrs, char *addr, u_int len)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
int current;
|
||||
@ -305,10 +301,7 @@ xdrrec_getbytes(xdrs, addr, len)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrrec_putbytes(xdrs, addr, len)
|
||||
XDR *xdrs;
|
||||
const char *addr;
|
||||
u_int len;
|
||||
xdrrec_putbytes(XDR *xdrs, const char *addr, u_int len)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
size_t current;
|
||||
@ -331,8 +324,7 @@ xdrrec_putbytes(xdrs, addr, len)
|
||||
}
|
||||
|
||||
static u_int
|
||||
xdrrec_getpos(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrrec_getpos(XDR *xdrs)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
||||
off_t pos;
|
||||
@ -358,9 +350,7 @@ xdrrec_getpos(xdrs)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrrec_setpos(xdrs, pos)
|
||||
XDR *xdrs;
|
||||
u_int pos;
|
||||
xdrrec_setpos(XDR *xdrs, u_int pos)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
||||
u_int currpos = xdrrec_getpos(xdrs);
|
||||
@ -397,9 +387,7 @@ xdrrec_setpos(xdrs, pos)
|
||||
}
|
||||
|
||||
static int32_t *
|
||||
xdrrec_inline(xdrs, len)
|
||||
XDR *xdrs;
|
||||
u_int len;
|
||||
xdrrec_inline(XDR *xdrs, u_int len)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
||||
int32_t *buf = NULL;
|
||||
@ -429,8 +417,7 @@ xdrrec_inline(xdrs, len)
|
||||
}
|
||||
|
||||
static void
|
||||
xdrrec_destroy(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrrec_destroy(XDR *xdrs)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)xdrs->x_private;
|
||||
|
||||
@ -449,8 +436,7 @@ xdrrec_destroy(xdrs)
|
||||
* this procedure to guarantee proper record alignment.
|
||||
*/
|
||||
bool_t
|
||||
xdrrec_skiprecord(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrrec_skiprecord(XDR *xdrs)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
enum xprt_stat xstat;
|
||||
@ -485,8 +471,7 @@ xdrrec_skiprecord(xdrs)
|
||||
* after consuming the rest of the current record.
|
||||
*/
|
||||
bool_t
|
||||
xdrrec_eof(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrrec_eof(XDR *xdrs)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
|
||||
@ -509,9 +494,7 @@ xdrrec_eof(xdrs)
|
||||
* pipelined procedure calls.) TRUE => immmediate flush to tcp connection.
|
||||
*/
|
||||
bool_t
|
||||
xdrrec_endofrecord(xdrs, sendnow)
|
||||
XDR *xdrs;
|
||||
bool_t sendnow;
|
||||
xdrrec_endofrecord(XDR *xdrs, bool_t sendnow)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
u_long len; /* fragment length */
|
||||
@ -535,10 +518,7 @@ xdrrec_endofrecord(xdrs, sendnow)
|
||||
* Return true if a record is available in the buffer, false if not.
|
||||
*/
|
||||
bool_t
|
||||
__xdrrec_getrec(xdrs, statp, expectdata)
|
||||
XDR *xdrs;
|
||||
enum xprt_stat *statp;
|
||||
bool_t expectdata;
|
||||
__xdrrec_getrec(XDR *xdrs, enum xprt_stat *statp, bool_t expectdata)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
ssize_t n;
|
||||
@ -618,9 +598,7 @@ __xdrrec_getrec(xdrs, statp, expectdata)
|
||||
}
|
||||
|
||||
bool_t
|
||||
__xdrrec_setnonblock(xdrs, maxrec)
|
||||
XDR *xdrs;
|
||||
int maxrec;
|
||||
__xdrrec_setnonblock(XDR *xdrs, int maxrec)
|
||||
{
|
||||
RECSTREAM *rstrm = (RECSTREAM *)(xdrs->x_private);
|
||||
|
||||
@ -635,9 +613,7 @@ __xdrrec_setnonblock(xdrs, maxrec)
|
||||
* Internal useful routines
|
||||
*/
|
||||
static bool_t
|
||||
flush_out(rstrm, eor)
|
||||
RECSTREAM *rstrm;
|
||||
bool_t eor;
|
||||
flush_out(RECSTREAM *rstrm, bool_t eor)
|
||||
{
|
||||
u_int32_t eormask = (eor == TRUE) ? LAST_FRAG : 0;
|
||||
u_int32_t len = (u_int32_t)((u_long)(rstrm->out_finger) -
|
||||
@ -655,8 +631,7 @@ flush_out(rstrm, eor)
|
||||
}
|
||||
|
||||
static bool_t /* knows nothing about records! Only about input buffers */
|
||||
fill_input_buf(rstrm)
|
||||
RECSTREAM *rstrm;
|
||||
fill_input_buf(RECSTREAM *rstrm)
|
||||
{
|
||||
char *where;
|
||||
u_int32_t i;
|
||||
@ -678,10 +653,7 @@ fill_input_buf(rstrm)
|
||||
}
|
||||
|
||||
static bool_t /* knows nothing about records! Only about input buffers */
|
||||
get_input_bytes(rstrm, addr, len)
|
||||
RECSTREAM *rstrm;
|
||||
char *addr;
|
||||
int len;
|
||||
get_input_bytes(RECSTREAM *rstrm, char *addr, int len)
|
||||
{
|
||||
size_t current;
|
||||
|
||||
@ -711,8 +683,7 @@ get_input_bytes(rstrm, addr, len)
|
||||
}
|
||||
|
||||
static bool_t /* next two bytes of the input stream are treated as a header */
|
||||
set_input_fragment(rstrm)
|
||||
RECSTREAM *rstrm;
|
||||
set_input_fragment(RECSTREAM *rstrm)
|
||||
{
|
||||
u_int32_t header;
|
||||
|
||||
@ -737,9 +708,7 @@ set_input_fragment(rstrm)
|
||||
}
|
||||
|
||||
static bool_t /* consumes input bytes; knows nothing about records! */
|
||||
skip_input_bytes(rstrm, cnt)
|
||||
RECSTREAM *rstrm;
|
||||
long cnt;
|
||||
skip_input_bytes(RECSTREAM *rstrm, long cnt)
|
||||
{
|
||||
u_int32_t current;
|
||||
|
||||
@ -759,8 +728,7 @@ skip_input_bytes(rstrm, cnt)
|
||||
}
|
||||
|
||||
static u_int
|
||||
fix_buf_size(s)
|
||||
u_int s;
|
||||
fix_buf_size(u_int s)
|
||||
{
|
||||
|
||||
if (s < 100)
|
||||
@ -772,9 +740,7 @@ fix_buf_size(s)
|
||||
* Reallocate the input buffer for a non-block stream.
|
||||
*/
|
||||
static bool_t
|
||||
realloc_stream(rstrm, size)
|
||||
RECSTREAM *rstrm;
|
||||
int size;
|
||||
realloc_stream(RECSTREAM *rstrm, int size)
|
||||
{
|
||||
ptrdiff_t diff;
|
||||
char *buf;
|
||||
|
@ -65,11 +65,13 @@ __FBSDID("$FreeBSD$");
|
||||
* proc is the routine to handle the referenced structure.
|
||||
*/
|
||||
bool_t
|
||||
xdr_reference(xdrs, pp, size, proc)
|
||||
XDR *xdrs;
|
||||
caddr_t *pp; /* the pointer to work on */
|
||||
u_int size; /* size of the object pointed to */
|
||||
xdrproc_t proc; /* xdr routine to handle the object */
|
||||
xdr_reference(XDR *xdrs, caddr_t *pp, u_int size, xdrproc_t proc)
|
||||
/*
|
||||
* XDR *xdrs;
|
||||
* caddr_t *pp; // the pointer to work on
|
||||
* u_int size; // size of the object pointed to
|
||||
* xdrproc_t proc; // xdr routine to handle the object
|
||||
*/
|
||||
{
|
||||
caddr_t loc = *pp;
|
||||
bool_t stat;
|
||||
@ -122,11 +124,7 @@ xdr_reference(xdrs, pp, size, proc)
|
||||
*
|
||||
*/
|
||||
bool_t
|
||||
xdr_pointer(xdrs,objpp,obj_size,xdr_obj)
|
||||
XDR *xdrs;
|
||||
char **objpp;
|
||||
u_int obj_size;
|
||||
xdrproc_t xdr_obj;
|
||||
xdr_pointer(XDR *xdrs, char **objpp, u_int obj_size, xdrproc_t xdr_obj)
|
||||
{
|
||||
|
||||
bool_t more_data;
|
||||
|
@ -47,9 +47,7 @@ __FBSDID("$FreeBSD$");
|
||||
|
||||
/* ARGSUSED */
|
||||
static bool_t
|
||||
x_putlong(xdrs, longp)
|
||||
XDR *xdrs;
|
||||
long *longp;
|
||||
x_putlong(XDR *xdrs, long *longp)
|
||||
{
|
||||
xdrs->x_handy += BYTES_PER_XDR_UNIT;
|
||||
return (TRUE);
|
||||
@ -57,36 +55,28 @@ x_putlong(xdrs, longp)
|
||||
|
||||
/* ARGSUSED */
|
||||
static bool_t
|
||||
x_putbytes(xdrs, bp, len)
|
||||
XDR *xdrs;
|
||||
char *bp;
|
||||
u_int len;
|
||||
x_putbytes(XDR *xdrs, char *bp, u_int len)
|
||||
{
|
||||
xdrs->x_handy += len;
|
||||
return (TRUE);
|
||||
}
|
||||
|
||||
static u_int
|
||||
x_getpostn(xdrs)
|
||||
XDR *xdrs;
|
||||
x_getpostn(XDR *xdrs)
|
||||
{
|
||||
return (xdrs->x_handy);
|
||||
}
|
||||
|
||||
/* ARGSUSED */
|
||||
static bool_t
|
||||
x_setpostn(xdrs, pos)
|
||||
XDR *xdrs;
|
||||
u_int pos;
|
||||
x_setpostn(XDR *xdrs, u_int pos)
|
||||
{
|
||||
/* This is not allowed */
|
||||
return (FALSE);
|
||||
}
|
||||
|
||||
static int32_t *
|
||||
x_inline(xdrs, len)
|
||||
XDR *xdrs;
|
||||
u_int len;
|
||||
x_inline(XDR *xdrs, u_int len)
|
||||
{
|
||||
if (len == 0) {
|
||||
return (NULL);
|
||||
@ -120,8 +110,7 @@ harmless()
|
||||
}
|
||||
|
||||
static void
|
||||
x_destroy(xdrs)
|
||||
XDR *xdrs;
|
||||
x_destroy(XDR *xdrs)
|
||||
{
|
||||
xdrs->x_handy = 0;
|
||||
xdrs->x_base = 0;
|
||||
@ -133,9 +122,7 @@ x_destroy(xdrs)
|
||||
}
|
||||
|
||||
unsigned long
|
||||
xdr_sizeof(func, data)
|
||||
xdrproc_t func;
|
||||
void *data;
|
||||
xdr_sizeof(xdrproc_t func, void *data)
|
||||
{
|
||||
XDR x;
|
||||
struct xdr_ops ops;
|
||||
|
@ -83,10 +83,7 @@ static const struct xdr_ops xdrstdio_ops = {
|
||||
* Operation flag is set to op.
|
||||
*/
|
||||
void
|
||||
xdrstdio_create(xdrs, file, op)
|
||||
XDR *xdrs;
|
||||
FILE *file;
|
||||
enum xdr_op op;
|
||||
xdrstdio_create(XDR *xdrs, FILE *file, enum xdr_op op)
|
||||
{
|
||||
|
||||
xdrs->x_op = op;
|
||||
@ -101,17 +98,14 @@ xdrstdio_create(xdrs, file, op)
|
||||
* Cleans up the xdr stream handle xdrs previously set up by xdrstdio_create.
|
||||
*/
|
||||
static void
|
||||
xdrstdio_destroy(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrstdio_destroy(XDR *xdrs)
|
||||
{
|
||||
(void)fflush((FILE *)xdrs->x_private);
|
||||
/* XXX: should we close the file ?? */
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrstdio_getlong(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
long *lp;
|
||||
xdrstdio_getlong(XDR *xdrs, long *lp)
|
||||
{
|
||||
u_int32_t temp;
|
||||
|
||||
@ -122,9 +116,7 @@ xdrstdio_getlong(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrstdio_putlong(xdrs, lp)
|
||||
XDR *xdrs;
|
||||
const long *lp;
|
||||
xdrstdio_putlong(XDR *xdrs, const long *lp)
|
||||
{
|
||||
int32_t mycopy = htonl((u_int32_t)*lp);
|
||||
|
||||
@ -134,10 +126,7 @@ xdrstdio_putlong(xdrs, lp)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrstdio_getbytes(xdrs, addr, len)
|
||||
XDR *xdrs;
|
||||
char *addr;
|
||||
u_int len;
|
||||
xdrstdio_getbytes(XDR *xdrs, char *addr, u_int len)
|
||||
{
|
||||
|
||||
if ((len != 0) && (fread(addr, (size_t)len, 1, (FILE *)xdrs->x_private) != 1))
|
||||
@ -146,10 +135,7 @@ xdrstdio_getbytes(xdrs, addr, len)
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrstdio_putbytes(xdrs, addr, len)
|
||||
XDR *xdrs;
|
||||
const char *addr;
|
||||
u_int len;
|
||||
xdrstdio_putbytes(XDR *xdrs, const char *addr, u_int len)
|
||||
{
|
||||
|
||||
if ((len != 0) && (fwrite(addr, (size_t)len, 1,
|
||||
@ -159,17 +145,14 @@ xdrstdio_putbytes(xdrs, addr, len)
|
||||
}
|
||||
|
||||
static u_int
|
||||
xdrstdio_getpos(xdrs)
|
||||
XDR *xdrs;
|
||||
xdrstdio_getpos(XDR *xdrs)
|
||||
{
|
||||
|
||||
return ((u_int) ftell((FILE *)xdrs->x_private));
|
||||
}
|
||||
|
||||
static bool_t
|
||||
xdrstdio_setpos(xdrs, pos)
|
||||
XDR *xdrs;
|
||||
u_int pos;
|
||||
xdrstdio_setpos(XDR *xdrs, u_int pos)
|
||||
{
|
||||
|
||||
return ((fseek((FILE *)xdrs->x_private, (long)pos, 0) < 0) ?
|
||||
@ -178,9 +161,7 @@ xdrstdio_setpos(xdrs, pos)
|
||||
|
||||
/* ARGSUSED */
|
||||
static int32_t *
|
||||
xdrstdio_inline(xdrs, len)
|
||||
XDR *xdrs;
|
||||
u_int len;
|
||||
xdrstdio_inline(XDR *xdrs, u_int len)
|
||||
{
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user