summaryrefslogtreecommitdiff
path: root/nuttx/fs/nfs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-02 23:40:11 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-05-02 23:40:11 +0000
commitef2146db54a82adb1b61de2f4abbc38ef2ff98ad (patch)
treecbf54dd4779413894555ddb82b41f34fc499ef2f /nuttx/fs/nfs
parent4b489525b44d49fa0f8cb95733dd0fdf4553c884 (diff)
downloadpx4-nuttx-ef2146db54a82adb1b61de2f4abbc38ef2ff98ad.tar.gz
px4-nuttx-ef2146db54a82adb1b61de2f4abbc38ef2ff98ad.tar.bz2
px4-nuttx-ef2146db54a82adb1b61de2f4abbc38ef2ff98ad.zip
NFS update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4690 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nfs')
-rw-r--r--nuttx/fs/nfs/nfs_vfsops.c39
-rw-r--r--nuttx/fs/nfs/rpc.h4
-rw-r--r--nuttx/fs/nfs/rpc_clnt.c18
3 files changed, 44 insertions, 17 deletions
diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c
index bdd388ec6..ae5ef8585 100644
--- a/nuttx/fs/nfs/nfs_vfsops.c
+++ b/nuttx/fs/nfs/nfs_vfsops.c
@@ -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:
diff --git a/nuttx/fs/nfs/rpc.h b/nuttx/fs/nfs/rpc.h
index 00f2ef47b..fe93a6e4d 100644
--- a/nuttx/fs/nfs/rpc.h
+++ b/nuttx/fs/nfs/rpc.h
@@ -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 */
diff --git a/nuttx/fs/nfs/rpc_clnt.c b/nuttx/fs/nfs/rpc_clnt.c
index cbd1c8941..2515c1707 100644
--- a/nuttx/fs/nfs/rpc_clnt.c
+++ b/nuttx/fs/nfs/rpc_clnt.c
@@ -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))
{