summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-25 23:22:09 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-25 23:22:09 +0000
commit5145ba33ec23c19f84c0d56dc182ea90f7a437d6 (patch)
tree6d8506f771c94896ef7fb4877589980ab413ee05
parent29d916f11e865afefe144aba44146a7d4acca5e4 (diff)
downloadnuttx-5145ba33ec23c19f84c0d56dc182ea90f7a437d6.tar.gz
nuttx-5145ba33ec23c19f84c0d56dc182ea90f7a437d6.tar.bz2
nuttx-5145ba33ec23c19f84c0d56dc182ea90f7a437d6.zip
NFS update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4657 42af7a65-404d-4744-a932-0658087f49c3
-rw-r--r--nuttx/Documentation/NuttX.html6
-rw-r--r--nuttx/configs/README.txt4
-rw-r--r--nuttx/fs/nfs/nfs_socket.c52
-rw-r--r--nuttx/fs/nfs/nfs_vfsops.c25
-rw-r--r--nuttx/fs/nfs/rpc.h4
-rw-r--r--nuttx/fs/nfs/rpc_clnt.c50
6 files changed, 65 insertions, 76 deletions
diff --git a/nuttx/Documentation/NuttX.html b/nuttx/Documentation/NuttX.html
index 85b513469..fa2acdbc8 100644
--- a/nuttx/Documentation/NuttX.html
+++ b/nuttx/Documentation/NuttX.html
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4">
<td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1>
- <p>Last Updated: April 23, 2012</p>
+ <p>Last Updated: April 25, 2012</p>
</td>
</tr>
</table>
@@ -2252,7 +2252,9 @@
</li>
<p>
<b>STATUS:</b>
- A configuration exists for this board, but has not been verfied as of this writing.
+ A basic OS test configuration is in place, but the board does not boot.
+ It looks like I will need an ICD3 in order to debug the code (PICkit3
+ doesn't work for debugging with this board). This effort is temporarily stalled.
</p>
</ul>
</td>
diff --git a/nuttx/configs/README.txt b/nuttx/configs/README.txt
index 2d0e6e5af..7da857ec0 100644
--- a/nuttx/configs/README.txt
+++ b/nuttx/configs/README.txt
@@ -1496,6 +1496,10 @@ configs/pic32mx7mmb
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
http://www.mikroe.com/ for further information.
+ STATUS: Basic OS test configuration is in place, but the board does not boot.
+ It looks like I will need an ICD3 in order to debug the code (PICkit3
+ doesn't work for debug with this board). This effort is temporarily stalled.
+
configs/pjrc-8051
8051 Microcontroller. This port uses the PJRC 87C52 development system
and the SDCC toolchain. This port is not quite ready for prime time.
diff --git a/nuttx/fs/nfs/nfs_socket.c b/nuttx/fs/nfs/nfs_socket.c
index 53a68ef1a..1ddfe63c3 100644
--- a/nuttx/fs/nfs/nfs_socket.c
+++ b/nuttx/fs/nfs/nfs_socket.c
@@ -112,54 +112,50 @@ void nfs_init(void)
int nfs_connect(struct nfsmount *nmp)
{
- struct rpcclnt *rpc;
- int error = 0;
+ struct rpcclnt rpc;
if (nmp == NULL)
{
return EFAULT;
}
- rpc = nmp->nm_rpcclnt;
+ //memset(rpc, 0, sizeof(*rpc));
- rpc->rc_prog = &nfs3_program;
+ rpc.rc_prog = &nfs3_program;
- nvdbg("nfsxconnect!\n");
+ nvdbg("nfs connect!\n");
/* translate nfsmnt flags -> rpcclnt flags */
- rpc->rc_flag = 0;
- nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, SOFT);
- nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, INT);
- nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, NOCONN);
- nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, DUMBTIMR);
+ rpc.rc_flag = 0;
+ nfsmnt_to_rpcclnt(nmp->nm_flag, rpc.rc_flag, SOFT);
+ nfsmnt_to_rpcclnt(nmp->nm_flag, rpc.rc_flag, INT);
+ nfsmnt_to_rpcclnt(nmp->nm_flag, rpc.rc_flag, NOCONN);
+ nfsmnt_to_rpcclnt(nmp->nm_flag, rpc.rc_flag, DUMBTIMR);
//rpc->rc_flag |= RPCCLNT_REDIRECT; /* Make this a mount option. */
- rpc->rc_authtype = RPCAUTH_NULL; /* for now */
+ rpc.rc_authtype = RPCAUTH_NULL; /* for now */
//rpc->rc_servername = nmp->nm_mountp->mnt_stat.f_mntfromname;
- rpc->rc_name = nmp->nm_nam;
+ rpc.rc_name = nmp->nm_nam;
- rpc->rc_sotype = nmp->nm_sotype;
- rpc->rc_soproto = nmp->nm_soproto;
- rpc->rc_rsize = (nmp->nm_rsize > nmp->nm_readdirsize) ?
+ rpc.rc_sotype = nmp->nm_sotype;
+ rpc.rc_soproto = nmp->nm_soproto;
+ rpc.rc_rsize = (nmp->nm_rsize > nmp->nm_readdirsize) ?
nmp->nm_rsize : nmp->nm_readdirsize;
- rpc->rc_wsize = nmp->nm_wsize;
- rpc->rc_deadthresh = nmp->nm_deadthresh;
- rpc->rc_timeo = nmp->nm_timeo;
- rpc->rc_retry = nmp->nm_retry;
+ rpc.rc_wsize = nmp->nm_wsize;
+ rpc.rc_deadthresh = nmp->nm_deadthresh;
+ rpc.rc_timeo = nmp->nm_timeo;
+ rpc.rc_retry = nmp->nm_retry;
- /* XXX v2,3 need to use this */
+ /* v3 need to use this */
- rpc->rc_proctlen = 0;
- rpc->rc_proct = NULL;
-
- if (error)
- {
- return error;
- }
+ rpc.rc_proctlen = 0;
+ rpc.rc_proct = NULL;
+
+ nmp->nm_rpcclnt = &rpc;
- return rpcclnt_connect(rpc);
+ return rpcclnt_connect(&rpc);
}
/* NFS disconnect. Clean up and unlink. */
diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c
index 4679239c1..c889a603f 100644
--- a/nuttx/fs/nfs/nfs_vfsops.c
+++ b/nuttx/fs/nfs/nfs_vfsops.c
@@ -65,6 +65,7 @@
#include <nuttx/fs/dirent.h>
#include <nuttx/fs/fs.h>
#include <nuttx/fs/nfs.h>
+#include <semaphore.h>
#include <net/if.h>
#include <netinet/in.h>
@@ -984,30 +985,15 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
struct nfsmount *nmp;
int error;
- /* Open the block driver */
-/*
- if (!blkdriver || !blkdriver->u.i_bops)
- {
- fdbg("No block driver/ops\n");
- return -ENODEV;
- }
-
- if (blkdriver->u.i_bops->open &&
- blkdriver->u.i_bops->open(blkdriver) != OK)
- {
- fdbg("No open method\n");
- return -ENODEV;
- }
-*/
/* Create an instance of the mountpt state structure */
-/*
+
nmp = (struct nfsmount *)kzalloc(sizeof(struct nfsmount));
if (!nmp)
{
fdbg("Failed to allocate mountpoint structure\n");
return -ENOMEM;
}
-*/
+
/* Initialize the allocated mountpt state structure. The filesystem is
* responsible for one reference ont the blkdriver inode and does not
* have to addref() here (but does have to release in ubind().
@@ -1015,8 +1001,8 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
sem_init(&nmp->nm_sem, 0, 0); /* Initialize the semaphore that controls access */
-//nmp->nm_blkdriver = blkdriver; /* Save the block driver reference */
nfs_init();
+ nmp->nm_flag = argp->flags;
nmp->nm_timeo = NFS_TIMEO;
nmp->nm_retry = NFS_RETRANS;
nmp->nm_wsize = NFS_WSIZE;
@@ -1054,6 +1040,7 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
/* Mounted! */
nmp->nm_mounted = true;
+ nmp->nm_so = nmp->nm_rpcclnt->rc_so;
*handle = &nmp;
nfs_semgive(nmp);
@@ -1109,7 +1096,7 @@ static int nfs_bind(struct inode *blkdriver, const void *data, void **handle)
}
/****************************************************************************
- * Name: nfs_unmount
+ * Name: nfs_unbind
*
* Description: This implements the filesystem portion of the umount
* operation.
diff --git a/nuttx/fs/nfs/rpc.h b/nuttx/fs/nfs/rpc.h
index 8a9b72303..29bebbf4d 100644
--- a/nuttx/fs/nfs/rpc.h
+++ b/nuttx/fs/nfs/rpc.h
@@ -221,12 +221,12 @@ struct rpcclnt
#endif
void *rc_auth;
- struct rpc_program * rc_prog;
+ struct rpc_program *rc_prog;
//char *rc_servername;
int rc_proctlen; /* if == 0 then rc_proct == NULL */
- int * rc_proct;
+ int *rc_proct;
};
/****************************************************************************
diff --git a/nuttx/fs/nfs/rpc_clnt.c b/nuttx/fs/nfs/rpc_clnt.c
index c907a3ff3..0e83a7519 100644
--- a/nuttx/fs/nfs/rpc_clnt.c
+++ b/nuttx/fs/nfs/rpc_clnt.c
@@ -191,7 +191,7 @@ struct rpc_reply *replymsg;
/* Queue head for rpctask's */
-static dq_queue_t *rpctask_q;
+static dq_queue_t rpctask_q;
//struct callout_handle rpcclnt_timer_handle;
/****************************************************************************
@@ -621,7 +621,7 @@ rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call,
* match, just drop the datagram
*/
- for (rep = (struct rpctask *)rpctask_q->head; rep;
+ for (rep = (struct rpctask *)&rpctask_q.head; rep;
rep = (struct rpctask *)rep->r_chain.flink)
{
if (rxid == rep->r_xid)
@@ -635,6 +635,7 @@ rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call,
rpc->rc_cwnd +=
(RPC_CWNDSCALE * RPC_CWNDSCALE +
(rpc->rc_cwnd >> 1)) / rpc->rc_cwnd;
+
if (rpc->rc_cwnd > RPC_MAXCWND)
{
rpc->rc_cwnd = RPC_MAXCWND;
@@ -904,9 +905,9 @@ void rpcclnt_init(void)
/* Initialize rpctask queue */
- dq_init(rpctask_q);
+ dq_init(&rpctask_q);
- rpcclnt_timer(NULL, callmgs);
+ //rpcclnt_timer(NULL, callmgs);
nvdbg("rpc initialed");
return;
@@ -930,13 +931,12 @@ int rpcclnt_connect(struct rpcclnt *rpc)
struct socket *so;
int error;
struct sockaddr *saddr;
- struct sockaddr_in *sin = NULL;
- struct timeval *tv = NULL;
+ struct sockaddr_in sin;
+ struct timeval tv;
uint16_t tport;
/* Create the socket */
- rpc->rc_so = NULL;
saddr = rpc->rc_name;
error =
@@ -956,15 +956,15 @@ int rpcclnt_connect(struct rpcclnt *rpc)
* filehandle disclosure through UDP port capture.
*/
- sin->sin_family = AF_INET;
- sin->sin_addr.s_addr = INADDR_ANY;
+ sin.sin_family = AF_INET;
+ sin.sin_addr.s_addr = INADDR_ANY;
tport = 1024;
do
{
tport--;
- sin->sin_port = htons(tport);
- error = psock_bind(so, (struct sockaddr *)sin, sizeof(*sin));
+ sin.sin_port = htons(tport);
+ error = psock_bind(so, (struct sockaddr *)&sin, sizeof(sin));
}
while (error == EADDRINUSE && tport > 1024 / 2);
@@ -984,7 +984,6 @@ int rpcclnt_connect(struct rpcclnt *rpc)
{
error = ENOTCONN;
goto bad;
-
}
else
{
@@ -995,7 +994,6 @@ int rpcclnt_connect(struct rpcclnt *rpc)
{
dbg("psock_connect returns %d", error);
goto bad;
-
}
#ifdef CONFIG_NFS_TCPIP
}
@@ -1005,12 +1003,12 @@ int rpcclnt_connect(struct rpcclnt *rpc)
* Otherwise, we can get stuck in psock_receive forever.
*/
- tv->tv_sec = 1;
- tv->tv_usec = 0;
+ tv.tv_sec = 1;
+ tv.tv_usec = 0;
if ((error =
- psock_setsockopt(so, SOL_SOCKET, SO_RCVTIMEO, (const void *)tv,
- sizeof(*tv))))
+ psock_setsockopt(so, SOL_SOCKET, SO_RCVTIMEO, (const void *)&tv,
+ sizeof(tv))))
{
goto bad;
}
@@ -1037,6 +1035,7 @@ bad:
* nfs_sndlock() set on the mount point.
*/
+#ifdef CONFIG_NFS_TCPIP
int rpcclnt_reconnect(struct rpctask *rep)
{
struct rpctask *rp;
@@ -1056,7 +1055,7 @@ int rpcclnt_reconnect(struct rpctask *rep)
* requests on old socket.
*/
- for (rp = (struct rpctask *)rpctask_q->head; rp != NULL;
+ for (rp = (struct rpctask *)&rpctask_q->head; rp != NULL;
rp = (struct rpctask *)rp->r_chain.blink)
{
if (rp->r_rpcclnt == rpc)
@@ -1066,6 +1065,7 @@ int rpcclnt_reconnect(struct rpctask *rep)
}
return 0;
}
+#endif
void rpcclnt_disconnect(struct rpcclnt *rpc)
{
@@ -1117,7 +1117,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply, v
int xid = 0;
task = &_task;
- memset(task, 0, sizeof(*task));
+
task->r_rpcclnt = rpc;
task->r_procnum = procnum;
@@ -1159,7 +1159,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply, v
* LAST so timer finds oldest requests first.
*/
- dq_addlast(&task->r_chain, rpctask_q);
+ dq_addlast(&task->r_chain, &rpctask_q);
/* If backing off another request or avoiding congestion, don't send
* this one now but let timer do it. If not timing a request, do it
@@ -1208,7 +1208,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply, v
/* RPC done, unlink the request. */
- dq_rem(&task->r_chain, rpctask_q);
+ dq_rem(&task->r_chain, &rpctask_q);
/* Decrement the outstanding request count. */
@@ -1277,7 +1277,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply, v
reply->stat.mismatch_info.high =
fxdr_unsigned(uint32_t, replysvr->stat.mismatch_info.high);
ndbg("RPC_MSGACCEPTED: RPC_PROGMISMATCH error");
- error = EOPNOTSUPP; /* XXXMARIUS */
+ error = EOPNOTSUPP;
}
else if (reply->stat.status > 5)
{
@@ -1301,7 +1301,7 @@ void rpcclnt_timer(void *arg, struct rpc_call *call)
struct rpcclnt *rpc;
int timeo, error;
- for (rep = (struct rpctask *)rpctask_q->head; rep;
+ for (rep = (struct rpctask *)&rpctask_q.head; rep;
rep = (struct rpctask *)rep->r_chain.flink)
{
rpc = rep->r_rpcclnt;
@@ -1487,7 +1487,7 @@ int rpcclnt_cancelreqs(struct rpcclnt *rpc)
struct rpctask *task;
int i;
- for (task = (struct rpctask *)rpctask_q->head; task;
+ for (task = (struct rpctask *)&rpctask_q.head; task;
task = (struct rpctask *)task->r_chain.flink)
{
if (rpc != task->r_rpcclnt || (task->r_flags & TASK_SOFTTERM))
@@ -1500,7 +1500,7 @@ int rpcclnt_cancelreqs(struct rpcclnt *rpc)
for (i = 0; i < 30; i++)
{
- for (task = (struct rpctask *)rpctask_q->head; task;
+ for (task = (struct rpctask *)&rpctask_q.head; task;
task = (struct rpctask *)task->r_chain.flink)
{
if (rpc == task->r_rpcclnt)