mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-21 01:43:33 +08:00
Prep for 6.19 release
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4847 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
+6
-51
@@ -142,25 +142,12 @@
|
||||
#define RPCMNT_PATHLEN 1024
|
||||
#define RPCPROG_NFS 100003
|
||||
|
||||
/* for rpcclnt's rc_flags */
|
||||
|
||||
#define RPCCLNT_SOFT (1 << 0) /* soft mount (hard is details) */
|
||||
#define RPCCLNT_INT (1 << 1) /* allow interrupts on hard mounts */
|
||||
#define RPCCLNT_NOCONN (1 << 2) /* dont connect the socket (udp) */
|
||||
#define RPCCLNT_DUMBTIMR (1 << 4)
|
||||
|
||||
/* XXX should be replaced with real locks */
|
||||
|
||||
#define RPCCLNT_SNDLOCK 0x100
|
||||
#define RPCCLNT_WANTSND 0x200
|
||||
#define RPCCLNT_RCVLOCK 0x400
|
||||
#define RPCCLNT_WANTRCV 0x800
|
||||
|
||||
/* RPC definitions for the portmapper. */
|
||||
|
||||
#define PMAPPORT 111
|
||||
#define PMAPPROG 100000
|
||||
#define PMAPVERS 2
|
||||
|
||||
#define PMAPPROC_NULL 0
|
||||
#define PMAPPROC_SET 1
|
||||
#define PMAPPROC_UNSET 2
|
||||
@@ -168,36 +155,8 @@
|
||||
#define PMAPPROC_DUMP 4
|
||||
#define PMAPPROC_CALLIT 5
|
||||
|
||||
#define RPCCLNT_DEBUG 1
|
||||
|
||||
#define RPC_TICKINTVL 5
|
||||
|
||||
/* from nfs/nfsproto.h */
|
||||
|
||||
#define RPC_MAXDATA 32768
|
||||
#define RPC_MAXPKTHDR 404
|
||||
#define RPC_MAXPACKET (RPC_MAXPKTHDR + RPC_MAXDATA)
|
||||
|
||||
#define RPCX_UNSIGNED 4
|
||||
|
||||
#define RPC_SUCCESS 0
|
||||
|
||||
/* Flag values for r_flags */
|
||||
|
||||
#define RPCCALL_MUSTRESEND (1 << 0) /* Must resend request */
|
||||
|
||||
#define RPC_HZ (CLOCKS_PER_SEC / rpcclnt_ticks) /* Ticks/sec */
|
||||
#define RPC_TIMEO (1 * RPC_HZ) /* Default timeout = 1 second */
|
||||
|
||||
#define RPC_MAXREXMIT 100 /* Stop counting after this many */
|
||||
|
||||
#define RPCAUTH_ROOTCREDS NULL
|
||||
|
||||
#define RPCCLNTINT_SIGMASK(set) \
|
||||
(SIGISMEMBER(set, SIGINT) || SIGISMEMBER(set, SIGTERM) || \
|
||||
SIGISMEMBER(set, SIGHUP) || SIGISMEMBER(set, SIGKILL) || \
|
||||
SIGISMEMBER(set, SIGQUIT))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
@@ -504,19 +463,15 @@ struct rpc_reply_setattr
|
||||
|
||||
struct rpcclnt
|
||||
{
|
||||
nfsfh_t rc_fh; /* File handle of root dir */
|
||||
char *rc_path; /* server's path of the directory being mount */
|
||||
nfsfh_t rc_fh; /* File handle of the root directory */
|
||||
char *rc_path; /* Server's path of the mounted directory */
|
||||
|
||||
struct sockaddr *rc_name;
|
||||
struct socket *rc_so; /* RPC socket */
|
||||
|
||||
uint8_t rc_clntflags; /* For RPCCLNT_* flags */
|
||||
uint8_t rc_sotype; /* Type of socket */
|
||||
uint8_t rc_retry; /* Max retries */
|
||||
|
||||
/* These describe the current RPC call */
|
||||
|
||||
uint8_t rc_callflags; /* For RPCCALL_* flags */
|
||||
bool rc_timeout; /* Receipt of reply timed out */
|
||||
uint8_t rc_sotype; /* Type of socket */
|
||||
uint8_t rc_retry; /* Max retries */
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
|
||||
+18
-36
@@ -167,12 +167,6 @@ static int rpcclnt_send(FAR struct rpcclnt *rpc, int procid, int prog,
|
||||
ssize_t nbytes;
|
||||
int error = OK;
|
||||
|
||||
DEBUGASSERT(rpc && call);
|
||||
|
||||
/* Assume that we will not have to resend */
|
||||
|
||||
rpc->rc_callflags &= ~RPCCALL_MUSTRESEND;
|
||||
|
||||
/* Send the call message
|
||||
*
|
||||
* On success, psock_sendto returns the number of bytes sent;
|
||||
@@ -183,14 +177,10 @@ static int rpcclnt_send(FAR struct rpcclnt *rpc, int procid, int prog,
|
||||
rpc->rc_name, sizeof(struct sockaddr));
|
||||
if (nbytes < 0)
|
||||
{
|
||||
/* psock_sendto failed, Sample the error value (subsequent
|
||||
* calls can change the errno value!)
|
||||
*/
|
||||
/* psock_sendto failed */
|
||||
|
||||
error = errno;
|
||||
fdbg("ERROR: psock_sendto failed: %d\n", error);
|
||||
|
||||
rpc->rc_callflags |= RPCCALL_MUSTRESEND;
|
||||
}
|
||||
|
||||
return error;
|
||||
@@ -212,11 +202,6 @@ static int rpcclnt_receive(FAR struct rpcclnt *rpc, FAR struct sockaddr *aname,
|
||||
ssize_t nbytes;
|
||||
int error = 0;
|
||||
|
||||
if (rpc->rc_so == NULL)
|
||||
{
|
||||
return EACCES;
|
||||
}
|
||||
|
||||
socklen_t fromlen = sizeof(struct sockaddr);
|
||||
nbytes = psock_recvfrom(rpc->rc_so, reply, resplen, 0, aname, &fromlen);
|
||||
if (nbytes < 0)
|
||||
@@ -248,7 +233,7 @@ static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog,
|
||||
error = rpcclnt_receive(rpc, rpc->rc_name, procid, prog, reply, resplen);
|
||||
if (error != 0)
|
||||
{
|
||||
fdbg("ERROR: rpcclnt_receive returned: %d\n");
|
||||
fdbg("ERROR: rpcclnt_receive returned: %d\n", error);
|
||||
|
||||
/* If we failed because of a timeout, then try sending the CALL
|
||||
* message again.
|
||||
@@ -256,24 +241,23 @@ static int rpcclnt_reply(FAR struct rpcclnt *rpc, int procid, int prog,
|
||||
|
||||
if (error == EAGAIN || error == ETIMEDOUT)
|
||||
{
|
||||
rpc->rc_callflags |= RPCCALL_MUSTRESEND;
|
||||
rpc->rc_timeout = true;
|
||||
}
|
||||
|
||||
return error;
|
||||
}
|
||||
}
|
||||
|
||||
/* Get the xid and check that it is an RPC replysvr */
|
||||
|
||||
replyheader = (FAR struct rpc_reply_header *)reply;
|
||||
rxid = replyheader->rp_xid;
|
||||
|
||||
if (replyheader->rp_direction != rpc_reply)
|
||||
else
|
||||
{
|
||||
fdbg("ERROR: Different RPC REPLY returned\n");
|
||||
rpc_statistics(rpcinvalid);
|
||||
rpc->rc_callflags |= RPCCALL_MUSTRESEND;
|
||||
error = EPROTO;
|
||||
return error;
|
||||
replyheader = (FAR struct rpc_reply_header *)reply;
|
||||
rxid = replyheader->rp_xid;
|
||||
|
||||
if (replyheader->rp_direction != rpc_reply)
|
||||
{
|
||||
fdbg("ERROR: Different RPC REPLY returned\n");
|
||||
rpc_statistics(rpcinvalid);
|
||||
error = EPROTO;
|
||||
}
|
||||
}
|
||||
|
||||
return OK;
|
||||
@@ -596,12 +580,9 @@ bad:
|
||||
|
||||
void rpcclnt_disconnect(struct rpcclnt *rpc)
|
||||
{
|
||||
struct socket *so;
|
||||
|
||||
if (rpc->rc_so != NULL)
|
||||
{
|
||||
so = rpc->rc_so;
|
||||
(void)psock_close(so);
|
||||
(void)psock_close(rpc->rc_so);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -748,7 +729,8 @@ int rpcclnt_request(FAR struct rpcclnt *rpc, int procnum, int prog,
|
||||
/* Do the client side RPC. */
|
||||
|
||||
rpc_statistics(rpcrequests);
|
||||
|
||||
rpc->rc_timeout = false;
|
||||
|
||||
/* Send the RPC CALL message */
|
||||
|
||||
error = rpcclnt_send(rpc, procnum, prog, request, reqlen);
|
||||
@@ -770,7 +752,7 @@ int rpcclnt_request(FAR struct rpcclnt *rpc, int procnum, int prog,
|
||||
|
||||
retries++;
|
||||
}
|
||||
while ((rpc->rc_callflags & RPCCALL_MUSTRESEND) != 0 && retries <= rpc->rc_retry);
|
||||
while (rpc->rc_timeout && retries <= rpc->rc_retry);
|
||||
|
||||
if (error != OK)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user