diff options
author | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-03-28 00:10:43 +0000 |
---|---|---|
committer | patacongo <patacongo@7fd9a85b-ad96-42d3-883c-3090e2eb8679> | 2012-03-28 00:10:43 +0000 |
commit | fb9d418f66f4ed9a516cc26e056ffedabcb78169 (patch) | |
tree | c93decb412e433193f06fc5602a9560119017d19 /nuttx/fs/nfs | |
parent | 1a975c0a58aa62cad758bbf931cdaaafe10de230 (diff) | |
download | px4-firmware-fb9d418f66f4ed9a516cc26e056ffedabcb78169.tar.gz px4-firmware-fb9d418f66f4ed9a516cc26e056ffedabcb78169.tar.bz2 px4-firmware-fb9d418f66f4ed9a516cc26e056ffedabcb78169.zip |
NFS update
git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4532 7fd9a85b-ad96-42d3-883c-3090e2eb8679
Diffstat (limited to 'nuttx/fs/nfs')
-rw-r--r-- | nuttx/fs/nfs/nfs.h | 12 | ||||
-rw-r--r-- | nuttx/fs/nfs/nfs_args.h | 32 | ||||
-rw-r--r-- | nuttx/fs/nfs/nfs_mount.h | 24 | ||||
-rw-r--r-- | nuttx/fs/nfs/nfs_proto.h | 30 | ||||
-rw-r--r-- | nuttx/fs/nfs/nfs_socket.c | 10 | ||||
-rw-r--r-- | nuttx/fs/nfs/nfs_socket.h | 6 | ||||
-rw-r--r-- | nuttx/fs/nfs/nfs_vfsops.c | 15 | ||||
-rw-r--r-- | nuttx/fs/nfs/rpc.h | 2 | ||||
-rw-r--r-- | nuttx/fs/nfs/rpc_clnt.c | 28 |
9 files changed, 79 insertions, 80 deletions
diff --git a/nuttx/fs/nfs/nfs.h b/nuttx/fs/nfs/nfs.h index b08580acf..88276123c 100644 --- a/nuttx/fs/nfs/nfs.h +++ b/nuttx/fs/nfs/nfs.h @@ -215,7 +215,7 @@ struct nfsd_srvargs unsigned char *nsd_authstr; /* Auth string (ret) */ int nsd_verflen; /* and the verifier */ unsigned char *nsd_verfstr; - struct timeval nsd_timestamp; /* timestamp from verifier */ + struct timeval nsd_timestamp; /* timestamp from verifier */ uint32_t nsd_ttl; /* credential ttl (sec) */ }; @@ -303,13 +303,13 @@ enum nfs_rto_timers union nethostaddr { - u_int32_t had_inetaddr; + uint32_t had_inetaddr; struct mbuf *had_nam; }; struct nfssvc_sock { - TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ + // TAILQ_ENTRY(nfssvc_sock) ns_chain; /* List of all nfssvc_sock's */ struct file *ns_fp; /* fp from the... */ struct socket *ns_so; /* ...socket this struct wraps */ int ns_flag; /* socket status flags */ @@ -323,7 +323,7 @@ struct nfssvc_sock struct nfsd { - TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ + //TAILQ_ENTRY(nfsd) nfsd_chain; /* List of all nfsd's */ int nfsd_flag; /* NFSD_ flags */ struct nfssvc_sock *nfsd_slp; /* Current socket */ struct nfsrv_descript *nfsd_nd; /* Associated nfsrv_descript */ @@ -342,7 +342,7 @@ struct nfsrv_descript /**************************************************************************** * Public Data ****************************************************************************/ - +/* extern int nfs_niothreads; extern TAILQ_HEAD(nfssvc_sockhead, nfssvc_sock) nfssvc_sockhead; extern int nfssvc_sockhead_flag; @@ -351,7 +351,7 @@ 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 ****************************************************************************/ diff --git a/nuttx/fs/nfs/nfs_args.h b/nuttx/fs/nfs/nfs_args.h index e1057d1ee..57c735c17 100644 --- a/nuttx/fs/nfs/nfs_args.h +++ b/nuttx/fs/nfs/nfs_args.h @@ -46,14 +46,12 @@ * Included Files ****************************************************************************/ +#include "nfs_proto.h" + /**************************************************************************** * Pre-processor Definitions ****************************************************************************/ -/* File identifier */ - -#define MAXFIDSZ 16 - /* NFS mount option flags */ #define NFSMNT_SOFT 0x00000001 /* soft mount (hard is default) */ @@ -92,32 +90,6 @@ * Public Types ****************************************************************************/ -typedef struct -{ - int32_t val[2]; -} fsid_t; /* file system id type */ - -/* File identifier. - * These are unique per filesystem on a single machine. - */ - -struct fid -{ - unsigned short fid_len; /* length of data in bytes */ - unsigned short fid_reserved; /* force longword alignment */ - char fid_data[MAXFIDSZ]; /* data (variable length) */ -}; - -/* Generic file handle */ - -struct fhandle -{ - fsid_t fh_fsid; /* File system id of mount point */ - struct fid fh_fid; /* File sys specific id */ -}; - -typedef struct fhandle fhandle_t; - /* Arguments to mount NFS */ struct nfs_args diff --git a/nuttx/fs/nfs/nfs_mount.h b/nuttx/fs/nfs/nfs_mount.h index 287794ee3..107f4d966 100644 --- a/nuttx/fs/nfs/nfs_mount.h +++ b/nuttx/fs/nfs/nfs_mount.h @@ -109,20 +109,18 @@ struct nfsmount /* Prototypes for NFS mount operations: */ -int nfs_mount(struct mount *, const char *, void *, struct nameidata *, - struct proc *); -int mountnfs(struct nfs_args *, struct mount *, struct mbuf *, char *, char *); +int nfs_mount(struct inode *, const char *, void *); +int mountnfs(struct nfs_args *, struct inode *, char *, char *); void nfs_decode_args(struct nfsmount *, struct nfs_args *, struct nfs_args *); -int nfs_start(struct mount *, int, struct proc *); -int nfs_unmount(struct mount *, int, struct proc *); -int nfs_root(struct mount *, struct vnode **); -int nfs_statfs(struct mount *, struct statfs *, struct proc *); -int nfs_sync(struct mount *, int, struct ucred *, struct proc *); -int nfs_vget(struct mount *, ino_t, struct vnode **); -int nfs_fhtovp(struct mount *, struct fid *, struct vnode **); -int nfs_vptofh(struct vnode *, struct fid *); -int nfs_fsinfo(struct nfsmount *, struct vnode *, struct ucred *, - struct proc *); +int nfs_start(struct inode *, int); +int nfs_unmount(struct inode *, int); +int nfs_root(struct inode *, struct file **); +int nfs_statfs(struct inode *, struct statfs *); +int nfs_sync(struct inode *, int); +int nfs_vget(struct inode *, ino_t, struct file **); +int nfs_fhtovp(struct inode *, struct fid *); +int nfs_vptofh(struct file *, struct fid *); +int nfs_fsinfo(struct nfsmount *, struct file *); void nfs_init(void); #endif diff --git a/nuttx/fs/nfs/nfs_proto.h b/nuttx/fs/nfs/nfs_proto.h index cab8fdd57..8b6e8cf94 100644 --- a/nuttx/fs/nfs/nfs_proto.h +++ b/nuttx/fs/nfs/nfs_proto.h @@ -249,6 +249,10 @@ # define NFS_MAXFHSIZE 64 #endif +/* File identifier */ + +#define MAXFIDSZ 16 + /**************************************************************************** * Public Types ****************************************************************************/ @@ -267,6 +271,32 @@ typedef enum NFFIFO = 7 } nfstype; +typedef struct +{ + int32_t val[2]; +} fsid_t; /* file system id type */ + +/* File identifier. + * These are unique per filesystem on a single machine. + */ + +struct fid +{ + unsigned short fid_len; /* length of data in bytes */ + unsigned short fid_reserved; /* force longword alignment */ + char fid_data[MAXFIDSZ]; /* data (variable length) */ +}; + +/* Generic file handle */ + +struct fhandle +{ + fsid_t fh_fsid; /* File system id of mount point */ + struct fid fh_fid; /* File sys specific id */ +}; + +typedef struct fhandle fhandle_t; + /* File Handle (32 bytes for version 2), variable up to 64 for version 3. */ union nfsfh diff --git a/nuttx/fs/nfs/nfs_socket.c b/nuttx/fs/nfs/nfs_socket.c index 8e270bf6f..e821ce697 100644 --- a/nuttx/fs/nfs/nfs_socket.c +++ b/nuttx/fs/nfs/nfs_socket.c @@ -80,7 +80,7 @@ static struct rpc_program nfs3_program = * Public Variables ****************************************************************************/ -int nfs_ticks = rpcclnt_ticks; +int nfs_ticks; /**************************************************************************** * Private Functions @@ -163,7 +163,7 @@ int nfsx_request_xx(struct nfsmount *nm, int procnum, void *data) int error; struct nfsmount *nmp; struct rpcclnt *clnt; - struct rpc_reply reply; + struct rpc_reply *reply; int trylater_delay; nmp = nm; @@ -171,12 +171,12 @@ int nfsx_request_xx(struct nfsmount *nm, int procnum, void *data) tryagain: - memset(&reply, 0, sizeof(reply)); + memset(reply, 0, sizeof(struct rpc_reply)); - if ((error = rpcclnt_request(clnt, procnum, &reply)) != 0) + if ((error = rpcclnt_request(clnt, procnum, reply)) != 0) goto out; - data = reply->where; + data = reply->stat.where; if (reply->rpc_verfi.authtype != 0) { diff --git a/nuttx/fs/nfs/nfs_socket.h b/nuttx/fs/nfs/nfs_socket.h index 5752eb2bb..f1be14aa2 100644 --- a/nuttx/fs/nfs/nfs_socket.h +++ b/nuttx/fs/nfs/nfs_socket.h @@ -53,14 +53,14 @@ 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); +int nfsx_request_xx(struct nfsmount *, int, void*); int nfsx_nmcancelreqs(struct nfsmount *); #define nfs_connect nfs_connect_nfsx #define nfs_disconnect nfs_disconnect_nfsx #define nfs_nmcancelreqs nfsx_nmcancelreqs -#define nfsx_request(nmp, m) \ - nfsx_request_xx(nmp, m) +#define nfsx_request(nmp, m, s) \ + nfsx_request_xx(nmp, m, s) #ifdef CONFIG_NFS_TCPIP #define nfs_sigintr nfs_sigintr_nfsx diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index 7302243f1..3a5e41b24 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -1,4 +1,3 @@ - /**************************************************************************** * fs/nfs/nfs_vfsops.c * @@ -64,17 +63,17 @@ #include <sys/statfs> #include <queue.h> +#include <nuttx/fs/fs.h> #include <net/if.h> #include <netinet/in.h> -#include <nfs/rpcv2.h> -#include <nfs/nfsproto.h> -#include <nfs/nfsnode.h> -#include <nfs/nfs.h> -#include <nfs/nfsmount.h> -#include <nfs/xdr_subs.h> -#include <nfs/nfs_var.h> +#include "rpcv2.h" +#include "nfsproto.h" +#include "nfs_node.h" +#include "nfs.h" +#include "nfs_mount.h" +#include "xdr_subs.h" /**************************************************************************** * Pre-processor Definitions diff --git a/nuttx/fs/nfs/rpc.h b/nuttx/fs/nfs/rpc.h index a523d8c44..6e1d9d056 100644 --- a/nuttx/fs/nfs/rpc.h +++ b/nuttx/fs/nfs/rpc.h @@ -158,7 +158,7 @@ struct rpc_reply uint32_t type; uint32_t status; - void where; /* Data */ + void *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 36f348a28..0463e74da 100644 --- a/nuttx/fs/nfs/rpc_clnt.c +++ b/nuttx/fs/nfs/rpc_clnt.c @@ -92,9 +92,9 @@ #include <debug.h> #include "xdr_subs.h" -#include "nfs_args.h" #include "nfs_proto.h" #include "nfs.h" +#include "nfs_args.h" #include "rpc.h" #include "rpc_clnt_private.h" #include "rpc_v2.h" @@ -186,8 +186,8 @@ static uint32_t rpc_reply, rpc_call, rpc_vers, rpc_msgdenied, static uint32_t rpcclnt_xid = 0; static uint32_t rpcclnt_xid_touched = 0; -struct rpcstats rpcstats; int rpcclnt_ticks; +struct rpcstats rpcstats; struct rpc_call *callmgs; struct rpc_reply *replymsg; @@ -512,7 +512,7 @@ rpcclnt_reply(struct rpctask *myrep, struct rpc_call *call, struct rpctask *rep; struct rpcclnt *rpc = myrep->r_rpcclnt; int32_t t1; - struct sockaddr *nam; + struct sockaddr *nam = NULL; uint32_t rxid; int error; @@ -845,8 +845,8 @@ int rpcclnt_connect(struct rpcclnt *rpc) struct socket *so; int error; struct sockaddr *saddr; - struct sockaddr_in *sin; - struct timeval *tv; + struct sockaddr_in *sin = NULL; + struct timeval *tv = NULL; uint16_t tport; /* create the socket */ @@ -932,10 +932,8 @@ int rpcclnt_connect(struct rpcclnt *rpc) /* Initialize other non-zero congestion variables */ - rpc->rc_srtt[0] = rpc->rc_srtt[1] = rpc->rc_srtt[2] = rpc->rc_srtt[3] = - rpc->rc_srtt[4] = (RPC_TIMEO << 3); - rpc->rc_sdrtt[0] = rpc->rc_sdrtt[1] = rpc->rc_sdrtt[2] = rpc->rc_sdrtt[3] = - rpc->rc_sdrtt[4] = 0; + rpc->rc_srtt[0] = rpc->rc_srtt[1] = rpc->rc_srtt[2] = rpc->rc_srtt[3] = (RPC_TIMEO << 3); + rpc->rc_sdrtt[0] = rpc->rc_sdrtt[1] = rpc->rc_sdrtt[2] = rpc->rc_sdrtt[3] = 0; rpc->rc_cwnd = RPC_MAXCWND / 2; /* Initial send window */ rpc->rc_sent = 0; rpc->rc_timeouts = 0; @@ -1023,11 +1021,11 @@ void rpcclnt_safedisconnect(struct rpcclnt *rpc) int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply) { - struct rpc_call *call; - struct rpc_reply *replysvr; + struct rpc_call *call = NULL; + struct rpc_reply *replysvr = NULL; struct rpctask *task, _task; int error = 0; - int xid; + int xid = 0; task = &_task; memset(task, 0, sizeof(*task)); @@ -1163,7 +1161,7 @@ int rpcclnt_request(struct rpcclnt *rpc, int procnum, struct rpc_reply *reply) if (reply->stat.status == RPC_SUCCESS) { printf("RPC_SUCCESS"); - reply->where = replysvr->where; + reply->stat.where = replysvr->stat.where; } else if (reply->stat.status == RPC_PROGMISMATCH) { @@ -1291,7 +1289,7 @@ void rpcclnt_timer(void *arg, struct rpc_call *call) int rpcclnt_buildheader(struct rpcclnt *rc, int procid, int xidp, struct rpc_call *call) { - struct timeval *tv; + struct timeval *tv = NULL; srand(time(NULL)); /* The RPC header.*/ @@ -1326,6 +1324,7 @@ int rpcclnt_buildheader(struct rpcclnt *rc, int procid, call->rpc_auth.authlen = txdr_unsigned(sizeof(NULL)); tv->tv_sec = 1; + tv->tv_usec = 0; #ifdef CONFIG_NFS_UNIX_AUTH call->rpc_unix.ua_time = txdr_unsigned(tv->tv_sec); call->rpc_unix.ua_hostname = 0; @@ -1368,3 +1367,4 @@ int rpcclnt_cancelreqs(struct rpcclnt *rpc) return (EBUSY); } +#endif |