summaryrefslogtreecommitdiffstats
path: root/rpc/rpc-lib/src/xdr-rpcclnt.c
diff options
context:
space:
mode:
authorAmar Tumballi <amar@gluster.com>2011-03-16 09:39:46 +0000
committerVijay Bellur <vijay@dev.gluster.com>2011-03-17 11:57:43 -0700
commitd4aae8327ac5581cd47dd0fcea796ddbb03be5ea (patch)
tree38a237b1f5ab98690e563c22e84be5c3216e7935 /rpc/rpc-lib/src/xdr-rpcclnt.c
parentabc2a6b0b91a82bb59327cd2a4ca72b8954e1425 (diff)
rpc/rpc-lib : log enhancements
Signed-off-by: Amar Tumballi <amar@gluster.com> Signed-off-by: Vijay Bellur <vijay@dev.gluster.com> BUG: 2346 (Log message enhancements in GlusterFS - phase 1) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2346
Diffstat (limited to 'rpc/rpc-lib/src/xdr-rpcclnt.c')
-rw-r--r--rpc/rpc-lib/src/xdr-rpcclnt.c31
1 files changed, 13 insertions, 18 deletions
diff --git a/rpc/rpc-lib/src/xdr-rpcclnt.c b/rpc/rpc-lib/src/xdr-rpcclnt.c
index 933887b0..416d19ff 100644
--- a/rpc/rpc-lib/src/xdr-rpcclnt.c
+++ b/rpc/rpc-lib/src/xdr-rpcclnt.c
@@ -34,6 +34,7 @@
#include "xdr-rpc.h"
#include "xdr-common.h"
#include "logging.h"
+#include "common-utils.h"
/* Decodes the XDR format in msgbuf into rpc_msg.
* The remaining payload is returned into payload.
@@ -43,12 +44,10 @@ xdr_to_rpc_reply (char *msgbuf, size_t len, struct rpc_msg *reply,
struct iovec *payload, char *verfbytes)
{
XDR xdr;
- int ret = -1;
+ int ret = -EINVAL;
- if ((!msgbuf) || (!reply)) {
- ret = -EINVAL;
- goto out;
- }
+ GF_VALIDATE_OR_GOTO ("rpc", msgbuf, out);
+ GF_VALIDATE_OR_GOTO ("rpc", reply, out);
memset (reply, 0, sizeof (struct rpc_msg));
@@ -58,6 +57,7 @@ xdr_to_rpc_reply (char *msgbuf, size_t len, struct rpc_msg *reply,
xdrmem_create (&xdr, msgbuf, len, XDR_DECODE);
if (!xdr_replymsg (&xdr, reply)) {
+ gf_log ("rpc", GF_LOG_WARNING, "failed to decode reply msg");
ret = -errno;
goto out;
}
@@ -71,13 +71,6 @@ out:
return ret;
}
-#if 0
-bool_t
-true_func (XDR *s, caddr_t *a)
-{
- return TRUE;
-}
-#endif
int
rpc_request_to_xdr (struct rpc_msg *request, char *dest, size_t len,
@@ -86,12 +79,13 @@ rpc_request_to_xdr (struct rpc_msg *request, char *dest, size_t len,
XDR xdr;
int ret = -1;
- if ((!dest) || (!request) || (!dst)) {
- goto 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;
}
@@ -112,13 +106,14 @@ auth_unix_cred_to_xdr (struct authunix_parms *au, char *dest, size_t len,
XDR xdr;
int ret = -1;
- if (!au || !dest || !iov) {
- goto 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);
if (!xdr_authunix_parms (&xdr, au)) {
+ gf_log ("rpc", GF_LOG_WARNING, "failed to decode authunix parms");
goto out;
}