diff options
Diffstat (limited to 'rpc/rpc-lib/src/xdr-rpcclnt.c')
-rw-r--r-- | rpc/rpc-lib/src/xdr-rpcclnt.c | 108 |
1 files changed, 53 insertions, 55 deletions
diff --git a/rpc/rpc-lib/src/xdr-rpcclnt.c b/rpc/rpc-lib/src/xdr-rpcclnt.c index 5b470442d71..9e60d19e7a2 100644 --- a/rpc/rpc-lib/src/xdr-rpcclnt.c +++ b/rpc/rpc-lib/src/xdr-rpcclnt.c @@ -26,86 +26,84 @@ * The remaining payload is returned into payload. */ int -xdr_to_rpc_reply (char *msgbuf, size_t len, struct rpc_msg *reply, - struct iovec *payload, char *verfbytes) +xdr_to_rpc_reply(char *msgbuf, size_t len, struct rpc_msg *reply, + struct iovec *payload, char *verfbytes) { - XDR xdr; - int ret = -EINVAL; + XDR xdr; + int ret = -EINVAL; - GF_VALIDATE_OR_GOTO ("rpc", msgbuf, out); - GF_VALIDATE_OR_GOTO ("rpc", reply, out); + GF_VALIDATE_OR_GOTO("rpc", msgbuf, out); + GF_VALIDATE_OR_GOTO("rpc", reply, out); - memset (reply, 0, sizeof (struct rpc_msg)); + memset(reply, 0, sizeof(struct rpc_msg)); - reply->acpted_rply.ar_verf = _null_auth; - reply->acpted_rply.ar_results.where = NULL; - reply->acpted_rply.ar_results.proc = (xdrproc_t)(xdr_void); + reply->acpted_rply.ar_verf = _null_auth; + reply->acpted_rply.ar_results.where = NULL; + reply->acpted_rply.ar_results.proc = (xdrproc_t)(xdr_void); - xdrmem_create (&xdr, msgbuf, len, XDR_DECODE); - if (!xdr_replymsg (&xdr, reply)) { - gf_log ("rpc", GF_LOG_WARNING, "failed to decode reply msg"); - goto out; - } - if (payload) { - payload->iov_base = xdr_decoded_remaining_addr (xdr); - payload->iov_len = xdr_decoded_remaining_len (xdr); - } + xdrmem_create(&xdr, msgbuf, len, XDR_DECODE); + if (!xdr_replymsg(&xdr, reply)) { + gf_log("rpc", GF_LOG_WARNING, "failed to decode reply msg"); + goto out; + } + if (payload) { + payload->iov_base = xdr_decoded_remaining_addr(xdr); + payload->iov_len = xdr_decoded_remaining_len(xdr); + } - ret = 0; + ret = 0; out: - return ret; + return ret; } - int -rpc_request_to_xdr (struct rpc_msg *request, char *dest, size_t len, - struct iovec *dst) +rpc_request_to_xdr(struct rpc_msg *request, char *dest, size_t len, + struct iovec *dst) { - XDR xdr; - int ret = -1; + XDR xdr; + int ret = -1; - GF_VALIDATE_OR_GOTO ("rpc", dest, out); - GF_VALIDATE_OR_GOTO ("rpc", request, out); - GF_VALIDATE_OR_GOTO ("rpc", dst, out); + GF_VALIDATE_OR_GOTO("rpc", dest, out); + GF_VALIDATE_OR_GOTO("rpc", request, out); + GF_VALIDATE_OR_GOTO("rpc", dst, out); - xdrmem_create (&xdr, dest, len, XDR_ENCODE); - if (!xdr_callmsg (&xdr, request)) { - gf_log ("rpc", GF_LOG_WARNING, "failed to encode call msg"); - goto out; - } + xdrmem_create(&xdr, dest, len, XDR_ENCODE); + if (!xdr_callmsg(&xdr, request)) { + gf_log("rpc", GF_LOG_WARNING, "failed to encode call msg"); + goto out; + } - dst->iov_base = dest; - dst->iov_len = xdr_encoded_length (xdr); + dst->iov_base = dest; + dst->iov_len = xdr_encoded_length(xdr); - ret = 0; + ret = 0; out: - return ret; + return ret; } - int -auth_unix_cred_to_xdr (struct authunix_parms *au, char *dest, size_t len, - struct iovec *iov) +auth_unix_cred_to_xdr(struct authunix_parms *au, char *dest, size_t len, + struct iovec *iov) { - XDR xdr; - int ret = -1; + XDR xdr; + int ret = -1; - GF_VALIDATE_OR_GOTO ("rpc", au, out); - GF_VALIDATE_OR_GOTO ("rpc", dest, out); - GF_VALIDATE_OR_GOTO ("rpc", iov, out); + GF_VALIDATE_OR_GOTO("rpc", au, out); + GF_VALIDATE_OR_GOTO("rpc", dest, out); + GF_VALIDATE_OR_GOTO("rpc", iov, out); - xdrmem_create (&xdr, dest, len, XDR_DECODE); + xdrmem_create(&xdr, dest, len, XDR_DECODE); - if (!xdr_authunix_parms (&xdr, au)) { - gf_log ("rpc", GF_LOG_WARNING, "failed to decode authunix parms"); - goto out; - } + if (!xdr_authunix_parms(&xdr, au)) { + gf_log("rpc", GF_LOG_WARNING, "failed to decode authunix parms"); + goto out; + } - iov->iov_base = dest; - iov->iov_len = xdr_encoded_length (xdr); + iov->iov_base = dest; + iov->iov_len = xdr_encoded_length(xdr); - ret = 0; + ret = 0; out: - return ret; + return ret; } |