NFS update

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4809 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo
2012-06-07 01:03:34 +00:00
parent f341d5abcf
commit ecd38c4f9d
6 changed files with 310 additions and 459 deletions
+10 -9
View File
@@ -124,13 +124,13 @@ int nfs_connect(struct nfsmount *nmp)
rpc = (struct rpcclnt *)kzalloc(sizeof(struct rpcclnt)); rpc = (struct rpcclnt *)kzalloc(sizeof(struct rpcclnt));
if (!rpc) if (!rpc)
{ {
fdbg("Failed to allocate rpc structure\n"); fdbg("ERROR: Failed to allocate rpc structure\n");
return -ENOMEM; return -ENOMEM;
} }
rpc->rc_prog = &nfs3_program; rpc->rc_prog = &nfs3_program;
fvdbg("nfs connect!\n"); fvdbg("Connecting\n");
/* translate nfsmnt flags -> rpcclnt flags */ /* translate nfsmnt flags -> rpcclnt flags */
@@ -181,12 +181,12 @@ void nfs_safedisconnect(struct nfsmount *nmp)
#endif #endif
int nfs_request(struct nfsmount *nmp, int procnum, FAR const void *datain, int nfs_request(struct nfsmount *nmp, int procnum, FAR const void *datain,
FAR void *dataout) FAR void *dataout, size_t len)
{ {
int error; struct rpcclnt *clnt= nmp->nm_rpcclnt;
struct rpcclnt *clnt= nmp->nm_rpcclnt;
struct rpc_reply_header replyh; struct rpc_reply_header replyh;
int trylater_delay; int trylater_delay;
int error;
tryagain: tryagain:
@@ -194,13 +194,14 @@ tryagain:
error = rpcclnt_request(clnt, procnum, nmp->nm_rpcclnt->rc_prog->prog_id, error = rpcclnt_request(clnt, procnum, nmp->nm_rpcclnt->rc_prog->prog_id,
nmp->nm_rpcclnt->rc_prog->prog_version, dataout, nmp->nm_rpcclnt->rc_prog->prog_version, dataout,
datain); datain, len);
if (error != 0) if (error != 0)
{ {
fdbg("ERROR: rpcclnt_request failed: %d\n", error);
goto out; goto out;
} }
bcopy(dataout, &replyh, sizeof(replyh)); bcopy(dataout, &replyh, sizeof(struct rpc_reply_header));
if (replyh.rpc_verfi.authtype != 0) if (replyh.rpc_verfi.authtype != 0)
{ {
@@ -224,12 +225,12 @@ tryagain:
if (error == ESTALE) if (error == ESTALE)
{ {
fdbg("%s: ESTALE on mount from server \n", fdbg("ERROR %s: ESTALE on mount from server\n",
nmp->nm_rpcclnt->rc_prog->prog_name); nmp->nm_rpcclnt->rc_prog->prog_name);
} }
else else
{ {
fdbg("%s: unknown error %d from server \n", fdbg("ERROR %s: unknown error %d from server\n",
nmp->nm_rpcclnt->rc_prog->prog_name, error); nmp->nm_rpcclnt->rc_prog->prog_name, error);
} }
+1 -1
View File
@@ -61,7 +61,7 @@ EXTERN void nfs_disconnect(struct nfsmount *);
EXTERN int nfs_sigintr(struct nfsmount *, struct nfsreq *, cthread_t *); EXTERN int nfs_sigintr(struct nfsmount *, struct nfsreq *, cthread_t *);
EXTERN void nfs_safedisconnect(struct nfsmount *); EXTERN void nfs_safedisconnect(struct nfsmount *);
#endif #endif
EXTERN int nfs_request(struct nfsmount *, int, FAR const void *, FAR void *); EXTERN int nfs_request(struct nfsmount *, int, FAR const void *, FAR void *, size_t);
#undef COMP #undef COMP
#ifdef COMP #ifdef COMP
EXTERN int nfs_nmcancelreqs(struct nfsmount *); EXTERN int nfs_nmcancelreqs(struct nfsmount *);
+152 -113
View File
@@ -185,7 +185,7 @@ static int nfs_open(FAR struct file *filep, FAR const char *relpath,
struct nfsmount *nmp; struct nfsmount *nmp;
struct nfsnode *np; struct nfsnode *np;
struct CREATE3args create; struct CREATE3args create;
struct CREATE3resok resok; struct rpc_reply_create resok;
int error = 0; int error = 0;
/* Sanity checks */ /* Sanity checks */
@@ -232,13 +232,15 @@ again:
//txdr_nfsv3time2(&vap.fa3_mtime, &sp.sa_mtime); //txdr_nfsv3time2(&vap.fa3_mtime, &sp.sa_mtime);
memset(&create, 0, sizeof(struct CREATE3args)); memset(&create, 0, sizeof(struct CREATE3args));
memset(&resok, 0, sizeof(struct rpc_reply_create));
create.how = sp; create.how = sp;
create.where.dir.length = txdr_unsigned(np->n_fhsize); create.where.dir.length = txdr_unsigned(np->n_fhsize);
create.where.dir.handle = np->n_fhp; create.where.dir.handle = np->n_fhp;
create.where.length = txdr_unsigned(64); create.where.length = txdr_unsigned(64);
strncpy(create.where.name, relpath, 64); strncpy(create.where.name, relpath, 64);
error = nfs_request(nmp, NFSPROC_CREATE, (FAR const void *)&create, (void *)&resok); error = nfs_request(nmp, NFSPROC_CREATE, (FAR const void *)&create,
(void *)&resok, sizeof(struct rpc_reply_create));
if (!error) if (!error)
{ {
/* Create an instance of the file private data to describe the opened /* Create an instance of the file private data to describe the opened
@@ -248,7 +250,7 @@ again:
np = (struct nfsnode *)kzalloc(sizeof(struct nfsnode)); np = (struct nfsnode *)kzalloc(sizeof(struct nfsnode));
if (!np) if (!np)
{ {
fdbg("Failed to allocate private data\n", error); fdbg("ERROR: Failed to allocate private data\n");
error = -ENOMEM; error = -ENOMEM;
goto errout_with_semaphore; goto errout_with_semaphore;
} }
@@ -257,7 +259,7 @@ again:
* non-zero elements) * non-zero elements)
*/ */
np->nfsv3_type = fxdr_unsigned(uint32_t, resok.attributes.fa_type); // np->nfsv3_type = fxdr_unsigned(uint32_t, resok.attributes.fa_type);
/* The full path exists -- but is the final component a file /* The full path exists -- but is the final component a file
* or a directory? * or a directory?
@@ -268,16 +270,16 @@ again:
/* It is a directory */ /* It is a directory */
error = EISDIR; error = EISDIR;
fdbg("'%s' is a directory\n", relpath); fdbg("ERROR: '%s' is a directory\n", relpath);
goto errout_with_semaphore; goto errout_with_semaphore;
} }
np->n_open = true; np->n_open = true;
np->n_fhp = resok.fshandle.handle; bcopy(&resok.create.fshandle.handle, &np->n_fhp, sizeof(nfsfh_t));
np->n_size = fxdr_hyper(&resok.attributes.fa3_size); np->n_size = fxdr_hyper(&resok.create.attributes.fa3_size);
np->n_fattr = resok.attributes; bcopy(&resok.create.attributes, &np->n_fattr, sizeof(struct nfs_fattr));
fxdr_nfsv3time(&resok.attributes.fa3_mtime, &np->n_mtime) fxdr_nfsv3time(&resok.create.attributes.fa3_mtime, &np->n_mtime)
np->n_ctime = fxdr_hyper(&resok.attributes.fa3_ctime); np->n_ctime = fxdr_hyper(&resok.create.attributes.fa3_ctime);
/* Attach the private date to the struct file instance */ /* Attach the private date to the struct file instance */
@@ -307,7 +309,7 @@ again:
{ {
if (np->nfsv3_type != NFREG) if (np->nfsv3_type != NFREG)
{ {
fdbg("open eacces typ=%d\n", np->nfsv3_type); fdbg("ERROR: open eacces typ=%d\n", np->nfsv3_type);
return EACCES; return EACCES;
} }
@@ -378,7 +380,7 @@ static ssize_t nfs_read(FAR struct file *filep, char *buffer, size_t buflen)
int bytesleft; int bytesleft;
uint64_t offset; uint64_t offset;
struct READ3args read; struct READ3args read;
struct READ3resok resok; struct rpc_reply_read resok;
uint8_t *userbuffer = (uint8_t*)buffer; uint8_t *userbuffer = (uint8_t*)buffer;
int error = 0; int error = 0;
int len; int len;
@@ -449,18 +451,19 @@ again:
read.count = txdr_unsigned(buflen); read.count = txdr_unsigned(buflen);
read.offset = txdr_unsigned(offset); read.offset = txdr_unsigned(offset);
error = nfs_request(nmp, NFSPROC_READ, (FAR const void *)&read, (void *)&resok); error = nfs_request(nmp, NFSPROC_READ, (FAR const void *)&read,
(void *)&resok, sizeof(struct rpc_reply_read));
if (error) if (error)
{ {
goto errout_with_semaphore; goto errout_with_semaphore;
} }
eof = resok.eof; //eof = resok.eof;
if (eof == true) if (eof == true)
{ {
readsize = fxdr_unsigned(uint32_t, resok.count); readsize = fxdr_unsigned(uint32_t, resok.read.count);
np->n_fattr = resok.file_attributes; np->n_fattr = resok.read.file_attributes;//
memcpy(userbuffer, resok.data, readsize); memcpy(userbuffer, resok.read.data, readsize);
} }
else else
{ {
@@ -487,7 +490,7 @@ nfs_write(FAR struct file *filep, const char *buffer, size_t buflen)
struct nfsnode *np; struct nfsnode *np;
unsigned int writesize; unsigned int writesize;
struct WRITE3args write; struct WRITE3args write;
struct WRITE3resok resok; struct rpc_reply_write resok;
uint8_t *userbuffer = (uint8_t*)buffer; uint8_t *userbuffer = (uint8_t*)buffer;
int error = 0; int error = 0;
uint64_t offset; uint64_t offset;
@@ -543,21 +546,21 @@ nfs_write(FAR struct file *filep, const char *buffer, size_t buflen)
memcpy((void *)write.data, userbuffer, buflen); memcpy((void *)write.data, userbuffer, buflen);
error = nfs_request(nmp, NFSPROC_WRITE, (FAR const void *)&write, error = nfs_request(nmp, NFSPROC_WRITE, (FAR const void *)&write,
(FAR void *)&resok); (FAR void *)&resok, sizeof(struct rpc_reply_write));
if (error) if (error)
{ {
goto errout_with_semaphore; goto errout_with_semaphore;
} }
writesize = resok.count; //writesize = resok.count;
if (writesize == 0) if (writesize == 0)
{ {
error = NFSERR_IO; error = NFSERR_IO;
goto errout_with_semaphore; goto errout_with_semaphore;
} }
commit = resok.committed; //commit = resok.committed;
np->n_fattr = resok.file_wcc.after; np->n_fattr = resok.write.file_wcc.after;
/* Return the lowest committment level obtained by any of the RPCs. */ /* Return the lowest committment level obtained by any of the RPCs. */
@@ -573,12 +576,12 @@ nfs_write(FAR struct file *filep, const char *buffer, size_t buflen)
if ((nmp->nm_flag & NFSMNT_HASWRITEVERF) == 0) if ((nmp->nm_flag & NFSMNT_HASWRITEVERF) == 0)
{ {
bcopy((void*) resok.verf, (void*) nmp->nm_verf, NFSX_V3WRITEVERF); bcopy((void*) resok.write.verf, (void*) nmp->nm_verf, NFSX_V3WRITEVERF);
nmp->nm_flag |= NFSMNT_HASWRITEVERF; nmp->nm_flag |= NFSMNT_HASWRITEVERF;
} }
else if (strncmp((char*) resok.verf, (char*) nmp->nm_verf, NFSX_V3WRITEVERF)) else if (strncmp((char*) resok.write.verf, (char*) nmp->nm_verf, NFSX_V3WRITEVERF))
{ {
bcopy((void*) resok.verf, (void*) nmp->nm_verf, NFSX_V3WRITEVERF); bcopy((void*) resok.write.verf, (void*) nmp->nm_verf, NFSX_V3WRITEVERF);
} }
fxdr_nfsv3time(&np->n_fattr.fa3_mtime, &np->n_mtime) fxdr_nfsv3time(&np->n_fattr.fa3_mtime, &np->n_mtime)
@@ -675,7 +678,7 @@ int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np,
{ {
int error = 0; int error = 0;
struct READDIR3args readir; struct READDIR3args readir;
struct READDIR3resok resok; struct rpc_reply_readdir resok;
/* Loop around doing readdir rpc's of size nm_readdirsize /* Loop around doing readdir rpc's of size nm_readdirsize
* truncated to a multiple of NFS_READDIRBLKSIZ. * truncated to a multiple of NFS_READDIRBLKSIZ.
@@ -706,26 +709,25 @@ int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np,
} }
error = nfs_request(nmp, NFSPROC_READDIR, (FAR const void *)&readir, error = nfs_request(nmp, NFSPROC_READDIR, (FAR const void *)&readir,
(FAR void *)&resok); (FAR void *)&resok, sizeof(struct rpc_reply_readdir));
if (error) if (error)
{ {
goto nfsmout; goto nfsmout;
} }
np->n_fattr = resok.dir_attributes;
np->n_cookieverf.nfsuquad[0] = resok.cookieverf.nfsuquad[0];
np->n_cookieverf.nfsuquad[1] = resok.cookieverf.nfsuquad[1];
dir->fd_dir.d_type = resok.reply.entries->fileid;
memcpy(&dir->fd_dir.d_name[NAME_MAX], &resok.reply.entries->name, NAME_MAX);
//dir->fd_dir.d_name = resok->reply.entries->name;// //dir->fd_dir.d_name = resok->reply.entries->name;//
dir->u.nfs.cookie[0] = resok.reply.entries->cookie.nfsuquad[0]; /*np->n_fattr = resok.readir.dir_attributes;
dir->u.nfs.cookie[1] = resok.reply.entries->cookie.nfsuquad[1]; np->n_cookieverf.nfsuquad[0] = resok.readir.cookieverf.nfsuquad[0];
np->n_cookieverf.nfsuquad[1] = resok.readir.cookieverf.nfsuquad[1];
dir->fd_dir.d_type = resok.readir.reply.entries->fileid;
memcpy(&dir->fd_dir.d_name[NAME_MAX], &resok.readir.reply.entries->name, NAME_MAX);
dir->u.nfs.cookie[0] = resok.readir.reply.entries->cookie.nfsuquad[0];
dir->u.nfs.cookie[1] = resok.readir.reply.entries->cookie.nfsuquad[1];
if (resok.reply.eof == true) if (resok.readir.reply.eof == true)
{ {
end_of_directory = true; end_of_directory = true;
} }
*/
//more_dirs = fxdr_unsigned(int, *dp); //more_dirs = fxdr_unsigned(int, *dp);
/* loop thru the dir entries */ /* loop thru the dir entries */
@@ -748,14 +750,14 @@ int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np,
more_dirs = fxdr_unsigned(int, *ndp); more_dirs = fxdr_unsigned(int, *ndp);
} }
*/
} }
*/
/* We are now either at the end of the directory */ /* We are now either at the end of the directory */
/*
if (resok.reply.entries == NULL) if (resok.readir.reply.entries == NULL)
{ {
np->n_direofoffset = fxdr_hyper(&dir->u.nfs.cookie[0]); np->n_direofoffset = fxdr_hyper(&dir->u.nfs.cookie[0]);*/
/* We signal the end of the directory by returning the /* We signal the end of the directory by returning the
* special error -ENOENT * special error -ENOENT
@@ -1082,18 +1084,18 @@ void nfs_decode_args(struct nfsmount *nmp, struct nfs_args *argp)
int mountnfs(struct nfs_args *argp, void **handle) int mountnfs(struct nfs_args *argp, void **handle)
{ {
struct nfsmount *nmp; FAR struct nfsmount *nmp;
struct nfsnode *np; struct nfsnode *np = NULL;
struct FS3args getattr; struct FS3args getattr;
struct rpc_reply_getattr resok; struct rpc_reply_getattr resok;
int error = 0; int error = 0;
/* Create an instance of the mountpt state structure */ /* Create an instance of the mountpt state structure */
nmp = (struct nfsmount *)kzalloc(sizeof(struct nfsmount)); nmp = (FAR struct nfsmount *)kzalloc(sizeof(struct nfsmount));
if (!nmp) if (!nmp)
{ {
fdbg("Failed to allocate mountpoint structure\n"); fdbg("ERROR: Failed to allocate mountpoint structure\n");
return -ENOMEM; return -ENOMEM;
} }
@@ -1105,35 +1107,43 @@ int mountnfs(struct nfs_args *argp, 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 */
nfs_init(); nfs_init();
nmp->nm_flag = argp->flags;
nmp->nm_timeo = NFS_TIMEO; nmp->nm_flag = argp->flags;
nmp->nm_retry = NFS_RETRANS; nmp->nm_timeo = NFS_TIMEO;
nmp->nm_wsize = NFS_WSIZE; nmp->nm_retry = NFS_RETRANS;
nmp->nm_rsize = NFS_RSIZE; nmp->nm_wsize = NFS_WSIZE;
nmp->nm_rsize = NFS_RSIZE;
nmp->nm_readdirsize = NFS_READDIRSIZE; nmp->nm_readdirsize = NFS_READDIRSIZE;
nmp->nm_numgrps = NFS_MAXGRPS; nmp->nm_numgrps = NFS_MAXGRPS;
nmp->nm_readahead = NFS_DEFRAHEAD; nmp->nm_readahead = NFS_DEFRAHEAD;
nmp->nm_fhsize = NFSX_V3FHMAX; nmp->nm_fhsize = NFSX_V3FHMAX;
nmp->nm_acregmin = NFS_MINATTRTIMO; nmp->nm_acregmin = NFS_MINATTRTIMO;
nmp->nm_acregmax = NFS_MAXATTRTIMO; nmp->nm_acregmax = NFS_MAXATTRTIMO;
nmp->nm_acdirmin = NFS_MINATTRTIMO; nmp->nm_acdirmin = NFS_MINATTRTIMO;
nmp->nm_acdirmax = NFS_MAXATTRTIMO; nmp->nm_acdirmax = NFS_MAXATTRTIMO;
strncpy(nmp->nm_path, argp->path, 90); strncpy(nmp->nm_path, argp->path, 90);
nmp->nm_nam = argp->addr; nmp->nm_nam = argp->addr;
nfs_decode_args(nmp, argp); nfs_decode_args(nmp, argp);
/* Set up the sockets and per-host congestion */ /* Set up the sockets and per-host congestion */
nmp->nm_sotype = argp->sotype; nmp->nm_sotype = argp->sotype;
nmp->nm_soproto = argp->proto; nmp->nm_soproto = argp->proto;
/* For Connection based sockets (TCP,...) defer the connect until /* For Connection based sockets (TCP,...) defer the connect until
* the first request, in case the server is not responding. * the first request, in case the server is not responding.
*/ */
if (nmp->nm_sotype == SOCK_DGRAM && (error = nfs_connect(nmp))) if (nmp->nm_sotype == SOCK_DGRAM)
{ {
goto bad; /* Connection-less... connect now */
error = nfs_connect(nmp);
if (error != 0)
{
fdbg("ERROR: nfs_connect failed: %d\n", error);
goto bad;
}
} }
/* Create an instance of the file private data to describe the opened /* Create an instance of the file private data to describe the opened
@@ -1143,20 +1153,23 @@ int mountnfs(struct nfs_args *argp, void **handle)
np = (struct nfsnode *)kzalloc(sizeof(struct nfsnode)); np = (struct nfsnode *)kzalloc(sizeof(struct nfsnode));
if (!np) if (!np)
{ {
fdbg("Failed to allocate private data\n"); fdbg("ERROR: Failed to allocate private data\n");
return -ENOMEM; error = -ENOMEM;
goto bad;
} }
np->nfsv3_type = NFDIR; np->nfsv3_type = NFDIR;
np->n_open = true; np->n_open = true;
np->n_flag |= NMODIFIED; np->n_flag |= NMODIFIED;
nmp->nm_head = np; nmp->nm_head = np;
nmp->nm_mounted = true; nmp->nm_mounted = true;
nmp->nm_fh = nmp->nm_rpcclnt->rc_fh; nmp->nm_fh = nmp->nm_rpcclnt->rc_fh;
nmp->nm_fhsize = NFSX_V2FH; nmp->nm_fhsize = NFSX_V2FH;
nmp->nm_head->n_fhp = nmp->nm_fh; nmp->nm_head->n_fhp = nmp->nm_fh;
nmp->nm_head->n_fhsize = nmp->nm_fhsize; nmp->nm_head->n_fhsize = nmp->nm_fhsize;
nmp->nm_so = nmp->nm_rpcclnt->rc_so; nmp->nm_so = nmp->nm_rpcclnt->rc_so;
/* Get the file attributes */
memset(&getattr, 0, sizeof(struct FS3args)); memset(&getattr, 0, sizeof(struct FS3args));
memset(&resok, 0, sizeof(struct rpc_reply_getattr)); memset(&resok, 0, sizeof(struct rpc_reply_getattr));
@@ -1164,35 +1177,53 @@ int mountnfs(struct nfs_args *argp, void **handle)
getattr.fsroot.handle = nmp->nm_fh; getattr.fsroot.handle = nmp->nm_fh;
error = nfs_request(nmp, NFSPROC_GETATTR, (FAR const void *)&getattr, error = nfs_request(nmp, NFSPROC_GETATTR, (FAR const void *)&getattr,
(FAR void*)&resok); (FAR void*)&resok, sizeof(struct rpc_reply_getattr));
if (error) if (error)
{ {
fdbg("ERROR: nfs_request failed: %d\n", error);
goto bad; goto bad;
} }
memcpy(&np->n_fattr, &resok, sizeof(struct rpc_reply_getattr)); /* Save the file attributes */
memcpy(&nmp->nm_fattr, &resok, sizeof(struct rpc_reply_getattr));
fvdbg("value %d \n", sizeof(struct rpc_reply_getattr)); memcpy(&np->n_fattr, &resok.attr, sizeof(struct nfs_fattr));
/* fvdbg("type %d \n", fxdr_unsigned(uint32_t, resok.attr.fa_type)); memcpy(&nmp->nm_fattr, &resok.attr, sizeof(struct nfs_fattr));
fvdbg("mode %d \n", fxdr_unsigned(uint32_t, resok.attr.fa_mode));
fvdbg("Type %d \n", fxdr_unsigned(uint32_t, nmp->nm_fattr.fa_type));
fvdbg("mode %d \n", fxdr_unsigned(uint32_t, nmp->nm_fattr.fa_mode));*/
/* Mounted! */ /* Mounted! */
*handle = (void*)nmp; *handle = (void*)nmp;
nfs_semgive(nmp); nfs_semgive(nmp);
fvdbg("Successfully mounted\n");
return 0; return 0;
bad: bad:
nfs_disconnect(nmp); /* Free all memory that was successfully allocated */
sem_destroy(&nmp->nm_sem);
kfree(nmp->nm_head); if (np)
kfree(nmp->nm_so); {
kfree(nmp->nm_rpcclnt); kfree(np);
kfree(nmp); }
if (nmp)
{
/* Disconnect from the server */
nfs_disconnect(nmp);
/* Free connection-related resources */
sem_destroy(&nmp->nm_sem);
if (nmp->nm_so)
{
kfree(nmp->nm_so);
}
if (nmp->nm_rpcclnt)
{
kfree(nmp->nm_rpcclnt);
}
kfree(nmp);
}
return error; return error;
} }
@@ -1283,7 +1314,7 @@ bad:
static int nfs_statfs(struct inode *mountpt, struct statfs *sbp) static int nfs_statfs(struct inode *mountpt, struct statfs *sbp)
{ {
struct nfs_statfs sfp; struct rpc_reply_fsstat sfp;
struct nfsmount *nmp; struct nfsmount *nmp;
int error = 0; int error = 0;
uint64_t tquad; uint64_t tquad;
@@ -1319,26 +1350,28 @@ static int nfs_statfs(struct inode *mountpt, struct statfs *sbp)
nfsstats.rpccnt[NFSPROC_FSSTAT]++; nfsstats.rpccnt[NFSPROC_FSSTAT]++;
memset(&fsstat, 0, sizeof(struct FS3args)); memset(&fsstat, 0, sizeof(struct FS3args));
memset(&sfp, 0, sizeof(struct rpc_reply_fsstat));
fsstat.fsroot.length = txdr_unsigned(nmp->nm_fhsize); fsstat.fsroot.length = txdr_unsigned(nmp->nm_fhsize);
fsstat.fsroot.handle = nmp->nm_fh; fsstat.fsroot.handle = nmp->nm_fh;
error = nfs_request(nmp, NFSPROC_FSSTAT, (FAR const void *)&fsstat, (FAR void *) &sfp); error = nfs_request(nmp, NFSPROC_FSSTAT, (FAR const void *)&fsstat,
(FAR void *) &sfp, sizeof(struct rpc_reply_fsstat));
if (error) if (error)
{ {
goto errout_with_semaphore; goto errout_with_semaphore;
} }
nmp->nm_head->n_fattr = sfp.obj_attributes; nmp->nm_head->n_fattr = sfp.fsstat.obj_attributes;
sbp->f_bsize = NFS_FABLKSIZE; sbp->f_bsize = NFS_FABLKSIZE;
tquad = fxdr_hyper(&sfp.sf_tbytes); tquad = fxdr_hyper(&sfp.fsstat.sf_tbytes);
sbp->f_blocks = tquad / (uint64_t) NFS_FABLKSIZE; sbp->f_blocks = tquad / (uint64_t) NFS_FABLKSIZE;
tquad = fxdr_hyper(&sfp.sf_fbytes); tquad = fxdr_hyper(&sfp.fsstat.sf_fbytes);
sbp->f_bfree = tquad / (uint64_t) NFS_FABLKSIZE; sbp->f_bfree = tquad / (uint64_t) NFS_FABLKSIZE;
tquad = fxdr_hyper(&sfp.sf_abytes); tquad = fxdr_hyper(&sfp.fsstat.sf_abytes);
sbp->f_bavail = tquad / (uint64_t) NFS_FABLKSIZE; sbp->f_bavail = tquad / (uint64_t) NFS_FABLKSIZE;
tquad = fxdr_hyper(&sfp.sf_tfiles); tquad = fxdr_hyper(&sfp.fsstat.sf_tfiles);
sbp->f_files = tquad; sbp->f_files = tquad;
tquad = fxdr_hyper(&sfp.sf_ffiles); tquad = fxdr_hyper(&sfp.fsstat.sf_ffiles);
sbp->f_ffree = tquad; sbp->f_ffree = tquad;
sbp->f_namelen = NAME_MAX; sbp->f_namelen = NAME_MAX;
@@ -1359,7 +1392,7 @@ static int nfs_remove(struct inode *mountpt, const char *relpath)
struct nfsmount *nmp; struct nfsmount *nmp;
struct nfsnode *np; struct nfsnode *np;
struct REMOVE3args remove; struct REMOVE3args remove;
struct REMOVE3resok resok; struct rpc_reply_remove resok;
int error = 0; int error = 0;
/* Sanity checks */ /* Sanity checks */
@@ -1394,13 +1427,14 @@ static int nfs_remove(struct inode *mountpt, const char *relpath)
nfsstats.rpccnt[NFSPROC_REMOVE]++; nfsstats.rpccnt[NFSPROC_REMOVE]++;
memset(&remove, 0, sizeof(struct REMOVE3args)); memset(&remove, 0, sizeof(struct REMOVE3args));
memset(&resok, 0, sizeof(struct rpc_reply_remove));
remove.object.dir.length = txdr_unsigned(np->n_fhsize); remove.object.dir.length = txdr_unsigned(np->n_fhsize);
remove.object.dir.handle = np->n_fhp; remove.object.dir.handle = np->n_fhp;
remove.object.length = txdr_unsigned(64); remove.object.length = txdr_unsigned(64);
strncpy(remove.object.name, relpath, 64); strncpy(remove.object.name, relpath, 64);
error = nfs_request(nmp, NFSPROC_REMOVE, (FAR const void *)&remove, error = nfs_request(nmp, NFSPROC_REMOVE, (FAR const void *)&remove,
(FAR void*)&resok); (FAR void*)&resok, sizeof(struct rpc_reply_remove));
/* Kludge City: If the first reply to the remove rpc is lost.. /* Kludge City: If the first reply to the remove rpc is lost..
* the reply to the retransmitted request will be ENOENT * the reply to the retransmitted request will be ENOENT
@@ -1418,7 +1452,7 @@ static int nfs_remove(struct inode *mountpt, const char *relpath)
goto errout_with_semaphore; goto errout_with_semaphore;
} }
np->n_fattr = resok.dir_wcc.after; //np->n_fattr = resok.dir_wcc.after;
np->n_flag |= NMODIFIED; np->n_flag |= NMODIFIED;
} }
@@ -1442,7 +1476,7 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
struct nfsmount *nmp; struct nfsmount *nmp;
struct nfsnode *np; struct nfsnode *np;
struct MKDIR3args mkir; struct MKDIR3args mkir;
struct MKDIR3resok resok; struct rpc_reply_mkdir resok;
int error = 0; int error = 0;
/* Sanity checks */ /* Sanity checks */
@@ -1465,6 +1499,7 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
nfsstats.rpccnt[NFSPROC_MKDIR]++; nfsstats.rpccnt[NFSPROC_MKDIR]++;
memset(&mkir, 0, sizeof(struct MKDIR3args)); memset(&mkir, 0, sizeof(struct MKDIR3args));
memset(&resok, 0, sizeof(struct rpc_reply_mkdir));
mkir.where.dir.length = txdr_unsigned(np->n_fhsize); mkir.where.dir.length = txdr_unsigned(np->n_fhsize);
mkir.where.dir.handle = np->n_fhp; mkir.where.dir.handle = np->n_fhp;
mkir.where.length = txdr_unsigned(64); mkir.where.length = txdr_unsigned(64);
@@ -1484,19 +1519,19 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
mkir.attributes = sp; mkir.attributes = sp;
error = nfs_request(nmp, NFSPROC_MKDIR, (FAR const void *)&mkir, error = nfs_request(nmp, NFSPROC_MKDIR, (FAR const void *)&mkir,
(FAR void *)&resok); (FAR void *)&resok, sizeof(struct rpc_reply_mkdir));
if (error) if (error)
{ {
goto errout_with_semaphore; goto errout_with_semaphore;
} }
np->n_open = true; np->n_open = true;
np->nfsv3_type = fxdr_unsigned(uint32_t, resok.obj_attributes.fa_type); /* np->nfsv3_type = fxdr_unsigned(uint32_t, resok.obj_attributes.fa_type);
np->n_fhp = resok.fshandle.handle; np->n_fhp = resok.fshandle.handle;
np->n_size = fxdr_hyper(&resok.obj_attributes.fa3_size); np->n_size = fxdr_hyper(&resok.obj_attributes.fa3_size);
np->n_fattr = resok.obj_attributes; np->n_fattr = resok.obj_attributes;
fxdr_nfsv3time(&resok.obj_attributes.fa3_mtime, &np->n_mtime) fxdr_nfsv3time(&resok.obj_attributes.fa3_mtime, &np->n_mtime)
np->n_ctime = fxdr_hyper(&resok.obj_attributes.fa3_ctime); np->n_ctime = fxdr_hyper(&resok.obj_attributes.fa3_ctime);*/
np->n_flag |= NMODIFIED; np->n_flag |= NMODIFIED;
NFS_INVALIDATE_ATTRCACHE(np); NFS_INVALIDATE_ATTRCACHE(np);
@@ -1518,7 +1553,7 @@ static int nfs_rmdir(struct inode *mountpt, const char *relpath)
struct nfsmount *nmp; struct nfsmount *nmp;
struct nfsnode *np; struct nfsnode *np;
struct RMDIR3args rmdir; struct RMDIR3args rmdir;
struct RMDIR3resok resok; struct rpc_reply_rmdir resok;
int error = 0; int error = 0;
/* Sanity checks */ /* Sanity checks */
@@ -1548,13 +1583,14 @@ static int nfs_rmdir(struct inode *mountpt, const char *relpath)
nfsstats.rpccnt[NFSPROC_RMDIR]++; nfsstats.rpccnt[NFSPROC_RMDIR]++;
memset(&rmdir, 0, sizeof(struct RMDIR3args)); memset(&rmdir, 0, sizeof(struct RMDIR3args));
memset(&resok, 0, sizeof(struct rpc_reply_rmdir));
rmdir.object.dir.length = txdr_unsigned(np->n_fhsize); rmdir.object.dir.length = txdr_unsigned(np->n_fhsize);
rmdir.object.dir.handle = np->n_fhp; rmdir.object.dir.handle = np->n_fhp;
rmdir.object.length = txdr_unsigned(64); rmdir.object.length = txdr_unsigned(64);
strncpy(rmdir.object.name, relpath, 64); strncpy(rmdir.object.name, relpath, 64);
error = nfs_request(nmp, NFSPROC_RMDIR, (FAR const void *)&rmdir, error = nfs_request(nmp, NFSPROC_RMDIR, (FAR const void *)&rmdir,
(FAR void *)&resok); (FAR void *)&resok, sizeof(struct rpc_reply_rmdir));
if (error == ENOENT) if (error == ENOENT)
{ {
error = 0; error = 0;
@@ -1565,7 +1601,7 @@ static int nfs_rmdir(struct inode *mountpt, const char *relpath)
goto errout_with_semaphore; goto errout_with_semaphore;
} }
np->n_fattr = resok.dir_wcc.after; //np->n_fattr = resok.dir_wcc.after;
np->n_flag |= NMODIFIED; np->n_flag |= NMODIFIED;
} }
@@ -1589,7 +1625,7 @@ static int nfs_rename(struct inode *mountpt, const char *oldrelpath,
struct nfsmount *nmp; struct nfsmount *nmp;
struct nfsnode *np; struct nfsnode *np;
struct RENAME3args rename; struct RENAME3args rename;
struct RENAME3resok resok; struct rpc_reply_rename resok;
int error = 0; int error = 0;
/* Sanity checks */ /* Sanity checks */
@@ -1619,6 +1655,7 @@ static int nfs_rename(struct inode *mountpt, const char *oldrelpath,
nfsstats.rpccnt[NFSPROC_RENAME]++; nfsstats.rpccnt[NFSPROC_RENAME]++;
memset(&rename, 0, sizeof(struct RENAME3args)); memset(&rename, 0, sizeof(struct RENAME3args));
memset(&resok, 0, sizeof(struct rpc_reply_rename));
rename.from.dir.length = txdr_unsigned(np->n_fhsize); rename.from.dir.length = txdr_unsigned(np->n_fhsize);
rename.from.dir.handle = np->n_fhp; rename.from.dir.handle = np->n_fhp;
rename.from.length = txdr_unsigned(64); rename.from.length = txdr_unsigned(64);
@@ -1629,7 +1666,7 @@ static int nfs_rename(struct inode *mountpt, const char *oldrelpath,
strncpy(rename.to.name, newrelpath, 64); strncpy(rename.to.name, newrelpath, 64);
error = nfs_request(nmp, NFSPROC_RENAME, (FAR const void *)&rename, error = nfs_request(nmp, NFSPROC_RENAME, (FAR const void *)&rename,
(FAR void *)&resok); (FAR void *)&resok, sizeof(struct rpc_reply_rename));
/* ENOENT => 0 assuming that it is a reply to a retry. */ /* ENOENT => 0 assuming that it is a reply to a retry. */
@@ -1643,7 +1680,7 @@ static int nfs_rename(struct inode *mountpt, const char *oldrelpath,
goto errout_with_semaphore; goto errout_with_semaphore;
} }
np->n_fattr = resok.todir_wcc.after; //np->n_fattr = resok.todir_wcc.after;
np->n_flag |= NMODIFIED; np->n_flag |= NMODIFIED;
NFS_INVALIDATE_ATTRCACHE(np); NFS_INVALIDATE_ATTRCACHE(np);
@@ -1661,10 +1698,10 @@ errout_with_semaphore:
static int nfs_fsinfo(struct inode *mountpt, const char *relpath, struct stat *buf) static int nfs_fsinfo(struct inode *mountpt, const char *relpath, struct stat *buf)
{ {
struct nfsv3_fsinfo fsp; struct rpc_reply_fsinfo fsp;
struct FS3args fsinfo; struct FS3args fsinfo;
struct nfsmount *nmp; struct nfsmount *nmp;
uint32_t pref, max; //uint32_t pref, max;
int error = 0; int error = 0;
/* Sanity checks */ /* Sanity checks */
@@ -1685,19 +1722,21 @@ static int nfs_fsinfo(struct inode *mountpt, const char *relpath, struct stat *b
} }
memset(buf, 0, sizeof(struct stat)); memset(buf, 0, sizeof(struct stat));
memset(&fsinfo, 0, sizeof(struct FS3args));
memset(&fsp, 0, sizeof(struct rpc_reply_fsinfo));
nfsstats.rpccnt[NFSPROC_FSINFO]++; nfsstats.rpccnt[NFSPROC_FSINFO]++;
fsinfo.fsroot.length = txdr_unsigned(nmp->nm_fhsize); fsinfo.fsroot.length = txdr_unsigned(nmp->nm_fhsize);
fsinfo.fsroot.handle = nmp->nm_fh; fsinfo.fsroot.handle = nmp->nm_fh;
error = nfs_request(nmp, NFSPROC_FSINFO, (FAR const void *)&fsinfo, error = nfs_request(nmp, NFSPROC_FSINFO, (FAR const void *)&fsinfo,
(FAR void *)&fsp); (FAR void *)&fsp, sizeof(struct rpc_reply_fsinfo));
if (error) if (error)
{ {
goto errout_with_semaphore; goto errout_with_semaphore;
} }
//nmp->nm_fattr = fsp.obj_attributes; //nmp->nm_fattr = fsp.obj_attributes;
pref = fxdr_unsigned(uint32_t, fsp.fs_wtpref); /* pref = fxdr_unsigned(uint32_t, fsp.fs_wtpref);
if (pref < nmp->nm_wsize) if (pref < nmp->nm_wsize)
{ {
nmp->nm_wsize = (pref + NFS_FABLKSIZE - 1) & ~(NFS_FABLKSIZE - 1); nmp->nm_wsize = (pref + NFS_FABLKSIZE - 1) & ~(NFS_FABLKSIZE - 1);
@@ -1741,7 +1780,7 @@ static int nfs_fsinfo(struct inode *mountpt, const char *relpath, struct stat *b
nmp->nm_readdirsize = max; nmp->nm_readdirsize = max;
} }
} }
*/
buf->st_mode = fxdr_unsigned(uint32_t, nmp->nm_fattr.fa_mode); buf->st_mode = fxdr_unsigned(uint32_t, nmp->nm_fattr.fa_mode);
buf->st_size = fxdr_hyper(&nmp->nm_fattr.fa3_size); buf->st_size = fxdr_hyper(&nmp->nm_fattr.fa3_size);
buf->st_blksize = 0; buf->st_blksize = 0;
+1 -1
View File
@@ -543,7 +543,7 @@ int rpcclnt_reconnect(struct rpctask *);
void rpcclnt_disconnect(struct rpcclnt *); void rpcclnt_disconnect(struct rpcclnt *);
int rpcclnt_umount(struct rpcclnt *); int rpcclnt_umount(struct rpcclnt *);
void rpcclnt_safedisconnect(struct rpcclnt *); void rpcclnt_safedisconnect(struct rpcclnt *);
int rpcclnt_request(struct rpcclnt *, int, int, int, void *, FAR const void *); int rpcclnt_request(struct rpcclnt *, int, int, int, void *, FAR const void *, size_t);
#undef COMP #undef COMP
#ifdef COMP #ifdef COMP
int rpcclnt_cancelreqs(struct rpcclnt *); int rpcclnt_cancelreqs(struct rpcclnt *);
+133 -322
View File
@@ -207,8 +207,8 @@ static dq_queue_t rpctask_q;
static int rpcclnt_send(struct socket *, struct sockaddr *, int, int, void *, static int rpcclnt_send(struct socket *, struct sockaddr *, int, int, void *,
struct rpctask *); struct rpctask *);
static int rpcclnt_receive(struct rpctask *, struct sockaddr *, int, int, static int rpcclnt_receive(struct rpctask *, struct sockaddr *, int, int,
void *);//, struct rpc_call *); void *, size_t);//, struct rpc_call *);
static int rpcclnt_reply(struct rpctask *, int, int, void *); static int rpcclnt_reply(struct rpctask *, int, int, void *, size_t);
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
static int rpcclnt_sndlock(int *, struct rpctask *); static int rpcclnt_sndlock(int *, struct rpctask *);
static void rpcclnt_sndunlock(int *); static void rpcclnt_sndunlock(int *);
@@ -459,17 +459,20 @@ rpcclnt_send(struct socket *so, struct sockaddr *nam, int procid, int prog,
*/ */
static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname, static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
int proc, int program, void *reply)//, struct rpc_call *call) int proc, int program, void *reply, size_t len)
//, struct rpc_call *call)
{ {
struct socket *so; struct socket *so;
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
uint32_t len; uint32_t len;
int sotype; int sotype;
#endif #endif
int error = 0; int ret = 0;
int rcvflg; int rcvflg;
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
int errval;
/* Set up arguments for soreceive() */ /* Set up arguments for soreceive() */
sotype = rep->r_rpcclnt->rc_sotype; sotype = rep->r_rpcclnt->rc_sotype;
@@ -486,6 +489,7 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
error = rpcclnt_sndlock(&rep->r_rpcclnt->rc_flag, rep); error = rpcclnt_sndlock(&rep->r_rpcclnt->rc_flag, rep);
if (error != 0) if (error != 0)
{ {
fdbg("ERROR: rpcclnt_sndlock failed: %d\n", error);
return error; return error;
} }
@@ -536,6 +540,7 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
rpcclnt_sndunlock(&rep->r_rpcclnt->rc_flag); rpcclnt_sndunlock(&rep->r_rpcclnt->rc_flag);
if (sotype == SOCK_STREAM) if (sotype == SOCK_STREAM)
{ {
errval = 0;
do do
{ {
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name) socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name)
@@ -543,16 +548,21 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
error = psock_recvfrom(so, reply, sizeof(*reply), error = psock_recvfrom(so, reply, sizeof(*reply),
&rcvflg, rep->r_rpcclnt->rc_name, &rcvflg, rep->r_rpcclnt->rc_name,
&fromlen); &fromlen);
if (error == EWOULDBLOCK && rep && (rep->r_flags & TASK_SOFTTERM)) if (error < 0)
{ {
RPC_RETURN(EINTR); errval = errno;
if (errval == EWOULDBLOCK && rep &&
(rep->r_flags & TASK_SOFTTERM))
{
RPC_RETURN(EINTR);
}
} }
} }
while (error == EWOULDBLOCK); while (errval == EWOULDBLOCK);
if (error == 0) if (error == 0)
{ {
fdbg("short receive from rpc server %s\n", fdbg("ERROR: Short receive from rpc server %s\n",
rep->r_rpcclnt->rc_prog->prog_name); rep->r_rpcclnt->rc_prog->prog_name);
error = EPIPE; error = EPIPE;
} }
@@ -566,12 +576,14 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
if (len > RPC_MAXPACKET) if (len > RPC_MAXPACKET)
{ {
fdbg("%s (%d) from rpc server %s\n", fdbg("ERROR %s (%d) from rpc server %s\n",
"impossible packet length", "impossible packet length",
len, rep->r_rpcclnt->rc_prog->prog_name); len, rep->r_rpcclnt->rc_prog->prog_name);
error = EFBIG; error = EFBIG;
goto errout; goto errout;
} }
errval = 0
do do
{ {
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name); socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name);
@@ -579,17 +591,22 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
error = psock_recvfrom(so, reply, sizeof(*reply), error = psock_recvfrom(so, reply, sizeof(*reply),
&rcvflg, rep->r_rpcclnt->rc_name, &rcvflg, rep->r_rpcclnt->rc_name,
&fromlen); &fromlen);
if (error < 0)
{
errval = errno;
fdbg("ERROR: psock_recvfrom failed: %d\n", errval);
}
} }
while (error == EWOULDBLOCK || error == EINTR || error == ERESTART); while (errval == EWOULDBLOCK || errval == EINTR || errval == ERESTART);
if (error == 0) if (error == 0)
{ {
fdbg("short receive from rpc server %s\n", fdbg("ERROR: Short receive from rpc server %s\n",
rep->r_rpcclnt->rc_prog->prog_name); rep->r_rpcclnt->rc_prog->prog_name);
error = EPIPE; error = EPIPE;
} }
if (error != 0) if (error < 0)
{ {
goto errout; goto errout;
} }
@@ -603,6 +620,7 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
* them away so we know what is going on. * them away so we know what is going on.
*/ */
errval = 0;
do do
{ {
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name); socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name);
@@ -611,13 +629,15 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
rep->r_rpcclnt->rc_name, &fromlen); rep->r_rpcclnt->rc_name, &fromlen);
if (error == EWOULDBLOCK && rep) if (error == EWOULDBLOCK && rep)
{ {
errval = errno;
fdbg("ERROR: psock_recvfrom failed: %d\n", errval);
if (rep->r_flags & TASK_SOFTTERM) if (rep->r_flags & TASK_SOFTTERM)
{ {
return EINTR; return EINTR;
} }
} }
} }
while (error == EWOULDBLOCK || (!error)); while (errval == EWOULDBLOCK || !error);
if ((rcvflg & MSG_EOR) == 0) if ((rcvflg & MSG_EOR) == 0)
{ {
@@ -635,7 +655,7 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
{ {
if (error != EPIPE) if (error != EPIPE)
{ {
fdbg("receive error %d from rpc server %s\n", fdbg("ERROR: Receive error %d from rpc server %s\n",
error, rep->r_rpcclnt->rc_prog->prog_name); error, rep->r_rpcclnt->rc_prog->prog_name);
} }
@@ -660,147 +680,17 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
RPC_RETURN(EACCES); RPC_RETURN(EACCES);
} }
socklen_t fromlen = sizeof(*aname); socklen_t fromlen = sizeof(struct sockaddr);
rcvflg = 0; rcvflg = 0;
ret = psock_recvfrom(so, reply, len, rcvflg, aname, &fromlen);
if (program == PMAPPROG) if (ret > 0)
{ {
if (proc == PMAPPROC_GETPORT) RPC_RETURN(ret);
{
struct rpc_reply_pmap *replymsg = (struct rpc_reply_pmap *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
else if (proc == PMAPPROC_UNSET)
{
struct rpc_reply_pmap *replymsg = (struct rpc_reply_pmap *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
}
else if (program == RPCPROG_MNT)
{
if (proc== RPCMNT_UMOUNT)
{
struct rpc_reply_mount *replymsg = (struct rpc_reply_mount *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
else if (proc == RPCMNT_MOUNT)
{
struct rpc_reply_mount *replymsg = (struct rpc_reply_mount *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
}
else if (program == NFS_PROG)
{
switch (proc)
{
case NFSPROC_CREATE:
{
struct rpc_reply_create *replymsg = (struct rpc_reply_create *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_READ:
{
struct rpc_reply_read *replymsg = (struct rpc_reply_read *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_WRITE:
{
struct rpc_reply_write *replymsg = (struct rpc_reply_write *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_READDIR:
{
struct rpc_reply_readdir *replymsg = (struct rpc_reply_readdir *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_FSSTAT:
{
struct rpc_reply_fsstat *replymsg = (struct rpc_reply_fsstat *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_GETATTR:
{
struct rpc_reply_getattr *replymsg = (struct rpc_reply_getattr *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_REMOVE:
{
struct rpc_reply_remove *replymsg = (struct rpc_reply_remove *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_MKDIR:
{
struct rpc_reply_mkdir *replymsg = (struct rpc_reply_mkdir *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_RMDIR:
{
struct rpc_reply_rmdir *replymsg = (struct rpc_reply_rmdir *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_RENAME:
{
struct rpc_reply_rename *replymsg = (struct rpc_reply_rename *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
case NFSPROC_FSINFO:
{
struct rpc_reply_fsinfo *replymsg = (struct rpc_reply_fsinfo *)reply;
error = psock_recvfrom(so, replymsg, sizeof(*replymsg), rcvflg,
aname, &fromlen);
}
break;
default:
break;
}
}
fvdbg("psock_recvfrom returns %d\n", error);
if (error > 0)
{
RPC_RETURN(0);
} }
} }
RPC_RETURN(ENONET); fvdbg("Returning %d\n", ret);
RPC_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
@@ -808,7 +698,7 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
* until ours is found. * until ours is found.
*/ */
static int rpcclnt_reply(struct rpctask *myrep, int procid, int prog, void *reply) static int rpcclnt_reply(struct rpctask *myrep, int procid, int prog, void *reply, size_t len)
{ {
struct rpctask *rep; struct rpctask *rep;
struct rpc_reply_header replyheader; struct rpc_reply_header replyheader;
@@ -837,7 +727,7 @@ static int rpcclnt_reply(struct rpctask *myrep, int procid, int prog, void *repl
#endif #endif
/* Get the next Rpc reply off the socket */ /* Get the next Rpc reply off the socket */
error = rpcclnt_receive(myrep, rpc->rc_name, procid, prog, reply); error = rpcclnt_receive(myrep, rpc->rc_name, procid, prog, reply, len);
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
rpcclnt_rcvunlock(&rpc->rc_flag); rpcclnt_rcvunlock(&rpc->rc_flag);
#endif #endif
@@ -1173,7 +1063,6 @@ void rpcclnt_init(void)
//rpcclnt_timer(NULL, callmgs); //rpcclnt_timer(NULL, callmgs);
fvdbg("rpc initialized\n"); fvdbg("rpc initialized\n");
return;
} }
/* /*
@@ -1202,6 +1091,9 @@ int rpcclnt_connect(struct rpcclnt *rpc)
struct rpc_reply_mount mdata; struct rpc_reply_mount mdata;
struct timeval tv; struct timeval tv;
uint16_t tport; uint16_t tport;
int errval;
fvdbg("Connecting\n");
/* Create the socket */ /* Create the socket */
@@ -1213,32 +1105,35 @@ int rpcclnt_connect(struct rpcclnt *rpc)
so = (struct socket *)kzalloc(sizeof(struct socket)); so = (struct socket *)kzalloc(sizeof(struct socket));
if (!so) if (!so)
{ {
fdbg("Failed to allocate socket structure\n"); fdbg("ERROR: Failed to allocate socket structure\n");
return -ENOMEM; return -ENOMEM;
} }
error = psock_socket(saddr->sa_family, rpc->rc_sotype, rpc->rc_soproto, so); error = psock_socket(saddr->sa_family, rpc->rc_sotype, rpc->rc_soproto, so);
if (error != 0) if (error < 0)
{ {
fdbg("error %d in psock_socket()", error); errval = errno;
fdbg("ERROR: psock_socket failed: %d", errval);
RPC_RETURN(error); RPC_RETURN(error);
} }
so->s_crefs = 1; so->s_crefs = 1;
rpc->rc_so = so; rpc->rc_so = so;
rpc->rc_soflags = so->s_flags; rpc->rc_soflags = so->s_flags;
/* Always set receive timeout to detect server crash and reconnect. /* Always set receive timeout to detect server crash and reconnect.
* 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;
error = psock_setsockopt(rpc->rc_so, SOL_SOCKET, SO_RCVTIMEO, error = psock_setsockopt(rpc->rc_so, SOL_SOCKET, SO_RCVTIMEO,
(const void *)&tv, sizeof(tv)); (const void *)&tv, sizeof(tv));
if (error != 0) if (error < 0)
{ {
errval = errno;
fdbg("ERROR: psock_setsockopt failed: %d\n", errval);
goto bad; goto bad;
} }
@@ -1247,21 +1142,27 @@ 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;
errval = 0;
do do
{ {
tport--; tport--;
sin.sin_port = htons(tport); sin.sin_port = htons(tport);
error = psock_bind(rpc->rc_so, (struct sockaddr *)&sin, sizeof(sin)); error = psock_bind(rpc->rc_so, (struct sockaddr *)&sin, sizeof(sin));
if (error < 0)
{
errval = errno;
fdbg("ERROR: psock_bind failed: %d\n", errval);
}
} }
while (error == EADDRINUSE && tport > 1024 / 2); while (errval == EADDRINUSE && tport > 1024 / 2);
if (error) if (error)
{ {
fdbg("bind failed\n"); fdbg("ERROR: psock_bind failed: %d\n", errval);
goto bad; goto bad;
} }
@@ -1280,10 +1181,10 @@ int rpcclnt_connect(struct rpcclnt *rpc)
#endif #endif
{ {
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr)); error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
if (error < 0)
if (error)
{ {
fdbg("psock_connect to PMAP port returns %d", error); errval = errno;
fdbg("ERROR: psock_connect to PMAP port failed: %d", errval);
goto bad; goto bad;
} }
@@ -1291,17 +1192,19 @@ int rpcclnt_connect(struct rpcclnt *rpc)
* Get port number for MOUNTD. * Get port number for MOUNTD.
*/ */
memset(&sdata, 0, sizeof(sdata)); memset(&sdata, 0, sizeof(struct call_args_pmap));
memset(&rdata, 0, sizeof(rdata)); memset(&rdata, 0, sizeof(struct rpc_reply_pmap));
sdata.prog = txdr_unsigned(RPCPROG_MNT); sdata.prog = txdr_unsigned(RPCPROG_MNT);
sdata.vers = txdr_unsigned(RPCMNT_VER1); sdata.vers = txdr_unsigned(RPCMNT_VER1);
sdata.proc = txdr_unsigned(IPPROTO_UDP); sdata.proc = txdr_unsigned(IPPROTO_UDP);
sdata.port = 0; sdata.port = 0;
error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS, error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS,
(FAR void *)&rdata, (FAR const void *)&sdata); (FAR void *)&rdata, (FAR const void *)&sdata,
sizeof(struct rpc_reply_pmap));
if (error != 0) if (error != 0)
{ {
fdbg("ERROR: rpcclnt_request failed: %d\n", error);
goto bad; goto bad;
} }
@@ -1309,47 +1212,51 @@ int rpcclnt_connect(struct rpcclnt *rpc)
sa->sin_port = htons(fxdr_unsigned(uint32_t, rdata.pmap.port)); sa->sin_port = htons(fxdr_unsigned(uint32_t, rdata.pmap.port));
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr)); error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
if (error) if (error < 0)
{ {
fdbg("psock_connect MOUNTD port returns %d\n", error); errval = errno;
fdbg("ERROR: psock_connect MOUNTD port failed: %d\n", errval);
goto bad; goto bad;
} }
/* Do RPC to mountd. */ /* Do RPC to mountd. */
memset(&mountd, 0, sizeof(mountd)); memset(&mountd, 0, sizeof(struct call_args_mount));
memset(&mdata, 0, sizeof(mdata)); memset(&mdata, 0, sizeof(struct rpc_reply_mount));
strncpy(mountd.rpath, rpc->rc_path, 90); strncpy(mountd.rpath, rpc->rc_path, 90);
mountd.len = txdr_unsigned(sizeof(mountd.rpath)); mountd.len = txdr_unsigned(sizeof(mountd.rpath));
error = rpcclnt_request(rpc, RPCMNT_MOUNT, RPCPROG_MNT, RPCMNT_VER1, error = rpcclnt_request(rpc, RPCMNT_MOUNT, RPCPROG_MNT, RPCMNT_VER1,
(FAR void *)&mdata, (FAR const void *)&mountd); (FAR void *)&mdata, (FAR const void *)&mountd,
sizeof(struct rpc_reply_mount));
if (error != 0) if (error != 0)
{ {
fdbg("ERROR: rpcclnt_request failed: %d\n", error);
goto bad; goto bad;
} }
error = fxdr_unsigned(uint32_t, mdata.mount.status); error = fxdr_unsigned(uint32_t, mdata.mount.status);
if (error != 0) if (error != 0)
{ {
fdbg("error mounting with the server %d\n", error); fdbg("ERROR: fxdr_unsigned failed: %d\n", error);
goto bad; goto bad;
} }
rpc->rc_fh = mdata.mount.fhandle; bcopy(&mdata.mount.fhandle, &rpc->rc_fh, sizeof(nfsfh_t));
/* Do the RPC to get a dynamic bounding with the server using PMAP. /* Do the RPC to get a dynamic bounding with the server using PMAP.
* NFS port in the socket. * NFS port in the socket.
*/ */
memset(&sdata, 0, sizeof(sdata)); memset(&sdata, 0, sizeof(struct call_args_pmap));
memset(&rdata, 0, sizeof(rdata)); memset(&rdata, 0, sizeof(struct rpc_reply_pmap));
sa->sin_port = htons(PMAPPORT); sa->sin_port = htons(PMAPPORT);
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr)); error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
if (error) if (error < 0)
{ {
fdbg("psock_connect PMAP port returns %d\n", error); errval = errno;
fdbg("ERROR: psock_connect PMAP port failed: %d\n", errval);
goto bad; goto bad;
} }
@@ -1359,9 +1266,11 @@ int rpcclnt_connect(struct rpcclnt *rpc)
sdata.port = 0; sdata.port = 0;
error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS, error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS,
(FAR void *)&rdata, (FAR const void *)&sdata); (FAR void *)&rdata, (FAR const void *)&sdata,
sizeof(struct rpc_reply_pmap));
if (error != 0) if (error != 0)
{ {
fdbg("ERROR: rpcclnt_request failed: %d\n", error);
goto bad; goto bad;
} }
@@ -1383,6 +1292,7 @@ int rpcclnt_connect(struct rpcclnt *rpc)
rpc->rc_sent = 0; rpc->rc_sent = 0;
rpc->rc_timeouts = 0; rpc->rc_timeouts = 0;
fvdbg("Succeeded\n");
RPC_RETURN(0); RPC_RETURN(0);
bad: bad:
@@ -1405,13 +1315,19 @@ int rpcclnt_reconnect(struct rpctask *rep)
int error; int error;
rpcclnt_disconnect(rpc); rpcclnt_disconnect(rpc);
while ((error = rpcclnt_connect(rpc)) != 0) do
{ {
if (error == EINTR || error == ERESTART) error = rpcclnt_connect(rpc);
if (error != 0)
{ {
return EINTR; fdbg("ERROR: rpcclnt_connect failed: %d\n", error);
if (error == EINTR || error == ERESTART)
{
return EINTR;
}
} }
} }
while (error != 0)
/* Loop through outstanding request list and fix up all /* Loop through outstanding request list and fix up all
* requests on old socket. * requests on old socket.
@@ -1458,8 +1374,8 @@ int rpcclnt_umount(struct rpcclnt *rpc)
* Get port number for MOUNTD. * Get port number for MOUNTD.
*/ */
memset(&sdata, 0, sizeof(sdata)); memset(&sdata, 0, sizeof(struct call_args_pmap));
memset(&rdata, 0, sizeof(rdata)); memset(&rdata, 0, sizeof(struct rpc_reply_pmap));
sa->sin_port = htons(PMAPPORT); sa->sin_port = htons(PMAPPORT);
error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr)); error = psock_connect(rpc->rc_so, saddr, sizeof(*saddr));
@@ -1475,7 +1391,8 @@ int rpcclnt_umount(struct rpcclnt *rpc)
sdata.port = 0; sdata.port = 0;
error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS, error = rpcclnt_request(rpc, PMAPPROC_GETPORT, PMAPPROG, PMAPVERS,
(void *)&rdata, (FAR const void *)&sdata); (void *)&rdata, (FAR const void *)&sdata,
sizeof(struct rpc_reply_pmap));
if (error != 0) if (error != 0)
{ {
goto bad; goto bad;
@@ -1492,14 +1409,15 @@ int rpcclnt_umount(struct rpcclnt *rpc)
/* Do RPC to umountd. */ /* Do RPC to umountd. */
memset(&mountd, 0, sizeof(mountd)); memset(&mountd, 0, sizeof(struct call_args_mount));
memset(&mdata, 0, sizeof(mdata)); memset(&mdata, 0, sizeof(struct rpc_reply_mount));
strncpy(mountd.rpath, rpc->rc_path, 92); strncpy(mountd.rpath, rpc->rc_path, 92);
mountd.len = txdr_unsigned(sizeof(mountd.rpath)); mountd.len = txdr_unsigned(sizeof(mountd.rpath));
error = rpcclnt_request(rpc, RPCMNT_UMOUNT, RPCPROG_MNT, RPCMNT_VER1, error = rpcclnt_request(rpc, RPCMNT_UMOUNT, RPCPROG_MNT, RPCMNT_VER1,
(void *)&mdata, (FAR const void *)&mountd); (void *)&mdata, (FAR const void *)&mountd,
sizeof(struct rpc_reply_mount));
if (error != 0) if (error != 0)
{ {
goto bad; goto bad;
@@ -1542,155 +1460,48 @@ void rpcclnt_safedisconnect(struct rpcclnt *rpc)
*/ */
int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version, int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version,
void *dataout, FAR const void *datain) void *dataout, FAR const void *datain, size_t len)
{ {
struct rpc_reply_header replymgs; struct rpc_reply_header replymgs;
struct rpc_reply_header replyheader; struct rpc_reply_header replyheader;
struct rpctask *task = NULL; struct rpctask *task = NULL;
struct xidr value; struct xidr value;
struct rpc_call_pmap pmap;
struct rpc_call_mount mountd;
struct rpc_call_create create;
struct rpc_call_write write;
struct rpc_call_read read;
struct rpc_call_remove removef;
struct rpc_call_rename renamef;
struct rpc_call_mkdir mkdir;
struct rpc_call_rmdir rmdir;
struct rpc_call_readdir readdir;
struct rpc_call_fs fs;
void *msgcall = NULL;
int error = 0; int error = 0;
/* Set aside memory on the stack to hold the largest call message */
if (prog == PMAPPROG) union
{ {
if (procnum == PMAPPROC_GETPORT) struct rpc_call_pmap pmap;
{ struct rpc_call_mount mountd;
memset(&pmap, 0, sizeof(struct rpc_call_pmap)); struct rpc_call_create create;
msgcall = &pmap; struct rpc_call_write write;
} struct rpc_call_read read;
else if (procnum == PMAPPROC_UNSET) struct rpc_call_remove removef;
{ struct rpc_call_rename renamef;
memset(&pmap, 0, sizeof(struct rpc_call_pmap)); struct rpc_call_mkdir mkdir;
msgcall = &pmap; struct rpc_call_rmdir rmdir;
} struct rpc_call_readdir readdir;
} struct rpc_call_fs fs;
else if (prog == RPCPROG_MNT) } u;
{
if (procnum == RPCMNT_UMOUNT)
{
memset(&mountd, 0, sizeof(struct rpc_call_mount));
msgcall = &mountd;
}
else if (procnum == RPCMNT_MOUNT)
{
memset(&mountd, 0, sizeof(struct rpc_call_mount));
msgcall = &mountd;
}
}
else if (prog == NFS_PROG)
{
switch (procnum)
{
case NFSPROC_CREATE:
{
memset(&create, 0, sizeof(struct rpc_call_create));
msgcall = &create;
}
break;
case NFSPROC_READ: /* Clear the call message memory */
{
memset(&read, 0, sizeof(struct rpc_call_read));
msgcall = &read;
}
break;
case NFSPROC_WRITE: memset(&u, 0, sizeof(u));
{
memset(&write, 0, sizeof(struct rpc_call_write));
msgcall = &write;
}
break;
case NFSPROC_RENAME:
{
memset(&renamef, 0, sizeof(struct rpc_call_rename));
msgcall = &renamef;
}
break;
case NFSPROC_REMOVE:
{
memset(&removef, 0, sizeof(struct rpc_call_remove));
msgcall = &removef;
}
break;
case NFSPROC_MKDIR:
{
memset(&mkdir, 0, sizeof(struct rpc_call_mkdir));
msgcall = &mkdir;
}
break;
case NFSPROC_RMDIR:
{
memset(&rmdir, 0, sizeof(struct rpc_call_rmdir));
msgcall = &rmdir;
}
break;
case NFSPROC_READDIR:
{
memset(&readdir, 0, sizeof(struct rpc_call_readdir));
msgcall = &readdir;
}
break;
case NFSPROC_FSSTAT:
{
memset(&fs, 0, sizeof(struct rpc_call_fs));
msgcall = &fs;
}
break;
case NFSPROC_GETATTR:
{
memset(&fs, 0, sizeof(struct rpc_call_fs));
msgcall = &fs;
}
break;
case NFSPROC_FSINFO:
{
memset(&fs, 0, sizeof(struct rpc_call_fs));
msgcall = &fs;
}
break;
default:
{
error = ESRCH;
goto rpcmout;
}
}
}
/* Create an instance of the task state structure */ /* Create an instance of the task state structure */
task = (struct rpctask *)kzalloc(sizeof(struct rpctask)); task = (struct rpctask *)kzalloc(sizeof(struct rpctask));
if (!task) if (!task)
{ {
fdbg("Failed to allocate reply msg structure\n"); fdbg("ERROR: Failed to allocate reply msg structure\n");
return -ENOMEM; return -ENOMEM;
} }
error = rpcclnt_buildheader(rpc, procnum, prog, version, &value, datain, msgcall); error = rpcclnt_buildheader(rpc, procnum, prog, version, &value, datain, (FAR void*)&u);
if (error) if (error)
{ {
fdbg("building call header error"); fdbg("ERROR: Building call header error");
goto rpcmout; goto rpcmout;
} }
@@ -1746,7 +1557,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version,
if (error == 0) if (error == 0)
{ {
error = rpcclnt_send(rpc->rc_so, rpc->rc_name, procnum, prog, error = rpcclnt_send(rpc->rc_so, rpc->rc_name, procnum, prog,
msgcall, task); (FAR void*)&u, task);
#ifdef CONFIG_NFS_TCPIP #ifdef CONFIG_NFS_TCPIP
if (rpc->rc_soflags & PR_CONNREQUIRED) if (rpc->rc_soflags & PR_CONNREQUIRED)
@@ -1771,7 +1582,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, int prog, int version,
if (error == 0 || error == EPIPE) if (error == 0 || error == EPIPE)
{ {
error = rpcclnt_reply(task, procnum, prog, dataout); error = rpcclnt_reply(task, procnum, prog, dataout, len);
} }
fvdbg("out for reply %d\n", error); fvdbg("out for reply %d\n", error);
@@ -1961,7 +1772,7 @@ void rpcclnt_timer(void *arg, struct rpc_call *call)
sizeof(*rpc->rc_name)); sizeof(*rpc->rc_name));
} }
if (!error) if (error < 0)
{ {
/* Iff first send, start timing else turn /* Iff first send, start timing else turn
* timing off, backoff timer and divide * timing off, backoff timer and divide
+13 -13
View File
@@ -63,26 +63,26 @@
struct nfs_args struct nfs_args
{ {
uint8_t version; /* args structure version number */ uint8_t version; /* Args structure version number */
struct sockaddr addr; /* file server address */ uint8_t addrlen; /* Length of address */
uint8_t addrlen; /* length of address */
uint8_t sotype; /* Socket type */ uint8_t sotype; /* Socket type */
uint8_t proto; /* and Protocol */ uint8_t proto; /* and Protocol */
int flags; /* flags */ int flags; /* Flags */
int wsize; /* write size in bytes */ int wsize; /* Write size in bytes */
int rsize; /* read size in bytes */ int rsize; /* Read size in bytes */
int readdirsize; /* readdir size in bytes */ int readdirsize; /* readdir size in bytes */
int timeo; /* initial timeout in .1 secs */ int timeo; /* Initial timeout in .1 secs */
int retrans; /* times to retry send */ int retrans; /* Times to retry send */
//int maxgrouplist; /* Max. size of group list */ //int maxgrouplist; /* Max. size of group list */
//int readahead; /* # of blocks to readahead */ //int readahead; /* # of blocks to readahead */
//int leaseterm; /* Term (sec) of lease */ //int leaseterm; /* Term (sec) of lease */
//int deadthresh; /* Retrans threshold */ //int deadthresh; /* Retrans threshold */
char *path; /* server's path of the directory being mount */ char *path; /* Server's path of the directory being mount */
int acregmin; /* cache attrs for reg files min time */ int acregmin; /* Cache attrs for reg files min time */
int acregmax; /* cache attrs for reg files max time */ int acregmax; /* Cache attrs for reg files max time */
int acdirmin; /* cache attrs for dirs min time */ int acdirmin; /* Cache attrs for dirs min time */
int acdirmax; /* cache attrs for dirs max time */ int acdirmax; /* Cache attrs for dirs max time */
struct sockaddr addr; /* File server address (requires 32-bit alignment) */
}; };
/**************************************************************************** /****************************************************************************