A little more NFS instrumentation

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4810 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-06-07 01:51:30 +00:00
parent ecd38c4f9d
commit 0542a2096c
1 changed files with 30 additions and 33 deletions

View File

@ -100,8 +100,6 @@
* Pre-processor Definitions * Pre-processor Definitions
****************************************************************************/ ****************************************************************************/
#define RPC_RETURN(X) do { fvdbg("returning %d\n", X); return X; } while(0)
/* Estimate rto for an nfs rpc sent via. an unreliable datagram. Use the mean /* Estimate rto for an nfs rpc sent via. an unreliable datagram. Use the mean
* and mean deviation of rtt for the appropriate type of rpc for the frequent * and mean deviation of rtt for the appropriate type of rpc for the frequent
* rpcs and a default for the others. The justification for doing "other" * rpcs and a default for the others. The justification for doing "other"
@ -253,13 +251,13 @@ rpcclnt_send(struct socket *so, struct sockaddr *nam, int procid, int prog,
{ {
if (rep->r_flags & TASK_SOFTTERM) if (rep->r_flags & TASK_SOFTTERM)
{ {
RPC_RETURN(EINTR); return EINTR;
} }
if ((so = rep->r_rpcclnt->rc_so) == NULL) if ((so = rep->r_rpcclnt->rc_so) == NULL)
{ {
rep->r_flags |= TASK_MUSTRESEND; rep->r_flags |= TASK_MUSTRESEND;
RPC_RETURN(0); return 0;
} }
rep->r_flags &= ~TASK_MUSTRESEND; rep->r_flags &= ~TASK_MUSTRESEND;
@ -442,12 +440,11 @@ rpcclnt_send(struct socket *so, struct sockaddr *nam, int procid, int prog,
fdbg("rpc service send error %d\n", error); fdbg("rpc service send error %d\n", error);
} }
RPC_RETURN(error); return error;
} }
else else
{ {
RPC_RETURN(0); return 0;
} }
} }
@ -554,7 +551,7 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
if (errval == EWOULDBLOCK && rep && if (errval == EWOULDBLOCK && rep &&
(rep->r_flags & TASK_SOFTTERM)) (rep->r_flags & TASK_SOFTTERM))
{ {
RPC_RETURN(EINTR); return EINTR;
} }
} }
} }
@ -677,20 +674,20 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
so = rep->r_rpcclnt->rc_so; so = rep->r_rpcclnt->rc_so;
if (so == NULL) if (so == NULL)
{ {
RPC_RETURN(EACCES); return EACCES;
} }
socklen_t fromlen = sizeof(struct sockaddr); socklen_t fromlen = sizeof(struct sockaddr);
rcvflg = 0; rcvflg = 0;
ret = psock_recvfrom(so, reply, len, rcvflg, aname, &fromlen); ret = psock_recvfrom(so, reply, len, rcvflg, aname, &fromlen);
if (ret > 0) if (ret < 0)
{ {
RPC_RETURN(ret); fdbg("ERROR: psock_recvfrom failed: %d\n", errno);
} }
} }
fvdbg("Returning %d\n", ret); fvdbg("Returning %d\n", ret);
RPC_RETURN(ret); return ret;
} }
/* Implement receipt of reply on a socket. We must search through the list of /* Implement receipt of reply on a socket. We must search through the list of
@ -742,13 +739,13 @@ static int rpcclnt_reply(struct rpctask *myrep, int procid, int prog, void *repl
{ {
if (myrep->r_flags & TASK_GETONEREP) if (myrep->r_flags & TASK_GETONEREP)
{ {
RPC_RETURN(0); return 0;
} }
fdbg("ignoring routing error on connectionless protocol."); fdbg("ignoring routing error on connectionless protocol\n");
continue; continue;
} }
RPC_RETURN(error); return error;
} }
bcopy(reply, &replyheader, sizeof(struct rpc_reply_header)); bcopy(reply, &replyheader, sizeof(struct rpc_reply_header));
@ -761,7 +758,7 @@ static int rpcclnt_reply(struct rpctask *myrep, int procid, int prog, void *repl
rpcstats.rpcinvalid++; rpcstats.rpcinvalid++;
if (myrep->r_flags & TASK_GETONEREP) if (myrep->r_flags & TASK_GETONEREP)
{ {
RPC_RETURN(0); return 0;
} }
continue; continue;
@ -834,20 +831,20 @@ static int rpcclnt_reply(struct rpctask *myrep, int procid, int prog, void *repl
{ {
fdbg("rpc reply not matched\n"); fdbg("rpc reply not matched\n");
rpcstats.rpcunexpected++; rpcstats.rpcunexpected++;
RPC_RETURN(ENOMSG); return ENOMSG;
} }
else if (rep == myrep) else if (rep == myrep)
{ {
RPC_RETURN(0); return 0;
} }
if (myrep->r_flags & TASK_GETONEREP) if (myrep->r_flags & TASK_GETONEREP)
{ {
RPC_RETURN(0); return 0;
} }
} }
RPC_RETURN(ENONET); return ENONET;
} }
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
@ -869,12 +866,12 @@ rpcclnt_sigintr( struct rpcclnt *rpc, struct rpctask *task, cthread_t *td)
if (task && ISSET(task->r_flags, TASK_SOFTTERM)) if (task && ISSET(task->r_flags, TASK_SOFTTERM))
{ {
RPC_RETURN(EINTR); return EINTR;
} }
if (!ISSET(rpc->rc_flag, RPCCLNT_INT)) if (!ISSET(rpc->rc_flag, RPCCLNT_INT))
{ {
RPC_RETURN(0); return 0;
} }
if (td == NULL) if (td == NULL)
@ -894,11 +891,11 @@ rpcclnt_sigintr( struct rpcclnt *rpc, struct rpctask *task, cthread_t *td)
if (SIGNOTEMPTY(p->p_siglist) && RPCCLNTINT_SIGMASK(tmpset)) if (SIGNOTEMPTY(p->p_siglist) && RPCCLNTINT_SIGMASK(tmpset))
{ {
PROC_UNLOCK(p); PROC_UNLOCK(p);
RPC_RETURN(EINTR); return EINTR;
} }
PROC_UNLOCK(p); PROC_UNLOCK(p);
RPC_RETURN(0); return 0;
} }
/* Lock a socket against others. Necessary for STREAM sockets to ensure you /* Lock a socket against others. Necessary for STREAM sockets to ensure you
@ -1069,7 +1066,7 @@ void rpcclnt_init(void)
void void
rpcclnt_uninit(void) rpcclnt_uninit(void)
{ {
fvdbg("uninit"); fvdbg("uninit\n");
untimeout(rpcclnt_timer, (void *)NULL, rpcclnt_timer_handle); untimeout(rpcclnt_timer, (void *)NULL, rpcclnt_timer_handle);
} }
*/ */
@ -1114,7 +1111,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
{ {
errval = errno; errval = errno;
fdbg("ERROR: psock_socket failed: %d", errval); fdbg("ERROR: psock_socket failed: %d", errval);
RPC_RETURN(error); return error;
} }
so->s_crefs = 1; so->s_crefs = 1;
@ -1293,11 +1290,11 @@ int rpcclnt_connect(struct rpcclnt *rpc)
rpc->rc_timeouts = 0; rpc->rc_timeouts = 0;
fvdbg("Succeeded\n"); fvdbg("Succeeded\n");
RPC_RETURN(0); return 0;
bad: bad:
rpcclnt_disconnect(rpc); rpcclnt_disconnect(rpc);
RPC_RETURN(error); return error;
} }
/* Reconnect routine: Called when a connection is broken on a reliable /* Reconnect routine: Called when a connection is broken on a reliable
@ -1429,11 +1426,11 @@ int rpcclnt_umount(struct rpcclnt *rpc)
goto bad; goto bad;
} }
RPC_RETURN(0); return 0;
bad: bad:
rpcclnt_disconnect(rpc); rpcclnt_disconnect(rpc);
RPC_RETURN(error); return error;
} }
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
@ -1501,7 +1498,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version,
error = rpcclnt_buildheader(rpc, procnum, prog, version, &value, datain, (FAR void*)&u); error = rpcclnt_buildheader(rpc, procnum, prog, version, &value, datain, (FAR void*)&u);
if (error) if (error)
{ {
fdbg("ERROR: Building call header error"); fdbg("ERROR: Building call header error\n");
goto rpcmout; goto rpcmout;
} }
@ -1618,7 +1615,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version,
fxdr_unsigned(uint32_t, replyheader.stat.mismatch_info.low); fxdr_unsigned(uint32_t, replyheader.stat.mismatch_info.low);
replymgs.stat.mismatch_info.high = replymgs.stat.mismatch_info.high =
fxdr_unsigned(uint32_t, replyheader.stat.mismatch_info.high);*/ fxdr_unsigned(uint32_t, replyheader.stat.mismatch_info.high);*/
fdbg("RPC_MSGDENIED: RPC_MISMATCH error"); fdbg("RPC_MSGDENIED: RPC_MISMATCH error\n");
error = EOPNOTSUPP; error = EOPNOTSUPP;
break; break;
@ -1669,7 +1666,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version,
rpcmout: rpcmout:
kfree(task); kfree(task);
RPC_RETURN(error); return error;
} }
#undef COMP #undef COMP