From 9aec5418015792440adfccfcec6341738aef8659 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 11 Jun 2012 23:51:39 +0000 Subject: [PATCH] NFS update git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4831 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/fs/nfs/nfs_vfsops.c | 49 ++++++++++++++------------------------- 1 file changed, 18 insertions(+), 31 deletions(-) diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index 6d78a2cec0..5bb6f188fe 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -282,35 +282,28 @@ static int nfs_filecreate(FAR struct nfsmount *nmp, struct nfsnode *np, /* Set the user ID to zero */ - *ptr++ = nfs_true; /* True: Uid value follows */ - reqlen += sizeof(uint32_t); - - *ptr++ = 0; - reqlen += sizeof(uint32_t); + *ptr++ = nfs_true; /* True: Uid value follows */ + *ptr++ = 0; /* UID = 0 (nobody) */ + reqlen += 2*sizeof(uint32_t); /* Set the group ID to one */ - *ptr++ = nfs_true; /* True: Gid value follows */ - reqlen += sizeof(uint32_t); - - *ptr++ = HTONL(1); - reqlen += sizeof(uint32_t); + *ptr++ = nfs_true; /* True: Gid value follows */ + *ptr++ = HTONL(1); /* GID = 1 (nogroup) */ + reqlen += 2*sizeof(uint32_t); /* Set the size to zero */ - *ptr++ = nfs_true; /* True: Size value follows */ - reqlen += sizeof(uint32_t); - + *ptr++ = nfs_true; /* True: Size value follows */ + *ptr++ = 0; /* Size = 0 */ *ptr++ = 0; - reqlen += sizeof(uint32_t); + reqlen += 3*sizeof(uint32_t); /* Don't change times */ *ptr++ = HTONL(NFSV3SATTRTIME_DONTCHANGE); /* Don't change atime */ - reqlen += sizeof(uint32_t); - *ptr++ = HTONL(NFSV3SATTRTIME_DONTCHANGE); /* Don't change mtime */ - reqlen += sizeof(uint32_t); + reqlen += 2*sizeof(uint32_t); } /* Send the NFS request. Note there is special logic here to handle version 3 @@ -936,7 +929,7 @@ static ssize_t nfs_write(FAR struct file *filep, const char *buffer, /* Copy the file offset */ txdr_hyper((uint64_t)filep->f_pos, ptr); - ptr += 2; + ptr += 2; reqlen += 2*sizeof(uint32_t); /* Copy the count and stable values */ @@ -2082,19 +2075,15 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode) /* Set the user ID to zero */ - *ptr++ = nfs_true; /* True: Uid value follows */ - reqlen += sizeof(uint32_t); - - *ptr++ = 0; - reqlen += sizeof(uint32_t); + *ptr++ = nfs_true; /* True: Uid value follows */ + *ptr++ = 0; /* UID = 0 (nobody) */ + reqlen += 2*sizeof(uint32_t); /* Set the group ID to one */ - *ptr++ = nfs_true; /* True: Gid value follows */ - reqlen += sizeof(uint32_t); - - *ptr++ = HTONL(1); - reqlen += sizeof(uint32_t); + *ptr++ = nfs_true; /* True: Gid value follows */ + *ptr++ = HTONL(1); /* GID = 1 (nogroup) */ + reqlen += 2*sizeof(uint32_t); /* No size */ @@ -2104,10 +2093,8 @@ static int nfs_mkdir(struct inode *mountpt, const char *relpath, mode_t mode) /* Don't change times */ *ptr++ = HTONL(NFSV3SATTRTIME_DONTCHANGE); /* Don't change atime */ - reqlen += sizeof(uint32_t); - *ptr++ = HTONL(NFSV3SATTRTIME_DONTCHANGE); /* Don't change mtime */ - reqlen += sizeof(uint32_t); + reqlen += 2*sizeof(uint32_t); /* Perform the MKDIR RPC */