summaryrefslogtreecommitdiff
path: root/nuttx/fs/nfs/rpc_clnt.c
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-30 23:21:37 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-30 23:21:37 +0000
commiteb68069699e2bc904a278cdb310c561d5f3083c5 (patch)
tree9649d99f2c5779fcf43549ec2aac5e004830b780 /nuttx/fs/nfs/rpc_clnt.c
parent89ade858089dde83dc3d993d4ca28f39c3b25538 (diff)
downloadpx4-nuttx-eb68069699e2bc904a278cdb310c561d5f3083c5.tar.gz
px4-nuttx-eb68069699e2bc904a278cdb310c561d5f3083c5.tar.bz2
px4-nuttx-eb68069699e2bc904a278cdb310c561d5f3083c5.zip
NFS update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4790 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nfs/rpc_clnt.c')
-rw-r--r--nuttx/fs/nfs/rpc_clnt.c35
1 files changed, 31 insertions, 4 deletions
diff --git a/nuttx/fs/nfs/rpc_clnt.c b/nuttx/fs/nfs/rpc_clnt.c
index e39d1c161..b701eae9c 100644
--- a/nuttx/fs/nfs/rpc_clnt.c
+++ b/nuttx/fs/nfs/rpc_clnt.c
@@ -1267,7 +1267,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
if (error)
{
- ndbg("psock_connect to ppmap port returns %d", error);
+ ndbg("psock_connect to PMAP port returns %d", error);
goto bad;
}
@@ -1313,7 +1313,8 @@ int rpcclnt_connect(struct rpcclnt *rpc)
goto bad;
}
- if ((fxdr_unsigned(uint32_t, mdata.mount.status)) != 0)
+ error = fxdr_unsigned(uint32_t, mdata.mount.status);
+ if (error != 0)
{
ndbg("error mounting with the server %d\n", error);
goto bad;
@@ -1321,9 +1322,35 @@ int rpcclnt_connect(struct rpcclnt *rpc)
rpc->rc_fh = mdata.mount.fhandle;
- /* NFS port in the socket*/
+ /* Do the RPC to get a dynamic bounding with the server using PMAP.
+ * NFS port in the socket.
+ */
+
+ memset(&sdata, 0, sizeof(sdata));
+ memset(&rdata, 0, sizeof(rdata));
+ sa->sin_port = htons(PMAPPORT);
+
+ error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
+ if (error)
+ {
+ ndbg("psock_connect PMAP port returns %d\n", error);
+ goto bad;
+ }
+
+ sdata.prog = txdr_unsigned(NFS_PROG);
+ sdata.vers = txdr_unsigned(NFS_VER3);
+ sdata.proc = txdr_unsigned(IPPROTO_UDP);
+ sdata.port = 0;
+
+ error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS,
+ (void *)&rdata, (FAR const void *)&sdata);
+ if (error != 0)
+ {
+ goto bad;
+ }
+
+ sa->sin_port = htons(fxdr_unsigned(uint32_t, rdata.pmap.port));
- sa->sin_port = htons(NFS_PORT);
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
if (error)
{