NFS update

git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4657 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
patacongo
2012-04-25 23:22:09 +00:00
parent 542f26af4e
commit a85310abde
6 changed files with 65 additions and 76 deletions
+4 -2
View File
@@ -8,7 +8,7 @@
<tr align="center" bgcolor="#e4e4e4"> <tr align="center" bgcolor="#e4e4e4">
<td> <td>
<h1><big><font color="#3c34ec"><i>NuttX RTOS</i></font></big></h1> <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> </td>
</tr> </tr>
</table> </table>
@@ -2252,7 +2252,9 @@
</li> </li>
<p> <p>
<b>STATUS:</b> <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> </p>
</ul> </ul>
</td> </td>
+4
View File
@@ -1496,6 +1496,10 @@ configs/pic32mx7mmb
Mikroelektronika PIC32MX7 Multimedia Board (MMB). See Mikroelektronika PIC32MX7 Multimedia Board (MMB). See
http://www.mikroe.com/ for further information. 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 configs/pjrc-8051
8051 Microcontroller. This port uses the PJRC 87C52 development system 8051 Microcontroller. This port uses the PJRC 87C52 development system
and the SDCC toolchain. This port is not quite ready for prime time. and the SDCC toolchain. This port is not quite ready for prime time.
+24 -28
View File
@@ -112,54 +112,50 @@ void nfs_init(void)
int nfs_connect(struct nfsmount *nmp) int nfs_connect(struct nfsmount *nmp)
{ {
struct rpcclnt *rpc; struct rpcclnt rpc;
int error = 0;
if (nmp == NULL) if (nmp == NULL)
{ {
return EFAULT; 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 */ /* translate nfsmnt flags -> rpcclnt flags */
rpc->rc_flag = 0; rpc.rc_flag = 0;
nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, SOFT); 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, INT);
nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, NOCONN); nfsmnt_to_rpcclnt(nmp->nm_flag, rpc.rc_flag, NOCONN);
nfsmnt_to_rpcclnt(nmp->nm_flag, rpc->rc_flag, DUMBTIMR); nfsmnt_to_rpcclnt(nmp->nm_flag, rpc.rc_flag, DUMBTIMR);
//rpc->rc_flag |= RPCCLNT_REDIRECT; /* Make this a mount option. */ //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_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_sotype = nmp->nm_sotype;
rpc->rc_soproto = nmp->nm_soproto; rpc.rc_soproto = nmp->nm_soproto;
rpc->rc_rsize = (nmp->nm_rsize > nmp->nm_readdirsize) ? rpc.rc_rsize = (nmp->nm_rsize > nmp->nm_readdirsize) ?
nmp->nm_rsize : nmp->nm_readdirsize; nmp->nm_rsize : nmp->nm_readdirsize;
rpc->rc_wsize = nmp->nm_wsize; rpc.rc_wsize = nmp->nm_wsize;
rpc->rc_deadthresh = nmp->nm_deadthresh; rpc.rc_deadthresh = nmp->nm_deadthresh;
rpc->rc_timeo = nmp->nm_timeo; rpc.rc_timeo = nmp->nm_timeo;
rpc->rc_retry = nmp->nm_retry; rpc.rc_retry = nmp->nm_retry;
/* XXX v2,3 need to use this */ /* v3 need to use this */
rpc->rc_proctlen = 0; rpc.rc_proctlen = 0;
rpc->rc_proct = NULL; rpc.rc_proct = NULL;
nmp->nm_rpcclnt = &rpc;
if (error) return rpcclnt_connect(&rpc);
{
return error;
}
return rpcclnt_connect(rpc);
} }
/* NFS disconnect. Clean up and unlink. */ /* NFS disconnect. Clean up and unlink. */
+6 -19
View File
@@ -65,6 +65,7 @@
#include <nuttx/fs/dirent.h> #include <nuttx/fs/dirent.h>
#include <nuttx/fs/fs.h> #include <nuttx/fs/fs.h>
#include <nuttx/fs/nfs.h> #include <nuttx/fs/nfs.h>
#include <semaphore.h>
#include <net/if.h> #include <net/if.h>
#include <netinet/in.h> #include <netinet/in.h>
@@ -984,30 +985,15 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
struct nfsmount *nmp; struct nfsmount *nmp;
int error; 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 */ /* Create an instance of the mountpt state structure */
/*
nmp = (struct nfsmount *)kzalloc(sizeof(struct nfsmount)); nmp = (struct nfsmount *)kzalloc(sizeof(struct nfsmount));
if (!nmp) if (!nmp)
{ {
fdbg("Failed to allocate mountpoint structure\n"); fdbg("Failed to allocate mountpoint structure\n");
return -ENOMEM; return -ENOMEM;
} }
*/
/* Initialize the allocated mountpt state structure. The filesystem is /* Initialize the allocated mountpt state structure. The filesystem is
* responsible for one reference ont the blkdriver inode and does not * responsible for one reference ont the blkdriver inode and does not
* have to addref() here (but does have to release in ubind(). * 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 */ sem_init(&nmp->nm_sem, 0, 0); /* Initialize the semaphore that controls access */
//nmp->nm_blkdriver = blkdriver; /* Save the block driver reference */
nfs_init(); nfs_init();
nmp->nm_flag = argp->flags;
nmp->nm_timeo = NFS_TIMEO; nmp->nm_timeo = NFS_TIMEO;
nmp->nm_retry = NFS_RETRANS; nmp->nm_retry = NFS_RETRANS;
nmp->nm_wsize = NFS_WSIZE; nmp->nm_wsize = NFS_WSIZE;
@@ -1054,6 +1040,7 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
/* Mounted! */ /* Mounted! */
nmp->nm_mounted = true; nmp->nm_mounted = true;
nmp->nm_so = nmp->nm_rpcclnt->rc_so;
*handle = &nmp; *handle = &nmp;
nfs_semgive(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 * Description: This implements the filesystem portion of the umount
* operation. * operation.
+2 -2
View File
@@ -221,12 +221,12 @@ struct rpcclnt
#endif #endif
void *rc_auth; void *rc_auth;
struct rpc_program * rc_prog; struct rpc_program *rc_prog;
//char *rc_servername; //char *rc_servername;
int rc_proctlen; /* if == 0 then rc_proct == NULL */ int rc_proctlen; /* if == 0 then rc_proct == NULL */
int * rc_proct; int *rc_proct;
}; };
/**************************************************************************** /****************************************************************************
+25 -25
View File
@@ -191,7 +191,7 @@ struct rpc_reply *replymsg;
/* Queue head for rpctask's */ /* Queue head for rpctask's */
static dq_queue_t *rpctask_q; static dq_queue_t rpctask_q;
//struct callout_handle rpcclnt_timer_handle; //struct callout_handle rpcclnt_timer_handle;
/**************************************************************************** /****************************************************************************
@@ -621,7 +621,7 @@ rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call,
* match, just drop the datagram * 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) rep = (struct rpctask *)rep->r_chain.flink)
{ {
if (rxid == rep->r_xid) if (rxid == rep->r_xid)
@@ -635,6 +635,7 @@ rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call,
rpc->rc_cwnd += rpc->rc_cwnd +=
(RPC_CWNDSCALE * RPC_CWNDSCALE + (RPC_CWNDSCALE * RPC_CWNDSCALE +
(rpc->rc_cwnd >> 1)) / rpc->rc_cwnd; (rpc->rc_cwnd >> 1)) / rpc->rc_cwnd;
if (rpc->rc_cwnd > RPC_MAXCWND) if (rpc->rc_cwnd > RPC_MAXCWND)
{ {
rpc->rc_cwnd = RPC_MAXCWND; rpc->rc_cwnd = RPC_MAXCWND;
@@ -904,9 +905,9 @@ void rpcclnt_init(void)
/* Initialize rpctask queue */ /* Initialize rpctask queue */
dq_init(rpctask_q); dq_init(&rpctask_q);
rpcclnt_timer(NULL, callmgs); //rpcclnt_timer(NULL, callmgs);
nvdbg("rpc initialed"); nvdbg("rpc initialed");
return; return;
@@ -930,13 +931,12 @@ int rpcclnt_connect(struct rpcclnt *rpc)
struct socket *so; struct socket *so;
int error; int error;
struct sockaddr *saddr; struct sockaddr *saddr;
struct sockaddr_in *sin = NULL; struct sockaddr_in sin;
struct timeval *tv = NULL; struct timeval tv;
uint16_t tport; uint16_t tport;
/* Create the socket */ /* Create the socket */
rpc->rc_so = NULL;
saddr = rpc->rc_name; saddr = rpc->rc_name;
error = error =
@@ -956,15 +956,15 @@ int rpcclnt_connect(struct rpcclnt *rpc)
* filehandle disclosure through UDP port capture. * filehandle disclosure through UDP port capture.
*/ */
sin->sin_family = AF_INET; sin.sin_family = AF_INET;
sin->sin_addr.s_addr = INADDR_ANY; sin.sin_addr.s_addr = INADDR_ANY;
tport = 1024; tport = 1024;
do do
{ {
tport--; tport--;
sin->sin_port = htons(tport); sin.sin_port = htons(tport);
error = psock_bind(so, (struct sockaddr *)sin, sizeof(*sin)); error = psock_bind(so, (struct sockaddr *)&sin, sizeof(sin));
} }
while (error == EADDRINUSE && tport > 1024 / 2); while (error == EADDRINUSE && tport > 1024 / 2);
@@ -984,7 +984,6 @@ int rpcclnt_connect(struct rpcclnt *rpc)
{ {
error = ENOTCONN; error = ENOTCONN;
goto bad; goto bad;
} }
else else
{ {
@@ -995,7 +994,6 @@ int rpcclnt_connect(struct rpcclnt *rpc)
{ {
dbg("psock_connect returns %d", error); dbg("psock_connect returns %d", error);
goto bad; goto bad;
} }
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
} }
@@ -1005,12 +1003,12 @@ int rpcclnt_connect(struct rpcclnt *rpc)
* Otherwise, we can get stuck in psock_receive forever. * Otherwise, we can get stuck in psock_receive forever.
*/ */
tv->tv_sec = 1; tv.tv_sec = 1;
tv->tv_usec = 0; tv.tv_usec = 0;
if ((error = if ((error =
psock_setsockopt(so, SOL_SOCKET, SO_RCVTIMEO, (const void *)tv, psock_setsockopt(so, SOL_SOCKET, SO_RCVTIMEO, (const void *)&tv,
sizeof(*tv)))) sizeof(tv))))
{ {
goto bad; goto bad;
} }
@@ -1037,6 +1035,7 @@ bad:
* nfs_sndlock() set on the mount point. * nfs_sndlock() set on the mount point.
*/ */
#ifdef CONFIG_NFS_TCPIP
int rpcclnt_reconnect(struct rpctask *rep) int rpcclnt_reconnect(struct rpctask *rep)
{ {
struct rpctask *rp; struct rpctask *rp;
@@ -1056,7 +1055,7 @@ int rpcclnt_reconnect(struct rpctask *rep)
* requests on old socket. * 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) rp = (struct rpctask *)rp->r_chain.blink)
{ {
if (rp->r_rpcclnt == rpc) if (rp->r_rpcclnt == rpc)
@@ -1066,6 +1065,7 @@ int rpcclnt_reconnect(struct rpctask *rep)
} }
return 0; return 0;
} }
#endif
void rpcclnt_disconnect(struct rpcclnt *rpc) 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; int xid = 0;
task = &_task; task = &_task;
memset(task, 0, sizeof(*task));
task->r_rpcclnt = rpc; task->r_rpcclnt = rpc;
task->r_procnum = procnum; 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. * 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 /* 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 * 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. */ /* RPC done, unlink the request. */
dq_rem(&task->r_chain, rpctask_q); dq_rem(&task->r_chain, &rpctask_q);
/* Decrement the outstanding request count. */ /* 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 = reply->stat.mismatch_info.high =
fxdr_unsigned(uint32_t, replysvr->stat.mismatch_info.high); fxdr_unsigned(uint32_t, replysvr->stat.mismatch_info.high);
ndbg("RPC_MSGACCEPTED: RPC_PROGMISMATCH error"); ndbg("RPC_MSGACCEPTED: RPC_PROGMISMATCH error");
error = EOPNOTSUPP; /* XXXMARIUS */ error = EOPNOTSUPP;
} }
else if (reply->stat.status > 5) else if (reply->stat.status > 5)
{ {
@@ -1301,7 +1301,7 @@ void rpcclnt_timer(void *arg, struct rpc_call *call)
struct rpcclnt *rpc; struct rpcclnt *rpc;
int timeo, error; 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) rep = (struct rpctask *)rep->r_chain.flink)
{ {
rpc = rep->r_rpcclnt; rpc = rep->r_rpcclnt;
@@ -1487,7 +1487,7 @@ int rpcclnt_cancelreqs(struct rpcclnt *rpc)
struct rpctask *task; struct rpctask *task;
int i; 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) task = (struct rpctask *)task->r_chain.flink)
{ {
if (rpc != task->r_rpcclnt || (task->r_flags & TASK_SOFTTERM)) 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 (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) task = (struct rpctask *)task->r_chain.flink)
{ {
if (rpc == task->r_rpcclnt) if (rpc == task->r_rpcclnt)