forked from Archive/PX4-Autopilot
NFS update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4634 7fd9a85b-ad96-42d3-883c-3090e2eb8679
This commit is contained in:
parent
8d4b4631f4
commit
5f9ab50192
|
@ -47,6 +47,8 @@
|
|||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include "nfs_mount.h"
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -258,10 +260,6 @@ struct nfsstats
|
|||
uint64_t srvvop_writes;
|
||||
};
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
||||
/* 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
|
||||
|
@ -336,19 +334,25 @@ struct nfsrv_descript
|
|||
/****************************************************************************
|
||||
* Public Data
|
||||
****************************************************************************/
|
||||
/*
|
||||
extern int nfs_niothreads;
|
||||
extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead;
|
||||
extern int nfssvc_sockhead_flag;
|
||||
|
||||
extern struct pool nfsreqpl;
|
||||
extern struct pool nfs_node_pool;
|
||||
extern TAILQ_HEAD(nfsdhead, nfsd) nfsd_head;
|
||||
extern int nfsd_head_flag;
|
||||
*/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void nfs_semtake(struct nfsmount *nmp);
|
||||
EXTERN void nfs_semgive(struct nfsmount *nmp);
|
||||
EXTERN int nfs_checkmount(struct nfsmount *nmp);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _NFS_NFS_H */
|
||||
|
|
|
@ -85,6 +85,11 @@
|
|||
#define NFSMNT_NOLOCKD 0x00400000 /* Locks are local */
|
||||
#define NFSMNT_NFSV4 0x00800000 /* Use NFS Version 4 protocol */
|
||||
#define NFSMNT_HASWRITEVERF 0x01000000 /* NFSv4 Write verifier */
|
||||
#define NFSMNT_GOTFSINFO 0x00000004 /* Got the V3 fsinfo */
|
||||
#define NFSMNT_INTERNAL 0xfffc0000 /* Bits set internally */
|
||||
#define NFSMNT_NOAC 0x00080000 /* Turn off attribute cache */
|
||||
|
||||
#define NFS_ARGSVERSION 3 /* change when nfs_args changes */
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
|
@ -99,7 +104,7 @@ struct nfs_args
|
|||
int addrlen; /* length of address */
|
||||
int sotype; /* Socket type */
|
||||
int proto; /* and Protocol */
|
||||
nfsfh_t *fh; /* File handle to be mounted */
|
||||
nfsfh_t fh; /* File handle to be mounted */
|
||||
int fhsize; /* Size, in bytes, of fh */
|
||||
int flags; /* flags */
|
||||
int wsize; /* write size in bytes */
|
||||
|
@ -112,6 +117,10 @@ struct nfs_args
|
|||
int leaseterm; /* Term (sec) of lease */
|
||||
int deadthresh; /* Retrans threshold */
|
||||
char *hostname; /* server's name */
|
||||
int acregmin; /* cache attrs for reg files min time */
|
||||
int acregmax; /* cache attrs for reg files max time */
|
||||
int acdirmin; /* cache attrs for dirs min time */
|
||||
int acdirmax; /* cache attrs for dirs max time */
|
||||
};
|
||||
|
||||
#endif /* __FS_NFS_NFS_ARGS_H */
|
||||
|
|
|
@ -97,7 +97,7 @@ struct nfsmount
|
|||
int nm_acdirmax; /* Directory attr cache max lifetime */
|
||||
int nm_acregmin; /* Reg file attr cache min lifetime */
|
||||
int nm_acregmax; /* Reg file attr cache max lifetime */
|
||||
unsigned char nm_verf[NFSX_V3WRITEVERF]; /* V3 write verifier */
|
||||
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*/
|
||||
};
|
||||
|
|
|
@ -80,6 +80,14 @@
|
|||
#define VTONFS(vp) ((struct nfsnode *)(vp)->f_priv)
|
||||
#define NFSTOV(np) ((np)->n_vnode)
|
||||
|
||||
#define n_atim n_un1.nf_atim
|
||||
#define n_mtim n_un2.nf_mtim
|
||||
#define n_sillyrename n_un3.nf_silly
|
||||
#define n_cookieverf n_un1.nd_cookieverf
|
||||
#define n4_cookieverf n_un1.nd4_cookieverf
|
||||
#define n_direofoffset n_un2.nd_direof
|
||||
#define n_cookies n_un3.nd_cook
|
||||
|
||||
/****************************************************************************
|
||||
* Public Types
|
||||
****************************************************************************/
|
||||
|
@ -119,7 +127,7 @@ struct nfsnode
|
|||
time_t n_attrstamp; /* Attr. cache timestamp */
|
||||
struct timespec n_mtime; /* Prev modify time. */
|
||||
time_t n_ctime; /* Prev create time. */
|
||||
nfsfh_t *n_fhp; /* NFS File Handle */
|
||||
nfsfh_t n_fhp; /* NFS File Handle */
|
||||
struct inode *n_inode; /* associated inode */
|
||||
int n_error; /* Save write error value */
|
||||
union
|
||||
|
@ -130,7 +138,7 @@ struct nfsnode
|
|||
union
|
||||
{
|
||||
struct timespec nf_mtim;
|
||||
off_t nd_direoffset; /* Directory EOF offset cache */
|
||||
off_t nd_direof; /* Directory EOF offset cache */
|
||||
} n_un2;
|
||||
short n_fhsize; /* size in bytes, of fh */
|
||||
short n_flag; /* Flag for locking.. */
|
||||
|
|
|
@ -64,6 +64,7 @@
|
|||
#define NFS_VER4 4
|
||||
#define NFS_V2MAXDATA 8192
|
||||
#define NFS_MAXDGRAMDATA 32768
|
||||
#define MAXBSIZE 64000
|
||||
#define NFS_MAXDATA MAXBSIZE
|
||||
#define NFS_MAXPATHLEN 1024
|
||||
#define NFS_MAXNAMLEN 255
|
||||
|
@ -108,8 +109,7 @@
|
|||
#define NFSERR_STALEWRITEVERF 30001 /* Fake return for nfs_commit() */
|
||||
|
||||
#define NFSERR_RETVOID 0x20000000 /* Return void, not error */
|
||||
#define NFSERR_AUTHERR 0x40000000 /* Mark an authentication error
|
||||
*/
|
||||
#define NFSERR_AUTHERR 0x40000000 /* Mark an authentication error */
|
||||
#define NFSERR_RETERR 0x80000000 /* Mark an error return for V3 */
|
||||
|
||||
/* Sizes in bytes of various nfs rpc components */
|
||||
|
@ -235,6 +235,7 @@
|
|||
#define NFSV3FSINFO_CANSETTIME 0x10
|
||||
|
||||
/* Conversion macros */
|
||||
|
||||
#define vtonfsv2_mode(t,m) \
|
||||
txdr_unsigned(((t) == VFIFO) ? MAKEIMODE(VCHR, (m)) : \
|
||||
MAKEIMODE((t), (m)))
|
||||
|
@ -500,7 +501,7 @@ struct wcc_data
|
|||
struct diropargs3
|
||||
{
|
||||
nfsfh_t dir;
|
||||
const char name;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct CREATE3args
|
||||
|
@ -528,7 +529,7 @@ struct READ3resok
|
|||
struct nfs_fattr file_attributes;
|
||||
uint32_t count;
|
||||
bool eof;
|
||||
const char data;
|
||||
const char *data;
|
||||
};
|
||||
|
||||
enum stable_how
|
||||
|
@ -544,7 +545,7 @@ struct WRITE3args
|
|||
uint64_t offset;
|
||||
uint32_t count;
|
||||
enum stable_how stable;
|
||||
const char data;
|
||||
const char *data;
|
||||
};
|
||||
|
||||
struct WRITE3resok
|
||||
|
@ -552,7 +553,7 @@ struct WRITE3resok
|
|||
struct wcc_data file_wcc;
|
||||
uint32_t count;
|
||||
enum stable_how committed;
|
||||
unsigned char verf;
|
||||
unsigned char *verf;
|
||||
};
|
||||
|
||||
struct REMOVE3args
|
||||
|
|
|
@ -107,7 +107,7 @@ int nfsx_connect(struct nfsmount *nmp)
|
|||
return EFAULT;
|
||||
}
|
||||
|
||||
rpc = &nmp->nm_rpcclnt;
|
||||
rpc = nmp->nm_rpcclnt;
|
||||
|
||||
rpc->rc_prog = &nfs3_program;
|
||||
|
||||
|
@ -125,7 +125,7 @@ int nfsx_connect(struct nfsmount *nmp)
|
|||
|
||||
rpc->rc_authtype = RPCAUTH_NULL; /* for now */
|
||||
//rpc->rc_servername = nmp->nm_mountp->mnt_stat.f_mntfromname;
|
||||
rpc->rc_name = (struct sockaddr *)nmp->nm_nam;
|
||||
rpc->rc_name = nmp->nm_nam;
|
||||
|
||||
rpc->rc_sotype = nmp->nm_sotype;
|
||||
rpc->rc_soproto = nmp->nm_soproto;
|
||||
|
@ -153,26 +153,24 @@ int nfsx_connect(struct nfsmount *nmp)
|
|||
|
||||
void nfsx_disconnect(struct nfsmount *nmp)
|
||||
{
|
||||
rpcclnt_disconnect(&nmp->nm_rpcclnt);
|
||||
rpcclnt_disconnect(nmp->nm_rpcclnt);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_NFS_TCPIP
|
||||
void nfsx_safedisconnect(struct nfsmount *nmp)
|
||||
{
|
||||
rpcclnt_safedisconnect(&nmp->nm_rpcclnt);
|
||||
rpcclnt_safedisconnect(nmp->nm_rpcclnt);
|
||||
}
|
||||
#endif
|
||||
|
||||
int nfsx_request_xx(struct nfsmount *nm, int procnum, void *datain, void *dataout)
|
||||
int nfsx_request_xx(struct nfsmount *nmp, int procnum, void *datain, void *dataout)
|
||||
{
|
||||
int error;
|
||||
struct nfsmount *nmp;
|
||||
struct rpcclnt *clnt;
|
||||
struct rpc_reply *reply;
|
||||
struct rpc_reply *reply = NULL;
|
||||
int trylater_delay;
|
||||
|
||||
nmp = nm;
|
||||
clnt = &nmp->nm_rpcclnt;
|
||||
clnt = nmp->nm_rpcclnt;
|
||||
|
||||
tryagain:
|
||||
|
||||
|
@ -227,5 +225,5 @@ out:
|
|||
|
||||
int nfsx_nmcancelreqs(struct nfsmount *nmp)
|
||||
{
|
||||
return rpcclnt_cancelreqs(&nmp->nm_rpcclnt);
|
||||
return rpcclnt_cancelreqs(nmp->nm_rpcclnt);
|
||||
}
|
||||
|
|
|
@ -42,28 +42,42 @@
|
|||
* Pre-processor definitions
|
||||
****************************************************************************/
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
int nfsx_connect(struct nfsmount *);
|
||||
void nfsx_disconnect(struct nfsmount *);
|
||||
#ifdef CONFIG_NFS_TCPIP
|
||||
int nfsx_sigintr(struct nfsmount *, struct nfsreq *, cthread_t *);
|
||||
void nfsx_safedisconnect(struct nfsmount *);
|
||||
#define nfs_safedisconnect nfsx_safedisconnect
|
||||
#endif
|
||||
int nfsx_request_xx(struct nfsmount *, int, void*, void*);
|
||||
int nfsx_nmcancelreqs(struct nfsmount *);
|
||||
|
||||
#define nfs_connect nfs_connect_nfsx
|
||||
#define nfs_disconnect nfs_disconnect_nfsx
|
||||
#define nfs_nmcancelreqs nfsx_nmcancelreqs
|
||||
#define nfs_connect(nmp) nfs_connect_nfsx (nmp)
|
||||
#define nfs_disconnect(nmp) nfs_disconnect_nfsx(nmp)
|
||||
#define nfs_nmcancelreqs (nmp) nfsx_nmcancelreqs(nmp)
|
||||
#define nfsx_request(nmp, m, i, o) \
|
||||
nfsx_request_xx(nmp, m, i, o)
|
||||
|
||||
#ifdef CONFIG_NFS_TCPIP
|
||||
# define nfs_sigintr nfs_sigintr_nfsx
|
||||
#define nfs_safedisconnect nfsx_safedisconnect
|
||||
#endif
|
||||
|
||||
/****************************************************************************
|
||||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
#define EXTERN extern "C"
|
||||
extern "C" {
|
||||
#else
|
||||
#define EXTERN extern
|
||||
#endif
|
||||
|
||||
EXTERN void nfs_init(void);
|
||||
EXTERN int nfsx_connect(struct nfsmount *);
|
||||
EXTERN void nfsx_disconnect(struct nfsmount *);
|
||||
#ifdef CONFIG_NFS_TCPIP
|
||||
EXTERN int nfsx_sigintr(struct nfsmount *, struct nfsreq *, cthread_t *);
|
||||
EXTERN void nfsx_safedisconnect(struct nfsmount *);
|
||||
#endif
|
||||
EXTERN int nfsx_request_xx(struct nfsmount *, int, void*, void*);
|
||||
EXTERN int nfsx_nmcancelreqs(struct nfsmount *);
|
||||
|
||||
#undef EXTERN
|
||||
#if defined(__cplusplus)
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* __FS_NFS_NFS_SOCKET_H */
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -233,18 +233,10 @@ struct rpcclnt
|
|||
* Public Function Prototypes
|
||||
****************************************************************************/
|
||||
|
||||
/*
|
||||
void rpcclnt_create(struct rpcclnt ** rpc);
|
||||
void rpcclnt_destroy(struct rpcclnt * rpc);
|
||||
|
||||
#define rpcclnt_get(X) rpcclnt_create(&(X))
|
||||
#define rpcclnt_put(X) rpcclnt_destroy(X)
|
||||
*/
|
||||
|
||||
void rpcclnt_init(void);
|
||||
//void rpcclnt_uninit(void);
|
||||
|
||||
int rpcclnt_setup(struct rpcclnt *, struct rpc_program *, struct sockaddr *, int, int, struct rpc_auth_info *, int, int, int);
|
||||
//int rpcclnt_setup(struct rpcclnt *, struct rpc_program *, struct sockaddr *, int, int, struct rpc_auth_info *, int, int, int);
|
||||
int rpcclnt_connect(struct rpcclnt *);
|
||||
int rpcclnt_reconnect(struct rpctask *);
|
||||
void rpcclnt_disconnect(struct rpcclnt *);
|
||||
|
@ -252,4 +244,5 @@ void rpcclnt_safedisconnect(struct rpcclnt *);
|
|||
int rpcclnt_request(struct rpcclnt *, int, struct rpc_reply *, void *);
|
||||
int rpcclnt_cancelreqs(struct rpcclnt *);
|
||||
|
||||
|
||||
#endif /* _RPCCLNT_H_ */
|
||||
|
|
|
@ -549,7 +549,6 @@ static int rpcclnt_receive(struct rpctask *rep, struct sockaddr *aname,
|
|||
* until ours is found.
|
||||
*/
|
||||
|
||||
/* ARGSUSED */
|
||||
static int
|
||||
rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call,
|
||||
struct rpc_reply *reply)
|
||||
|
|
|
@ -49,6 +49,8 @@
|
|||
* Included Files
|
||||
****************************************************************************/
|
||||
|
||||
#include <arpa/inet.h>
|
||||
|
||||
/****************************************************************************
|
||||
* Pre-processor Definitions
|
||||
****************************************************************************/
|
||||
|
@ -86,6 +88,11 @@
|
|||
(t)->tv_nsec = ntohl(((struct nfsv3_time *)(f))->nfsv3_nsec); \
|
||||
}
|
||||
|
||||
#define fxdr_nfsv3time2(f, t) { \
|
||||
(t)->nfsv3_sec = ntohl(((struct nfsv3_time *)(f))->nfsv3_sec); \
|
||||
(t)->nfsv3_nsec = ntohl(((struct nfsv3_time *)(f))->nfsv3_nsec); \
|
||||
}
|
||||
|
||||
#define txdr_nfsv3time(f, t) { \
|
||||
((struct nfsv3_time *)(t))->nfsv3_sec = htonl((f)->tv_sec); \
|
||||
((struct nfsv3_time *)(t))->nfsv3_nsec = htonl((f)->tv_nsec); \
|
||||
|
|
Loading…
Reference in New Issue