Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 9 Jun 2016 22:18:25 +0000 (UTC)
From:      "Pedro F. Giffuni" <pfg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r301769 - head/lib/libc/rpc
Message-ID:  <201606092218.u59MIP78076869@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: pfg
Date: Thu Jun  9 22:18:25 2016
New Revision: 301769
URL: https://svnweb.freebsd.org/changeset/base/301769

Log:
  libc/rpc: Make use of some xdr_* macros. (part 2)
  
  xdr_rpcproc, xdr_rpcprog and xdr_rpcvers were broken in older
  versions of FreeBSD but fixed in r296394.  Give them some use
  hoping they help make the code somewhat more readable.

Modified:
  head/lib/libc/rpc/rpc_callmsg.c
  head/lib/libc/rpc/rpc_prot.c
  head/lib/libc/rpc/rpcb_st_xdr.c

Modified: head/lib/libc/rpc/rpc_callmsg.c
==============================================================================
--- head/lib/libc/rpc/rpc_callmsg.c	Thu Jun  9 22:14:58 2016	(r301768)
+++ head/lib/libc/rpc/rpc_callmsg.c	Thu Jun  9 22:18:25 2016	(r301769)
@@ -193,11 +193,11 @@ xdr_callmsg(XDR *xdrs, struct rpc_msg *c
 	    xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
 	    xdr_enum(xdrs, (enum_t *) prm_direction) &&
 	    (cmsg->rm_direction == CALL) &&
-	    xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+	    xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
 	    (cmsg->rm_call.cb_rpcvers == RPC_MSG_VERSION) &&
-	    xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) &&
-	    xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)) &&
-	    xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_proc)) &&
+	    xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) &&
+	    xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_vers)) &&
+	    xdr_rpcproc(xdrs, &(cmsg->rm_call.cb_proc)) &&
 	    xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_cred)) )
 		return (xdr_opaque_auth(xdrs, &(cmsg->rm_call.cb_verf)));
 	return (FALSE);

Modified: head/lib/libc/rpc/rpc_prot.c
==============================================================================
--- head/lib/libc/rpc/rpc_prot.c	Thu Jun  9 22:14:58 2016	(r301768)
+++ head/lib/libc/rpc/rpc_prot.c	Thu Jun  9 22:18:25 2016	(r301769)
@@ -119,9 +119,9 @@ xdr_accepted_reply(XDR *xdrs, struct acc
 		return ((*(ar->ar_results.proc))(xdrs, ar->ar_results.where));
 
 	case PROG_MISMATCH:
-		if (! xdr_u_int32_t(xdrs, &(ar->ar_vers.low)))
+		if (!xdr_rpcvers(xdrs, &(ar->ar_vers.low)))
 			return (FALSE);
-		return (xdr_u_int32_t(xdrs, &(ar->ar_vers.high)));
+		return (xdr_rpcvers(xdrs, &(ar->ar_vers.high)));
 
 	case GARBAGE_ARGS:
 	case SYSTEM_ERR:
@@ -152,9 +152,9 @@ xdr_rejected_reply(XDR *xdrs, struct rej
 	switch (rr->rj_stat) {
 
 	case RPC_MISMATCH:
-		if (! xdr_u_int32_t(xdrs, &(rr->rj_vers.low)))
+		if (! xdr_rpcvers(xdrs, &(rr->rj_vers.low)))
 			return (FALSE);
-		return (xdr_u_int32_t(xdrs, &(rr->rj_vers.high)));
+		return (xdr_rpcvers(xdrs, &(rr->rj_vers.high)));
 
 	case AUTH_ERROR:
 		prj_why = &rr->rj_why;

Modified: head/lib/libc/rpc/rpcb_st_xdr.c
==============================================================================
--- head/lib/libc/rpc/rpcb_st_xdr.c	Thu Jun  9 22:14:58 2016	(r301768)
+++ head/lib/libc/rpc/rpcb_st_xdr.c	Thu Jun  9 22:18:25 2016	(r301769)
@@ -51,10 +51,10 @@ xdr_rpcbs_addrlist(XDR *xdrs, rpcbs_addr
 {
 	struct rpcbs_addrlist **pnext;
 
-	    if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+	    if (!xdr_rpcprog(xdrs, &objp->prog)) {
 		return (FALSE);
 	    }
-	    if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+	    if (!xdr_rpcvers(xdrs, &objp->vers)) {
 		return (FALSE);
 	    }
 	    if (!xdr_int(xdrs, &objp->success)) {
@@ -89,13 +89,13 @@ xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_r
 	if (xdrs->x_op == XDR_ENCODE) {
 	buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
 	if (buf == NULL) {
-		if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+		if (!xdr_rpcprog(xdrs, &objp->prog)) {
 			return (FALSE);
 		}
-		if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+		if (!xdr_rpcvers(xdrs, &objp->vers)) {
 			return (FALSE);
 		}
-		if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+		if (!xdr_rpcproc(xdrs, &objp->proc)) {
 			return (FALSE);
 		}
 		if (!xdr_int(xdrs, &objp->success)) {
@@ -128,13 +128,13 @@ xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_r
 	} else if (xdrs->x_op == XDR_DECODE) {
 	buf = XDR_INLINE(xdrs, 6 * BYTES_PER_XDR_UNIT);
 	if (buf == NULL) {
-		if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+		if (!xdr_rpcprog(xdrs, &objp->prog)) {
 			return (FALSE);
 		}
-		if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+		if (!xdr_rpcvers(xdrs, &objp->vers)) {
 			return (FALSE);
 		}
-		if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+		if (!xdr_rpcproc(xdrs, &objp->proc)) {
 			return (FALSE);
 		}
 		if (!xdr_int(xdrs, &objp->success)) {
@@ -164,13 +164,13 @@ xdr_rpcbs_rmtcalllist(XDR *xdrs, rpcbs_r
 	}
 	return (TRUE);
 	}
-	if (!xdr_u_int32_t(xdrs, &objp->prog)) {
+	if (!xdr_rpcprog(xdrs, &objp->prog)) {
 		return (FALSE);
 	}
-	if (!xdr_u_int32_t(xdrs, &objp->vers)) {
+	if (!xdr_rpcvers(xdrs, &objp->vers)) {
 		return (FALSE);
 	}
-	if (!xdr_u_int32_t(xdrs, &objp->proc)) {
+	if (!xdr_rpcproc(xdrs, &objp->proc)) {
 		return (FALSE);
 	}
 	if (!xdr_int(xdrs, &objp->success)) {



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201606092218.u59MIP78076869>