NFS update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4690 42af7a65-404d-4744-a932-0658087f49c3
This commit is contained in:
parent
2d4cd8d1a3
commit
89b58c0778
@ -1336,7 +1336,7 @@ errout_with_semaphore:
|
|||||||
|
|
||||||
static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode)
|
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 nfsv3_sattr sp;
|
||||||
struct nfsmount *nmp;
|
struct nfsmount *nmp;
|
||||||
struct nfsnode *np;
|
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 */
|
/* Get the mountpoint private data from the inode structure */
|
||||||
|
|
||||||
nmp = (struct nfsmount*) mountpt->i_private;
|
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 */
|
/* 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;
|
mkir.where.name = relpath;
|
||||||
|
|
||||||
sp.sa_modetrue = nfs_true;
|
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_uidfalse = nfs_xdrneg1;
|
||||||
sp.sa_gidfalse = nfs_xdrneg1;
|
sp.sa_gidfalse = nfs_xdrneg1;
|
||||||
sp.sa_sizefalse = nfs_xdrneg1;
|
sp.sa_sizefalse = nfs_xdrneg1;
|
||||||
sp.sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
sp.sa_atimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
||||||
sp.sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
sp.sa_mtimetype = txdr_unsigned(NFSV3SATTRTIME_TOCLIENT);
|
||||||
|
|
||||||
fxdr_nfsv3time2(&vap.fa3_atime, &sp.sa_atime);
|
//fxdr_nfsv3time2(vap->fa3_atime, &sp.sa_atime);
|
||||||
fxdr_nfsv3time2(&vap.fa3_mtime, &sp.sa_mtime);
|
//fxdr_nfsv3time2(vap->fa3_mtime, &sp.sa_mtime);
|
||||||
|
|
||||||
mkir.attributes = sp;
|
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_fhp = resok->handle;
|
||||||
np->n_fattr = resok->obj_attributes;
|
np->n_fattr = resok->obj_attributes;
|
||||||
np->n_flag |= NMODIFIED;
|
np->n_flag |= NMODIFIED;
|
||||||
|
|
||||||
|
nmp->nm_head = np;
|
||||||
|
|
||||||
NFS_INVALIDATE_ATTRCACHE(np);
|
NFS_INVALIDATE_ATTRCACHE(np);
|
||||||
|
|
||||||
errout_with_semaphore:
|
errout_with_semaphore:
|
||||||
|
@ -144,7 +144,7 @@ struct rpc_call
|
|||||||
uint32_t rp_prog; /* program */
|
uint32_t rp_prog; /* program */
|
||||||
uint32_t rp_vers; /* version */
|
uint32_t rp_vers; /* version */
|
||||||
uint32_t rp_proc; /* procedure */
|
uint32_t rp_proc; /* procedure */
|
||||||
void *data;
|
unsigned char *data;
|
||||||
struct rpc_auth_info rpc_auth;
|
struct rpc_auth_info rpc_auth;
|
||||||
struct auth_unix rpc_unix;
|
struct auth_unix rpc_unix;
|
||||||
struct rpc_auth_info rpc_verf;
|
struct rpc_auth_info rpc_verf;
|
||||||
@ -159,7 +159,7 @@ struct rpc_reply
|
|||||||
uint32_t type;
|
uint32_t type;
|
||||||
uint32_t status;
|
uint32_t status;
|
||||||
|
|
||||||
void *where; /* Data */
|
unsigned char *where; /* Data */
|
||||||
|
|
||||||
/* used only when reply == RPC_MSGDENIED and status == RPC_AUTHERR */
|
/* used only when reply == RPC_MSGDENIED and status == RPC_AUTHERR */
|
||||||
|
|
||||||
|
@ -418,10 +418,11 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
|
|||||||
{
|
{
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name)
|
||||||
rcvflg = MSG_WAITALL;
|
rcvflg = MSG_WAITALL;
|
||||||
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,
|
||||||
sizeof(*rep->r_rpcclnt->rc_name));
|
&fromlen);
|
||||||
if (error == EWOULDBLOCK && rep && (rep->r_flags & TASK_SOFTTERM))
|
if (error == EWOULDBLOCK && rep && (rep->r_flags & TASK_SOFTTERM))
|
||||||
{
|
{
|
||||||
RPC_RETURN(EINTR);
|
RPC_RETURN(EINTR);
|
||||||
@ -453,10 +454,11 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
|
|||||||
}
|
}
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name);
|
||||||
rcvflg = MSG_WAITALL;
|
rcvflg = MSG_WAITALL;
|
||||||
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,
|
||||||
sizeof(*rep->r_rpcclnt->rc_name));
|
&fromlen);
|
||||||
}
|
}
|
||||||
while (error == EWOULDBLOCK || error == EINTR || error == ERESTART);
|
while (error == EWOULDBLOCK || error == EINTR || error == ERESTART);
|
||||||
|
|
||||||
@ -483,10 +485,10 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
socklen_t fromlen = sizeof(*rep->r_rpcclnt->rc_name);
|
||||||
rcvflg = 0;
|
rcvflg = 0;
|
||||||
error = psock_recvfrom(so, reply, sizeof(*reply),
|
error = psock_recvfrom(so, reply, sizeof(*reply), &rcvflg,
|
||||||
&rcvflg, rep->r_rpcclnt->rc_name,
|
rep->r_rpcclnt->rc_name, &fromlen);
|
||||||
sizeof(*rep->r_rpcclnt->rc_name));
|
|
||||||
if (error == EWOULDBLOCK && rep)
|
if (error == EWOULDBLOCK && rep)
|
||||||
{
|
{
|
||||||
if (rep->r_flags & TASK_SOFTTERM)
|
if (rep->r_flags & TASK_SOFTTERM)
|
||||||
@ -540,10 +542,10 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
|
|||||||
|
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
|
socklen_t fromlen = sizeof(*aname);
|
||||||
rcvflg = 0;
|
rcvflg = 0;
|
||||||
error =
|
error = psock_recvfrom(so, reply, sizeof(*reply), rcvflg,
|
||||||
psock_recvfrom(so, reply, sizeof(*reply), rcvflg, aname,
|
aname, &fromlen);
|
||||||
sizeof(aname));
|
|
||||||
dbg("psock_recvfrom returns %d", error);
|
dbg("psock_recvfrom returns %d", error);
|
||||||
if (error == EWOULDBLOCK && (rep->r_flags & TASK_SOFTTERM))
|
if (error == EWOULDBLOCK && (rep->r_flags & TASK_SOFTTERM))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user