mirror of
https://gitee.com/mirrors_PX4/PX4-Autopilot.git
synced 2026-10-19 02:33:33 +08:00
NFS update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4650 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
+58
-55
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -49,6 +49,8 @@
|
||||
|
||||
#include <nuttx/fs/nfs.h>
|
||||
|
||||
#include "nfs.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -134,7 +134,10 @@ int nfs_checkmount(struct nfsmount *nmp)
|
||||
{
|
||||
file->n_open = false;
|
||||
}
|
||||
|
||||
return -ENODEV;
|
||||
}
|
||||
return -ENODEV;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user