Author: ngie
Date: Sat Dec  3 18:14:29 2016
New Revision: 309493
URL: https://svnweb.freebsd.org/changeset/base/309493

Log:
  MFC r301754,r301769:
  
  r301754 (by pfg):
  
  libc/rpc: Make use of some xdr_* macros.
  
  xdr_rpcprog and xdr_rpcvers were broken in older versions of FreeBSD
  but were fixed in r296394. Give them some use hoping they help make
  the code somewhat more readable.
  
  r301769 (by pfg):
  
  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:
  stable/10/lib/libc/rpc/rpc_callmsg.c
  stable/10/lib/libc/rpc/rpc_prot.c
  stable/10/lib/libc/rpc/rpcb_prot.c
  stable/10/lib/libc/rpc/rpcb_st_xdr.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/lib/libc/rpc/rpc_callmsg.c
==============================================================================
--- stable/10/lib/libc/rpc/rpc_callmsg.c        Sat Dec  3 18:08:49 2016        
(r309492)
+++ stable/10/lib/libc/rpc/rpc_callmsg.c        Sat Dec  3 18:14:29 2016        
(r309493)
@@ -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: stable/10/lib/libc/rpc/rpc_prot.c
==============================================================================
--- stable/10/lib/libc/rpc/rpc_prot.c   Sat Dec  3 18:08:49 2016        
(r309492)
+++ stable/10/lib/libc/rpc/rpc_prot.c   Sat Dec  3 18:14:29 2016        
(r309493)
@@ -125,9 +125,9 @@ xdr_accepted_reply(xdrs, ar)
                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:
@@ -160,9 +160,9 @@ xdr_rejected_reply(xdrs, rr)
        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;
@@ -229,8 +229,8 @@ xdr_callhdr(xdrs, cmsg)
            (xdrs->x_op == XDR_ENCODE) &&
            xdr_u_int32_t(xdrs, &(cmsg->rm_xid)) &&
            xdr_enum(xdrs, (enum_t *) prm_direction) &&
-           xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
-           xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_prog)) )
+           xdr_rpcvers(xdrs, &(cmsg->rm_call.cb_rpcvers)) &&
+           xdr_rpcprog(xdrs, &(cmsg->rm_call.cb_prog)) )
                return (xdr_u_int32_t(xdrs, &(cmsg->rm_call.cb_vers)));
        return (FALSE);
 }

Modified: stable/10/lib/libc/rpc/rpcb_prot.c
==============================================================================
--- stable/10/lib/libc/rpc/rpcb_prot.c  Sat Dec  3 18:08:49 2016        
(r309492)
+++ stable/10/lib/libc/rpc/rpcb_prot.c  Sat Dec  3 18:14:29 2016        
(r309493)
@@ -56,10 +56,10 @@ __FBSDID("$FreeBSD$");
 bool_t
 xdr_rpcb(XDR *xdrs, RPCB *objp)
 {
-       if (!xdr_u_int32_t(xdrs, &objp->r_prog)) {
+       if (!xdr_rpcprog(xdrs, &objp->r_prog)) {
                return (FALSE);
        }
-       if (!xdr_u_int32_t(xdrs, &objp->r_vers)) {
+       if (!xdr_rpcvers(xdrs, &objp->r_vers)) {
                return (FALSE);
        }
        if (!xdr_string(xdrs, &objp->r_netid, (u_int)~0)) {
@@ -243,13 +243,13 @@ xdr_rpcb_rmtcallargs(XDR *xdrs, struct r
 
        buf = XDR_INLINE(xdrs, 3 * 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);
                }
        } else {

Modified: stable/10/lib/libc/rpc/rpcb_st_xdr.c
==============================================================================
--- stable/10/lib/libc/rpc/rpcb_st_xdr.c        Sat Dec  3 18:08:49 2016        
(r309492)
+++ stable/10/lib/libc/rpc/rpcb_st_xdr.c        Sat Dec  3 18:14:29 2016        
(r309493)
@@ -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)) {
_______________________________________________
svn-src-stable-10@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10
To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"

Reply via email to