summaryrefslogtreecommitdiff
path: root/nuttx/fs/nfs
diff options
context:
space:
mode:
authorpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-23 23:21:30 +0000
committerpatacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3>2012-04-23 23:21:30 +0000
commitaee2480fc6f591ac4b0d62cbba3770a033331819 (patch)
tree462a51b8aff86cae0d449394d56e3720da7a5565 /nuttx/fs/nfs
parenta8aed07667d2a225ca6b09fadb91e66d7c554312 (diff)
downloadpx4-nuttx-aee2480fc6f591ac4b0d62cbba3770a033331819.tar.gz
px4-nuttx-aee2480fc6f591ac4b0d62cbba3770a033331819.tar.bz2
px4-nuttx-aee2480fc6f591ac4b0d62cbba3770a033331819.zip
NFS update
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4650 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nfs')
-rw-r--r--nuttx/fs/nfs/nfs.h113
-rw-r--r--nuttx/fs/nfs/nfs_mount.h5
-rw-r--r--nuttx/fs/nfs/nfs_node.h2
-rw-r--r--nuttx/fs/nfs/nfs_proto.h6
-rw-r--r--nuttx/fs/nfs/nfs_socket.c2
-rwxr-xr-xnuttx/fs/nfs/nfs_util.c5
-rw-r--r--nuttx/fs/nfs/nfs_vfsops.c4
7 files changed, 72 insertions, 65 deletions
diff --git a/nuttx/fs/nfs/nfs.h b/nuttx/fs/nfs/nfs.h
index a88e5b91c..600e53350 100644
--- a/nuttx/fs/nfs/nfs.h
+++ b/nuttx/fs/nfs/nfs.h
@@ -53,31 +53,32 @@
* Pre-processor Definitions
****************************************************************************/
-#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
+#define NFS_TICKINTVL 5 /* Desired time for a tick (msec) */
#define NFS_HZ (CLOCKS_PER_SEC / nfs_ticks) /* Ticks/sec */
#define NFS_TIMEO (1 * NFS_HZ) /* Default timeout = 1 second */
#define NFS_MINTIMEO (1 * NFS_HZ) /* Min timeout to use */
#define NFS_MAXTIMEO (60 * NFS_HZ) /* Max timeout to backoff to */
#define NFS_MINIDEMTIMEO (5 * NFS_HZ) /* Min timeout for non-idempotent ops */
-#define NFS_TIMEOUTMUL 2 /* Timeout/Delay multiplier */
-#define NFS_MAXREXMIT 100 /* Stop counting after this many */
-#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
-#define NFS_MAXGRPS 16 /* Max. size of groups list */
-#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
+#define NFS_TIMEOUTMUL 2 /* Timeout/Delay multiplier */
+#define NFS_MAXREXMIT 100 /* Stop counting after this many */
+#define NFS_RETRANS 10 /* Num of retrans for soft mounts */
+#define NFS_MAXGRPS 16 /* Max. size of groups list */
+#define NFS_MINATTRTIMO 5 /* Attribute cache timeout in sec */
#define NFS_MAXATTRTIMO 60
-#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
-#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
-#define NFS_READDIRSIZE 8192 /* Def. readdir size */
-#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
-#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
-#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */
+#define NFS_WSIZE 8192 /* Def. write data size <= 8192 */
+#define NFS_RSIZE 8192 /* Def. read data size <= 8192 */
+#define NFS_READDIRSIZE 8192 /* Def. readdir size */
+#define NFS_DEFRAHEAD 1 /* Def. read ahead # blocks */
+#define NFS_MAXRAHEAD 4 /* Max. read ahead # blocks */
+#define NFS_MAXASYNCDAEMON 20 /* Max. number async_daemons runable */
+#define NFS_NPROCS 23
/* Ideally, NFS_DIRBLKSIZ should be bigger, but I've seen servers with
* broken NFS/ethernet drivers that won't work with anything bigger (Linux..)
*/
-#define NFS_DIRBLKSIZ 1024 /* Must be a multiple of DIRBLKSIZ */
-#define NFS_READDIRBLKSIZ 512 /* Size of read dir blocks. XXX */
+#define NFS_DIRBLKSIZ 1024 /* Must be a multiple of DIRBLKSIZ */
+#define NFS_READDIRBLKSIZ 512 /* Size of read dir blocks. XXX */
/* Oddballs */
@@ -189,13 +190,14 @@
/* Bits for "nd_flag" */
#define ND_NFSV3 0x08
-
#define NFSD_CHECKSLP 0x01
/****************************************************************************
* Public Types
****************************************************************************/
+#undef COMP
+#ifdef COMP
/* Structures for the nfssvc(2) syscall.
* Not that anyone besides nfsd(8) should ever use it.
*/
@@ -220,46 +222,6 @@ struct nfsd_srvargs
uint32_t nsd_ttl; /* credential ttl (sec) */
};
-/* Stats structure */
-
-struct nfsstats
-{
- uint64_t attrcache_hits;
- uint64_t attrcache_misses;
- uint64_t lookupcache_hits;
- uint64_t lookupcache_misses;
- uint64_t direofcache_hits;
- uint64_t direofcache_misses;
- uint64_t biocache_reads;
- uint64_t read_bios;
- uint64_t read_physios;
- uint64_t biocache_writes;
- uint64_t write_bios;
- uint64_t write_physios;
- uint64_t biocache_readlinks;
- uint64_t readlink_bios;
- uint64_t biocache_readdirs;
- uint64_t readdir_bios;
- uint64_t rpccnt[NFS_NPROCS];
- uint64_t rpcretries;
- uint64_t srvrpccnt[NFS_NPROCS];
- uint64_t srvrpc_errs;
- uint64_t srv_errs;
- uint64_t rpcrequests;
- uint64_t rpctimeouts;
- uint64_t rpcunexpected;
- uint64_t rpcinvalid;
- uint64_t srvcache_inproghits;
- uint64_t srvcache_idemdonehits;
- uint64_t srvcache_nonidemdonehits;
- uint64_t srvcache_misses;
- uint64_t forcedsync;
- uint64_t srvnqnfs_leases;
- uint64_t srvnqnfs_maxleases;
- uint64_t srvnqnfs_getleases;
- uint64_t srvvop_writes;
-};
-
/* The set of signals the interrupt an I/O in progress for NFSMNT_INT mounts.
* What should be in this set is open to debate, but I believe that since
* I/O system calls on ufs are never interrupted by signals the set should
@@ -330,6 +292,47 @@ struct nfsrv_descript
int nd_repstat; /* Reply status */
uint32_t nd_retxid; /* Reply xid */
};
+#endif
+
+/* Stats structure */
+
+struct nfsstats
+{
+ uint64_t attrcache_hits;
+ uint64_t attrcache_misses;
+ uint64_t lookupcache_hits;
+ uint64_t lookupcache_misses;
+ uint64_t direofcache_hits;
+ uint64_t direofcache_misses;
+ uint64_t biocache_reads;
+ uint64_t read_bios;
+ uint64_t read_physios;
+ uint64_t biocache_writes;
+ uint64_t write_bios;
+ uint64_t write_physios;
+ uint64_t biocache_readlinks;
+ uint64_t readlink_bios;
+ uint64_t biocache_readdirs;
+ uint64_t readdir_bios;
+ uint64_t rpccnt[NFS_NPROCS];
+ uint64_t rpcretries;
+ uint64_t srvrpccnt[NFS_NPROCS];
+ uint64_t srvrpc_errs;
+ uint64_t srv_errs;
+ uint64_t rpcrequests;
+ uint64_t rpctimeouts;
+ uint64_t rpcunexpected;
+ uint64_t rpcinvalid;
+ uint64_t srvcache_inproghits;
+ uint64_t srvcache_idemdonehits;
+ uint64_t srvcache_nonidemdonehits;
+ uint64_t srvcache_misses;
+ uint64_t forcedsync;
+ uint64_t srvnqnfs_leases;
+ uint64_t srvnqnfs_maxleases;
+ uint64_t srvnqnfs_getleases;
+ uint64_t srvvop_writes;
+};
/****************************************************************************
* Public Data
diff --git a/nuttx/fs/nfs/nfs_mount.h b/nuttx/fs/nfs/nfs_mount.h
index 7ca070b9d..bfd5035bd 100644
--- a/nuttx/fs/nfs/nfs_mount.h
+++ b/nuttx/fs/nfs/nfs_mount.h
@@ -47,6 +47,8 @@
* Included Files
****************************************************************************/
+ #include <nuttx/fs/nfs.h>
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -68,7 +70,6 @@ struct nfsmount
{
int nm_flag; /* Flags for soft/hard... */
int nm_state; /* Internal state flags */
-//struct inode *nm_blkdriver; /* Vfs structure for this filesystem */
struct nfsnode *nm_head; /* A list to all files opened on this mountpoint */
bool nm_mounted; /* true: The file system is ready */
sem_t nm_sem; /* Used to assume thread-safe access */
@@ -98,8 +99,6 @@ struct nfsmount
int nm_acregmin; /* Reg file attr cache min lifetime */
int nm_acregmax; /* Reg file attr cache max lifetime */
unsigned char *nm_verf; /* V3 write verifier */
-//char nm_mntonname[90]; /* directory on which mounted */
-//uint8_t *nm_buffer; /* This is an allocated buffer to hold one sector*/
};
#endif
diff --git a/nuttx/fs/nfs/nfs_node.h b/nuttx/fs/nfs/nfs_node.h
index 55148d181..98867c900 100644
--- a/nuttx/fs/nfs/nfs_node.h
+++ b/nuttx/fs/nfs/nfs_node.h
@@ -49,6 +49,8 @@
#include <nuttx/fs/nfs.h>
+#include "nfs.h"
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
diff --git a/nuttx/fs/nfs/nfs_proto.h b/nuttx/fs/nfs/nfs_proto.h
index b82b2e104..7fecb60b4 100644
--- a/nuttx/fs/nfs/nfs_proto.h
+++ b/nuttx/fs/nfs/nfs_proto.h
@@ -47,8 +47,10 @@
* Included Files
****************************************************************************/
- #include <nuttx/fs/nfs.h>
+#include <nuttx/fs/nfs.h>
+#include "nfs.h"
+
/****************************************************************************
* Pre-processor Definitions
****************************************************************************/
@@ -302,7 +304,7 @@ typedef struct fhandle fhandle_t;
/*
union nfsfh
{
-fhandle_t fh_generic;
+ fhandle_t fh_generic;
unsigned char fh_bytes[NFS_MAXFHSIZE];
};
typedef union nfsfh nfsfh_t;
diff --git a/nuttx/fs/nfs/nfs_socket.c b/nuttx/fs/nfs/nfs_socket.c
index d659a097e..53a68ef1a 100644
--- a/nuttx/fs/nfs/nfs_socket.c
+++ b/nuttx/fs/nfs/nfs_socket.c
@@ -46,8 +46,6 @@
#include <string.h>
#include <debug.h>
-#include <nuttx/fs/nfs.h>
-
#include "nfs.h"
#include "rpc.h"
#include "rpc_v2.h"
diff --git a/nuttx/fs/nfs/nfs_util.c b/nuttx/fs/nfs/nfs_util.c
index a6c82ab22..3aedfc65c 100755
--- a/nuttx/fs/nfs/nfs_util.c
+++ b/nuttx/fs/nfs/nfs_util.c
@@ -134,7 +134,10 @@ int nfs_checkmount(struct nfsmount *nmp)
{
file->n_open = false;
}
+
+ return -ENODEV;
}
- return -ENODEV;
+
+ return 0;
}
diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c
index 478271419..4679239c1 100644
--- a/nuttx/fs/nfs/nfs_vfsops.c
+++ b/nuttx/fs/nfs/nfs_vfsops.c
@@ -1016,6 +1016,7 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
sem_init(&nmp->nm_sem, 0, 0); /* Initialize the semaphore that controls access */
//nmp->nm_blkdriver = blkdriver; /* Save the block driver reference */
+ nfs_init();
nmp->nm_timeo = NFS_TIMEO;
nmp->nm_retry = NFS_RETRANS;
nmp->nm_wsize = NFS_WSIZE;
@@ -1053,8 +1054,7 @@ int mountnfs(struct nfs_args *argp, struct sockaddr *nam, void **handle)
/* Mounted! */
nmp->nm_mounted = true;
- nfs_init();
- *handle /*= blkdriver->i_private*/ = &nmp;
+ *handle = &nmp;
nfs_semgive(nmp);
return 0;