[DFS] fix compiling warning in NFS

This commit is contained in:
bernard 2014-03-10 11:48:47 +08:00
parent d0d239cd4c
commit 6cab3b7dfa
7 changed files with 39 additions and 138 deletions

View File

@ -11,13 +11,6 @@
bool_t bool_t
xdr_fhandle3(register XDR *xdrs, fhandle3 *objp) xdr_fhandle3(register XDR *xdrs, fhandle3 *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_bytes(xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, FHSIZE3)) if (!xdr_bytes(xdrs, (char **)&objp->fhandle3_val, (unsigned int *) &objp->fhandle3_len, FHSIZE3))
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
@ -26,13 +19,6 @@ xdr_fhandle3(register XDR *xdrs, fhandle3 *objp)
bool_t bool_t
xdr_dirpath(register XDR *xdrs, dirpath *objp) xdr_dirpath(register XDR *xdrs, dirpath *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_string(xdrs, objp, MNTPATHLEN)) if (!xdr_string(xdrs, objp, MNTPATHLEN))
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
@ -41,13 +27,6 @@ xdr_dirpath(register XDR *xdrs, dirpath *objp)
bool_t bool_t
xdr_name(register XDR *xdrs, name *objp) xdr_name(register XDR *xdrs, name *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_string(xdrs, objp, MNTNAMLEN)) if (!xdr_string(xdrs, objp, MNTNAMLEN))
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
@ -56,13 +35,6 @@ xdr_name(register XDR *xdrs, name *objp)
bool_t bool_t
xdr_exports(register XDR *xdrs, exports *objp) xdr_exports(register XDR *xdrs, exports *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode)) if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct exportnode), (xdrproc_t) xdr_exportnode))
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
@ -71,13 +43,6 @@ xdr_exports(register XDR *xdrs, exports *objp)
bool_t bool_t
xdr_groups(register XDR *xdrs, groups *objp) xdr_groups(register XDR *xdrs, groups *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode)) if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct groupnode), (xdrproc_t) xdr_groupnode))
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
@ -86,13 +51,6 @@ xdr_groups(register XDR *xdrs, groups *objp)
bool_t bool_t
xdr_mountlist(register XDR *xdrs, mountlist *objp) xdr_mountlist(register XDR *xdrs, mountlist *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody)) if (!xdr_pointer(xdrs, (char **)objp, sizeof (struct mountbody), (xdrproc_t) xdr_mountbody))
return (FALSE); return (FALSE);
return (TRUE); return (TRUE);
@ -103,17 +61,11 @@ xdr_mountstat3(register XDR *xdrs, mountstat3 *objp)
{ {
int enum_objp; int enum_objp;
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
enum_objp = *objp; enum_objp = *objp;
if (!xdr_enum(xdrs, (enum_t *)&enum_objp)) if (!xdr_enum(xdrs, (enum_t *)&enum_objp))
{ {
*objp = enum_objp; *objp = (mountstat3)enum_objp;
return (FALSE); return (FALSE);
} }
@ -123,13 +75,6 @@ xdr_mountstat3(register XDR *xdrs, mountstat3 *objp)
bool_t bool_t
xdr_mountres3_ok(register XDR *xdrs, mountres3_ok *objp) xdr_mountres3_ok(register XDR *xdrs, mountres3_ok *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_fhandle3(xdrs, &objp->fhandle)) if (!xdr_fhandle3(xdrs, &objp->fhandle))
return (FALSE); return (FALSE);
if (!xdr_array(xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (unsigned int *) &objp->auth_flavors.auth_flavors_len, ~0, if (!xdr_array(xdrs, (char **)&objp->auth_flavors.auth_flavors_val, (unsigned int *) &objp->auth_flavors.auth_flavors_len, ~0,
@ -141,13 +86,6 @@ xdr_mountres3_ok(register XDR *xdrs, mountres3_ok *objp)
bool_t bool_t
xdr_mountres3(register XDR *xdrs, mountres3 *objp) xdr_mountres3(register XDR *xdrs, mountres3 *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_mountstat3(xdrs, &objp->fhs_status)) if (!xdr_mountstat3(xdrs, &objp->fhs_status))
return (FALSE); return (FALSE);
switch (objp->fhs_status) { switch (objp->fhs_status) {
@ -162,13 +100,6 @@ xdr_mountres3(register XDR *xdrs, mountres3 *objp)
bool_t bool_t
xdr_mountbody(register XDR *xdrs, mountbody *objp) xdr_mountbody(register XDR *xdrs, mountbody *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_name(xdrs, &objp->ml_hostname)) if (!xdr_name(xdrs, &objp->ml_hostname))
return (FALSE); return (FALSE);
if (!xdr_dirpath(xdrs, &objp->ml_directory)) if (!xdr_dirpath(xdrs, &objp->ml_directory))
@ -181,13 +112,6 @@ xdr_mountbody(register XDR *xdrs, mountbody *objp)
bool_t bool_t
xdr_groupnode(register XDR *xdrs, groupnode *objp) xdr_groupnode(register XDR *xdrs, groupnode *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_name(xdrs, &objp->gr_name)) if (!xdr_name(xdrs, &objp->gr_name))
return (FALSE); return (FALSE);
if (!xdr_groups(xdrs, &objp->gr_next)) if (!xdr_groups(xdrs, &objp->gr_next))
@ -198,13 +122,6 @@ xdr_groupnode(register XDR *xdrs, groupnode *objp)
bool_t bool_t
xdr_exportnode(register XDR *xdrs, exportnode *objp) xdr_exportnode(register XDR *xdrs, exportnode *objp)
{ {
#if defined(_LP64) || defined(_KERNEL)
register int *buf;
#else
register long *buf;
#endif
if (!xdr_dirpath(xdrs, &objp->ex_dir)) if (!xdr_dirpath(xdrs, &objp->ex_dir))
return (FALSE); return (FALSE);
if (!xdr_groups(xdrs, &objp->ex_groups)) if (!xdr_groups(xdrs, &objp->ex_groups))

View File

@ -151,7 +151,7 @@ xdr_nfsstat3(register XDR *xdrs, nfsstat3 *objp)
enum_objp = *objp; enum_objp = *objp;
if (!xdr_enum(xdrs, (enum_t *)objp)) if (!xdr_enum(xdrs, (enum_t *)objp))
{ {
*objp = enum_objp; *objp = (nfsstat3)enum_objp;
return (FALSE); return (FALSE);
} }
@ -165,7 +165,7 @@ xdr_ftype3(register XDR *xdrs, ftype3 *objp)
enum_objp = *objp; enum_objp = *objp;
if (!xdr_enum(xdrs, (enum_t *)objp)) if (!xdr_enum(xdrs, (enum_t *)objp))
{ {
*objp = enum_objp; *objp = (ftype3)enum_objp;
return (FALSE); return (FALSE);
} }
@ -179,7 +179,7 @@ xdr_stable_how(register XDR *xdrs, stable_how *objp)
enum_objp = *objp; enum_objp = *objp;
if (!xdr_enum(xdrs, (enum_t *)objp)) if (!xdr_enum(xdrs, (enum_t *)objp))
{ {
*objp = enum_objp; *objp = (stable_how)enum_objp;
return (FALSE); return (FALSE);
} }
@ -193,7 +193,7 @@ xdr_createmode3(register XDR *xdrs, createmode3 *objp)
enum_objp = *objp; enum_objp = *objp;
if (!xdr_enum(xdrs, (enum_t *)objp)) if (!xdr_enum(xdrs, (enum_t *)objp))
{ {
*objp = enum_objp; *objp = (createmode3)enum_objp;
return (FALSE); return (FALSE);
} }
@ -343,7 +343,7 @@ xdr_time_how(register XDR *xdrs, time_how *objp)
enum_objp = *objp; enum_objp = *objp;
if (!xdr_enum(xdrs, (enum_t *)objp)) if (!xdr_enum(xdrs, (enum_t *)objp))
{ {
*objp = enum_objp; *objp = (time_how)enum_objp;
return (FALSE); return (FALSE);
} }

View File

@ -73,6 +73,7 @@ AUTH *authnone_create()
register struct authnone_private *ap = authnone_private; register struct authnone_private *ap = authnone_private;
XDR xdr_stream; XDR xdr_stream;
register XDR *xdrs; register XDR *xdrs;
extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap);
if (ap == 0) { if (ap == 0) {
ap = (struct authnone_private *) rt_malloc (sizeof(*ap)); ap = (struct authnone_private *) rt_malloc (sizeof(*ap));
@ -95,9 +96,7 @@ AUTH *authnone_create()
} }
/*ARGSUSED*/ /*ARGSUSED*/
static bool_t authnone_marshal(client, xdrs) static bool_t authnone_marshal(AUTH *client, XDR *xdrs)
AUTH *client;
XDR *xdrs;
{ {
register struct authnone_private *ap = authnone_private; register struct authnone_private *ap = authnone_private;

View File

@ -135,6 +135,10 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
if (raddr->sin_port == 0) { if (raddr->sin_port == 0) {
unsigned short port; unsigned short port;
extern unsigned short pmap_getport(struct sockaddr_in *address,
unsigned long program,
unsigned long version,
unsigned int protocol);
if ((port = if ((port =
pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) { pmap_getport(raddr, program, version, IPPROTO_UDP)) == 0) {
@ -165,8 +169,6 @@ CLIENT *clntudp_bufcreate(struct sockaddr_in *raddr,
cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs)); cu->cu_xdrpos = XDR_GETPOS(&(cu->cu_outxdrs));
if (*sockp < 0) if (*sockp < 0)
{ {
int dontblock = 1;
*sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP); *sockp = socket(AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (*sockp < 0) if (*sockp < 0)
{ {
@ -229,7 +231,10 @@ call_again:
if ((!XDR_PUTLONG(xdrs, (long *) &proc)) || if ((!XDR_PUTLONG(xdrs, (long *) &proc)) ||
(!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp))) (!AUTH_MARSHALL(cl->cl_auth, xdrs)) || (!(*xargs) (xdrs, argsp)))
return (cu->cu_error.re_status = RPC_CANTENCODEARGS); {
cu->cu_error.re_status = RPC_CANTENCODEARGS;
return RPC_CANTENCODEARGS;
}
outlen = (int) XDR_GETPOS(xdrs); outlen = (int) XDR_GETPOS(xdrs);
send_again: send_again:
@ -238,7 +243,9 @@ send_again:
!= outlen) != outlen)
{ {
cu->cu_error.re_errno = errno; cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTSEND); cu->cu_error.re_status = RPC_CANTSEND;
return RPC_CANTSEND;
} }
/* /*
@ -264,7 +271,9 @@ send_again:
{ {
rt_kprintf("recv error, len %d\n", inlen); rt_kprintf("recv error, len %d\n", inlen);
cu->cu_error.re_errno = errno; cu->cu_error.re_errno = errno;
return (cu->cu_error.re_status = RPC_CANTRECV); cu->cu_error.re_status = RPC_CANTRECV;
return RPC_CANTRECV;
} }
/* see if reply transaction id matches sent id */ /* see if reply transaction id matches sent id */
@ -292,6 +301,8 @@ send_again:
} }
if (reply_msg.acpted_rply.ar_verf.oa_base != NULL) if (reply_msg.acpted_rply.ar_verf.oa_base != NULL)
{ {
extern bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap);
xdrs->x_op = XDR_FREE; xdrs->x_op = XDR_FREE;
(void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf)); (void) xdr_opaque_auth(xdrs, &(reply_msg.acpted_rply.ar_verf));
} }
@ -311,7 +322,7 @@ send_again:
cu->cu_error.re_status = RPC_CANTDECODERES; cu->cu_error.re_status = RPC_CANTDECODERES;
} }
return (cu->cu_error.re_status); return (enum clnt_stat)(cu->cu_error.re_status);
} }
static void clntudp_geterr(CLIENT *cl, struct rpc_err *errp) static void clntudp_geterr(CLIENT *cl, struct rpc_err *errp)

View File

@ -6,9 +6,7 @@ static struct timeval timeout = { 5, 0 };
static struct timeval tottimeout = { 60, 0 }; static struct timeval tottimeout = { 60, 0 };
bool_t xdr_pmap(xdrs, regs) bool_t xdr_pmap(XDR *xdrs, struct pmap *regs)
XDR *xdrs;
struct pmap *regs;
{ {
if (xdr_u_long(xdrs, &regs->pm_prog) && if (xdr_u_long(xdrs, &regs->pm_prog) &&
xdr_u_long(xdrs, &regs->pm_vers) && xdr_u_long(xdrs, &regs->pm_vers) &&
@ -22,11 +20,7 @@ struct pmap *regs;
* Calls the pmap service remotely to do the lookup. * Calls the pmap service remotely to do the lookup.
* Returns 0 if no map exists. * Returns 0 if no map exists.
*/ */
unsigned short pmap_getport(address, program, version, protocol) unsigned short pmap_getport(struct sockaddr_in *address, unsigned long program, unsigned long version, unsigned int protocol)
struct sockaddr_in *address;
unsigned long program;
unsigned long version;
unsigned int protocol;
{ {
unsigned short port = 0; unsigned short port = 0;
int socket = -1; int socket = -1;

View File

@ -52,9 +52,7 @@ static char sccsid[] = "@(#)rpc_prot.c 1.36 87/08/11 Copyr 1984 Sun Micro";
* XDR an opaque authentication struct * XDR an opaque authentication struct
* (see auth.h) * (see auth.h)
*/ */
bool_t xdr_opaque_auth(xdrs, ap) bool_t xdr_opaque_auth(XDR *xdrs, struct opaque_auth *ap)
register XDR *xdrs;
register struct opaque_auth *ap;
{ {
if (xdr_enum(xdrs, &(ap->oa_flavor))) if (xdr_enum(xdrs, &(ap->oa_flavor)))
@ -66,9 +64,7 @@ register struct opaque_auth *ap;
/* /*
* XDR a DES block * XDR a DES block
*/ */
bool_t xdr_des_block(xdrs, blkp) bool_t xdr_des_block(XDR *xdrs, des_block *blkp)
register XDR *xdrs;
register des_block *blkp;
{ {
return (xdr_opaque(xdrs, (char*) blkp, sizeof(des_block))); return (xdr_opaque(xdrs, (char*) blkp, sizeof(des_block)));
} }
@ -78,9 +74,7 @@ register des_block *blkp;
/* /*
* XDR the MSG_ACCEPTED part of a reply message union * XDR the MSG_ACCEPTED part of a reply message union
*/ */
static bool_t xdr_accepted_reply(xdrs, ar) static bool_t xdr_accepted_reply(XDR *xdrs, struct accepted_reply *ar)
register XDR *xdrs;
register struct accepted_reply *ar;
{ {
/* personalized union, rather than calling xdr_union */ /* personalized union, rather than calling xdr_union */
@ -104,9 +98,7 @@ register struct accepted_reply *ar;
/* /*
* XDR the MSG_DENIED part of a reply message union * XDR the MSG_DENIED part of a reply message union
*/ */
static bool_t xdr_rejected_reply(xdrs, rr) static bool_t xdr_rejected_reply(XDR *xdrs, struct rejected_reply *rr)
register XDR *xdrs;
register struct rejected_reply *rr;
{ {
/* personalized union, rather than calling xdr_union */ /* personalized union, rather than calling xdr_union */
@ -134,9 +126,7 @@ static struct xdr_discrim reply_dscrm[3] = {
/* /*
* XDR a reply message * XDR a reply message
*/ */
bool_t xdr_replymsg(xdrs, rmsg) bool_t xdr_replymsg(XDR *xdrs, struct rpc_msg *rmsg)
register XDR *xdrs;
register struct rpc_msg *rmsg;
{ {
if (xdr_u_long(xdrs, &(rmsg->rm_xid)) && if (xdr_u_long(xdrs, &(rmsg->rm_xid)) &&
xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) && xdr_enum(xdrs, (enum_t *) & (rmsg->rm_direction)) &&
@ -153,9 +143,7 @@ register struct rpc_msg *rmsg;
* The fields include: rm_xid, rm_direction, rpcvers, prog, and vers. * The fields include: rm_xid, rm_direction, rpcvers, prog, and vers.
* The rm_xid is not really static, but the user can easily munge on the fly. * The rm_xid is not really static, but the user can easily munge on the fly.
*/ */
bool_t xdr_callhdr(xdrs, cmsg) bool_t xdr_callhdr(XDR *xdrs, struct rpc_msg *cmsg)
register XDR *xdrs;
register struct rpc_msg *cmsg;
{ {
cmsg->rm_direction = CALL; cmsg->rm_direction = CALL;
@ -172,9 +160,7 @@ register struct rpc_msg *cmsg;
/* ************************** Client utility routine ************* */ /* ************************** Client utility routine ************* */
static void accepted(acpt_stat, error) static void accepted(enum accept_stat acpt_stat, struct rpc_err *error)
register enum accept_stat acpt_stat;
register struct rpc_err *error;
{ {
switch (acpt_stat) { switch (acpt_stat) {
@ -209,9 +195,7 @@ register struct rpc_err *error;
error->re_lb.s2 = (long) acpt_stat; error->re_lb.s2 = (long) acpt_stat;
} }
static void rejected(rjct_stat, error) static void rejected(enum reject_stat rjct_stat, struct rpc_err *error)
register enum reject_stat rjct_stat;
register struct rpc_err *error;
{ {
switch (rjct_stat) { switch (rjct_stat) {
@ -233,9 +217,7 @@ register struct rpc_err *error;
/* /*
* given a reply message, fills in the error * given a reply message, fills in the error
*/ */
void _seterr_reply(msg, error) void _seterr_reply(struct rpc_msg *msg, struct rpc_err *error)
register struct rpc_msg *msg;
register struct rpc_err *error;
{ {
/* optimized for normal, SUCCESSful case */ /* optimized for normal, SUCCESSful case */
@ -246,11 +228,11 @@ register struct rpc_err *error;
error->re_status = RPC_SUCCESS; error->re_status = RPC_SUCCESS;
return; return;
}; };
accepted(msg->acpted_rply.ar_stat, error); accepted((enum accept_stat)msg->acpted_rply.ar_stat, error);
break; break;
case MSG_DENIED: case MSG_DENIED:
rejected(msg->rjcted_rply.rj_stat, error); rejected((enum reject_stat)msg->rjcted_rply.rj_stat, error);
break; break;
default: default:

View File

@ -135,9 +135,7 @@ static unsigned int xdrmem_getpos (const XDR *xdrs)
return ((unsigned long) xdrs->x_private - (unsigned long) xdrs->x_base); return ((unsigned long) xdrs->x_private - (unsigned long) xdrs->x_base);
} }
static bool_t xdrmem_setpos(xdrs, pos) static bool_t xdrmem_setpos(XDR *xdrs, unsigned int pos)
register XDR *xdrs;
unsigned int pos;
{ {
register char* newaddr = xdrs->x_base + pos; register char* newaddr = xdrs->x_base + pos;
register char* lastaddr = xdrs->x_private + xdrs->x_handy; register char* lastaddr = xdrs->x_private + xdrs->x_handy;