diff options
author | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-06-27 22:03:32 +0000 |
---|---|---|
committer | patacongo <patacongo@42af7a65-404d-4744-a932-0658087f49c3> | 2012-06-27 22:03:32 +0000 |
commit | 56224ea316165af86d3db983464e40e1b5b2ac63 (patch) | |
tree | 9bf3f1ac1df2f9519effd9e9fc42c4a60c278d4b /nuttx/fs/nfs/nfs_vfsops.c | |
parent | c7b072472b974b59b144ee4e2a3fe4cab92baf82 (diff) | |
download | px4-nuttx-56224ea316165af86d3db983464e40e1b5b2ac63.tar.gz px4-nuttx-56224ea316165af86d3db983464e40e1b5b2ac63.tar.bz2 px4-nuttx-56224ea316165af86d3db983464e40e1b5b2ac63.zip |
Refactor nfs_socket.c/.h logic; Those files are not gone
git-svn-id: svn://svn.code.sf.net/p/nuttx/code/trunk@4878 42af7a65-404d-4744-a932-0658087f49c3
Diffstat (limited to 'nuttx/fs/nfs/nfs_vfsops.c')
-rw-r--r-- | nuttx/fs/nfs/nfs_vfsops.c | 47 |
1 files changed, 42 insertions, 5 deletions
diff --git a/nuttx/fs/nfs/nfs_vfsops.c b/nuttx/fs/nfs/nfs_vfsops.c index 12c4705dd..3cd5a47dc 100644 --- a/nuttx/fs/nfs/nfs_vfsops.c +++ b/nuttx/fs/nfs/nfs_vfsops.c @@ -81,7 +81,6 @@ #include "nfs_node.h" #include "nfs_mount.h" #include "xdr_subs.h" -#include "nfs_socket.h" /**************************************************************************** * Pre-processor Definitions @@ -104,6 +103,18 @@ #endif /**************************************************************************** + * Public Variables + ****************************************************************************/ + +uint32_t nfs_true; +uint32_t nfs_false; +uint32_t nfs_xdrneg1; + +#ifdef CONFIG_NFS_STATISTICS +struct nfsstats nfsstats; +#endif + +/**************************************************************************** * Private Type Definitions ****************************************************************************/ @@ -947,6 +958,7 @@ static ssize_t nfs_write(FAR struct file *filep, const char *buffer, /* Now loop until we send the entire user buffer */ + writesize = 0; for (byteswritten = 0; byteswritten < buflen; ) { /* Make sure that the attempted write size does not exceed the RPC maximum */ @@ -1578,6 +1590,7 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR const void *data, { FAR struct nfs_args *argp = (FAR struct nfs_args *)data; FAR struct nfsmount *nmp; + struct rpcclnt *rpc; struct rpc_call_fs getattr; struct rpc_reply_getattr resok; struct nfs_mount_parameters nprmt; @@ -1643,7 +1656,11 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR const void *data, /* Initialize NFS */ - nfs_init(); + nfs_true = txdr_unsigned(TRUE); + nfs_false = txdr_unsigned(FALSE); + nfs_xdrneg1 = txdr_unsigned(-1); + + rpcclnt_init(); /* Set initial values of other fields */ @@ -1665,7 +1682,27 @@ static int nfs_bind(FAR struct inode *blkdriver, FAR const void *data, { /* Connection-less... connect now */ - error = nfs_connect(nmp); + /* Create an instance of the rpc state structure */ + + rpc = (struct rpcclnt *)kzalloc(sizeof(struct rpcclnt)); + if (!rpc) + { + fdbg("ERROR: Failed to allocate rpc structure\n"); + return ENOMEM; + } + + fvdbg("Connecting\n"); + + /* Translate nfsmnt flags -> rpcclnt flags */ + + rpc->rc_path = nmp->nm_path; + rpc->rc_name = &nmp->nm_nam; + rpc->rc_sotype = nmp->nm_sotype; + rpc->rc_retry = nmp->nm_retry; + + nmp->nm_rpcclnt = rpc; + + error = rpcclnt_connect(nmp->nm_rpcclnt); if (error != OK) { fdbg("ERROR: nfs_connect failed: %d\n", error); @@ -1708,7 +1745,7 @@ bad: { /* Disconnect from the server */ - nfs_disconnect(nmp); + rpcclnt_disconnect(nmp->nm_rpcclnt); /* Free connection-related resources */ @@ -1772,7 +1809,7 @@ int nfs_unbind(FAR void *handle, FAR struct inode **blkdriver) /* Disconnect from the server */ - nfs_disconnect(nmp); + rpcclnt_disconnect(nmp->nm_rpcclnt); /* And free any allocated resources */ |