Browse Source

Cosmetic NFS update

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4812 7fd9a85b-ad96-42d3-883c-3090e2eb8679
sbg
patacongo 13 years ago
parent
commit
f21df2e6f5
  1. 88
      nuttx/fs/nfs/nfs_vfsops.c

88
nuttx/fs/nfs/nfs_vfsops.c

@ -704,9 +704,9 @@ errout_with_semaphore:
****************************************************************************/ ****************************************************************************/
int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np, int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np,
bool end_of_directory, struct fs_dirent_s *dir) bool eod, struct fs_dirent_s *dir)
{ {
struct READDIR3args readir; struct READDIR3args readdir;
struct rpc_reply_readdir resok; struct rpc_reply_readdir resok;
int error = 0; int error = 0;
@ -715,54 +715,66 @@ int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np,
* The stopping criteria is EOF. * The stopping criteria is EOF.
*/ */
while (end_of_directory == false) while (eod == false)
{ {
nfsstats.rpccnt[NFSPROC_READDIR]++; nfsstats.rpccnt[NFSPROC_READDIR]++;
memset(&readir, 0, sizeof(struct READDIR3args)); memset(&readdir, 0, sizeof(struct READDIR3args));
readir.dir.length = txdr_unsigned(np->n_fhsize); readdir.dir.length = txdr_unsigned(np->n_fhsize);
readir.dir.handle = np->n_fhp; readdir.dir.handle = np->n_fhp;
readir.count = nmp->nm_readdirsize; readdir.count = nmp->nm_readdirsize;
if (nfsstats.rpccnt[NFSPROC_READDIR] == 1) if (nfsstats.rpccnt[NFSPROC_READDIR] == 1)
{ {
readir.cookie.nfsuquad[0] = 0; readdir.cookie.nfsuquad[0] = 0;
readir.cookie.nfsuquad[1] = 0; readdir.cookie.nfsuquad[1] = 0;
readir.cookieverf.nfsuquad[0] = 0; readdir.cookieverf.nfsuquad[0] = 0;
readir.cookieverf.nfsuquad[1] = 0; readdir.cookieverf.nfsuquad[1] = 0;
} }
else else
{ {
readir.cookie.nfsuquad[0] = dir->u.nfs.cookie[0]; readdir.cookie.nfsuquad[0] = dir->u.nfs.cookie[0];
readir.cookie.nfsuquad[1] = dir->u.nfs.cookie[1]; readdir.cookie.nfsuquad[1] = dir->u.nfs.cookie[1];
readir.cookieverf.nfsuquad[0] = np->n_cookieverf.nfsuquad[0]; readdir.cookieverf.nfsuquad[0] = np->n_cookieverf.nfsuquad[0];
readir.cookieverf.nfsuquad[1] = np->n_cookieverf.nfsuquad[1]; readdir.cookieverf.nfsuquad[1] = np->n_cookieverf.nfsuquad[1];
} }
error = nfs_request(nmp, NFSPROC_READDIR, (FAR const void *)&readir, error = nfs_request(nmp, NFSPROC_READDIR, (FAR const void *)&readdir,
(FAR void *)&resok, sizeof(struct rpc_reply_readdir)); (FAR void *)&resok, sizeof(struct rpc_reply_readdir));
if (error) if (error)
{ {
goto nfsmout; goto nfsmout;
} }
//dir->fd_dir.d_name = resok->reply.entries->name;//
/*np->n_fattr = resok.readir.dir_attributes;
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.readir.reply.eof == true) #if 0
{ /* Save the node attributes and cooking information */
end_of_directory = true;
} np->n_fattr = resok.readdir.dir_attributes;
*/ np->n_cookieverf.nfsuquad[0] = resok.readdir.cookieverf.nfsuquad[0];
//more_dirs = fxdr_unsigned(int, *dp); np->n_cookieverf.nfsuquad[1] = resok.readdir.cookieverf.nfsuquad[1];
dir->u.nfs.cookie[0] = resok.readdir.reply.entries->cookie.nfsuquad[0];
dir->u.nfs.cookie[1] = resok.readdir.reply.entries->cookie.nfsuquad[1];
/* Return the Type of the node to the caller */
dir->fd_dir.d_type = resok.readdir.reply.entries->fileid;
#warning "This must match the type values in dirent.h"
/* Return the name of the node to the caller */
#warning "The name in the structure is only a char -- that won't work!"
strncpy(dir->fd_dir.d_name, resok.readdir.reply.entries->name, NAME_MAX);
dir->fd_dir.d_name[NAME_MAX] = '\0';
/* Check for the end of the directory listing */
eof = resok.readdir.reply.eof;
/* loop thru the dir entries */ /* loop thru the dir entries */
/* #warning "The result structure contains a pointer to the next entry -- that won't work!"
while (more_dirs && bigenough)
more = fxdr_unsigned(int, *dp);
while (more && bigenough)
{ {
if (bigenough) if (bigenough)
{ {
@ -778,16 +790,16 @@ int nfs_readdirrpc(struct nfsmount *nmp, struct nfsnode *np,
dir->u.nfs.cookie[1] = ndp->cookie[1] = cookie.nfsuquad[1]; dir->u.nfs.cookie[1] = ndp->cookie[1] = cookie.nfsuquad[1];
} }
more_dirs = fxdr_unsigned(int, *ndp); more = 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.readir.reply.entries == NULL) if (resok.readdir.reply.entries == NULL)
{ {
np->n_direofoffset = fxdr_hyper(&dir->u.nfs.cookie[0]);*/ np->n_direofoffset = fxdr_hyper(&dir->u.nfs.cookie[0]);
#endif
/* 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

Loading…
Cancel
Save