NFS update

git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4690 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
patacongo 2012-05-02 23:40:11 +00:00
parent 2b6180f48e
commit 8f002594f7
3 changed files with 44 additions and 17 deletions

View File

@ -1336,7 +1336,7 @@ errout_with_semaphore:
static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
{
struct nfs_fattr vap;
struct nfs_fattr *vap;
struct nfsv3_sattr sp;
struct nfsmount *nmp;
struct nfsnode *np;
@ -1352,8 +1352,30 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
/* Get the mountpoint private data from the inode structure */
nmp = (struct nfsmount*) mountpt->i_private;
np = nmp->nm_head;
vap = np->n_fattr;
/* Create an instance of the private data to describe the opened
* file.
*/
np = (struct nfsnode*)kzalloc(sizeof(struct nfsnode));
if (!np)
{
fdbg("Failed to allocate private data\n", error);
error = -ENOMEM;
goto errout_with_semaphore;
}
/* Create an instance of the private data to describe the opened
* file.
*/
vap = (struct nfs_fattr*)kzalloc(sizeof(struct nfs_fattr));
if (!vap)
{
fdbg("Failed to allocate private data\n", error);
error = -ENOMEM;
goto errout_with_semaphore;
}
/* Check if the mount is still healthy */
@ -1369,15 +1391,15 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
mkir.where.name = relpath;
sp.sa_modetrue = nfs_true;
sp.sa_mode = txdr_unsigned(vap.fa_mode);
sp.sa_mode = txdr_unsigned(vap->fa_mode);
sp.sa_uidfalse = nfs_xdrneg1;
sp.sa_gidfalse = nfs_xdrneg1;
sp.sa_sizefalse = nfs_xdrneg1;
sp.sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
sp.sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
fxdr_nfsv3time2(&vap.fa3_atime, &sp.sa_atime);
fxdr_nfsv3time2(&vap.fa3_mtime, &sp.sa_mtime);
//fxdr_nfsv3time2(vap->fa3_atime, &sp.sa_atime);
//fxdr_nfsv3time2(vap->fa3_mtime, &sp.sa_mtime);
mkir.attributes = sp;
@ -1392,6 +1414,9 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
np->n_fhp = resok->handle;
np->n_fattr = resok->obj_attributes;
np->n_flag |= NMODIFIED;
nmp->nm_head = np;
NFS_INVALIDATE_ATTRCACHE(np);
errout_with_semaphore:

View File

@ -144,7 +144,7 @@ struct rpc_call
uint32_t rp_prog; /* program */
uint32_t rp_vers; /* version */
uint32_t rp_proc; /* procedure */
void *data;
unsigned char *data;
struct rpc_auth_info rpc_auth;
struct auth_unix rpc_unix;
struct rpc_auth_info rpc_verf;
@ -159,7 +159,7 @@ struct rpc_reply
uint32_t type;
uint32_t status;
void *where; /* Data */
unsigned char *where; /* Data */
/* used only when reply == RPC_MSGDENIED and status == RPC_AUTHERR */

View File

@ -418,10 +418,11 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
{
do
{
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name)
rcvflg = MSG_WAITALL;
error = psock_recvfrom(so, reply, sizeof(*reply),
&rcvflg, rep->r_rpcclnt->rc_name,
sizeof(*rep->r_rpcclnt->rc_name));
&fromlen);
if (error == EWOULDBLOCK && rep && (rep->r_flags & TASK_SOFTTERM))
{
RPC_RETURN(EINTR);
@ -453,10 +454,11 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
}
do
{
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name);
rcvflg = MSG_WAITALL;
error = psock_recvfrom(so, reply, sizeof(*reply),
&rcvflg, rep->r_rpcclnt->rc_name,
sizeof(*rep->r_rpcclnt->rc_name));
&fromlen);
}
while (error == EWOULDBLOCK || error == EINTR || error == ERESTART);
@ -483,10 +485,10 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
do
{
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name);
rcvflg = 0;
error = psock_recvfrom(so, reply, sizeof(*reply),
&rcvflg, rep->r_rpcclnt->rc_name,
sizeof(*rep->r_rpcclnt->rc_name));
error = psock_recvfrom(so, reply, sizeof(*reply), &rcvflg,
rep->r_rpcclnt->rc_name, &fromlen);
if (error == EWOULDBLOCK && rep)
{
if (rep->r_flags & TASK_SOFTTERM)
@ -540,10 +542,10 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
do
{
socklen_t fromlen = sizeof(*aname);
rcvflg = 0;
error =
psock_recvfrom(so, reply, sizeof(*reply), rcvflg, aname,
sizeof(aname));
error = psock_recvfrom(so, reply, sizeof(*reply), rcvflg,
aname, &fromlen);
dbg("psock_recvfrom returns %d", error);
if (error == EWOULDBLOCK && (rep->r_flags & TASK_SOFTTERM))
{