From e86677150cb75dbed5cf78a5f3442da38269a821 Mon Sep 17 00:00:00 2001 From: patacongo Date: Mon, 18 Jun 2012 16:20:40 +0000 Subject: [PATCH] Add NFS How-To document git-svn-id: https://nuttx.svn.sourceforge.net/svnroot/nuttx/trunk@4849 7fd9a85b-ad96-42d3-883c-3090e2eb8679 --- nuttx/ChangeLog | 6 + nuttx/Documentation/NfsHowto.html | 341 ++++++++++++++++++++ nuttx/Documentation/NuttXDocumentation.html | 1 + 3 files changed, 348 insertions(+) create mode 100644 nuttx/Documentation/NfsHowto.html diff --git a/nuttx/ChangeLog b/nuttx/ChangeLog index 8eb1235ed..a7fc1633d 100644 --- a/nuttx/ChangeLog +++ b/nuttx/ChangeLog @@ -2904,3 +2904,9 @@ the PL2303 emulation driver several months back. 6.20 2012-xx-xx Gregory Nutt + + * configs/stm3210e-eval/src and arch/arm/src/stm32/: Add beginnings of + power management support for the STM32 and the STM3210E-EVAL board, in + particular. + * Documentation/NfsHowTo.html: Add a How-To document for the new NFS + client feature. diff --git a/nuttx/Documentation/NfsHowto.html b/nuttx/Documentation/NfsHowto.html new file mode 100644 index 000000000..e62af074e --- /dev/null +++ b/nuttx/Documentation/NfsHowto.html @@ -0,0 +1,341 @@ + + +NFS Client How-To + + +

+ + + + + +
+

NFS Client How-To

+

Last Updated: June 18, 2012

+
+

+ + + + + +
+

Table of Contents

+
+ +
+ + + +
+ + + + + +
+ Mount Interface +
+ + + + + +
+ NFS Mount Command +
+ + + + + +
+ Configuring the NFS server (Ubuntu) +
+
+ + + + + +
+

Mount Interface

+
+ +

+ A low-level, C-callable interface is provided to mount a file system. + That interface is called mount() and is mentioned in the porting guide and is prototyped in the header file include/sys/mount.h: +

+ +

+ Synopsis: + mount() attaches the filesystem specified by the source block device name into the root file system at the path specified by target. +

+

+ Input Paramters: +

+

+

+ Returned Values + Zero is returned on success; -1 is returned on an error and errno is set appropriately: +

+

+

+ This same interface can be used to mount a remote, NFS file system using some special parameters. + The NFS mount differs from the normal file system mount in that: (1) there is no block driver for the NFS file system, and (2) special parameters must be passed as data to describe the remote NFS server. + Thus the following code snippet might represent how an NFS file system is mounted: +

+ +

+ NOTE that: (1) the block driver paramter is NULL. + The mount() is smart enough to know that no block driver is needed with the NFS file system. + (2) The NFS file system is identified with the simple string "nfs" + (3) A reference to struct nfs_args is passed as an NFS-specific argument. +

+

+ The NFS-specific interface is described in the file include/nuttx/fs/nfs.h. + There you can see that struct nfs_args is defined as: +

+ + + + + + +
+

NFS Mount Command

+
+ +

+ The NuttShell (NSH) also supports a command called nfsmount + that can be used to mount a remote file system via the NSH command line. +

+

+ Command Syntax: +

+ +

+ Synopsis. + The nfsmount command mounts a network file system in the NuttX psuedo filesystem. + The nfsmount will use NFSv3 UDP protocol to mount the remote file system. +

+

+ Command Line Arguments. + The nfsmount takes three arguments: +

+
    +
  1. + The <server-address> is the IP address of the server exporting the file system you wish to mount. + This implementation of NFS for the NuttX RTOS is only for a local area network, so the server and client must be in the same network. +
  2. +
  3. + The <mount-point > is the location in the NuttX pseudo filesystem where the mounted volume will appear. + This mount point can only reside in the NuttX pseudo filesystem. + By convention, this mount point is a subdirectory under /mnt. + The mount command will create whatever psuedo directories that may be needed to complete the full path (but the full path must not already exist). +
  4. +
  5. + The <remote-path> is the file system / directory being exported from server. + This / directory must have been configured for exportation on the server before when the NFS server was set up. +
  6. +
+ +

+ After the volume has been mounted in the NuttX pseudo filesystem, it may be access in the same way as other objects in the file system. +

+

+ Example. + Suppose the the NFS server has been configured to export the directory /export/shared. + The the following command would mount that file system (assuming that the target also has privileges to mount the file system). +

+ + + + + + +
+

Configuring the NFS server (Ubuntu)

+
+ +

+ Setting up the server will be done in two steps: + First, setting up the configuration file for NFS, and then starting the NFS services. + But first, you need to install the nfs server on Ubuntu with the these two commands: +

+ + +

+ After that, we need to make or choose the directory we want to export from the NFS server. + In our case, we are going to make a new directory called /export. +

+ +

+ It is important that /export directory allow access to everyone (777 permissions) as we will be accessing the NFS share from the client with no authentication. +

+ +

+ When all this is done, we will need to edit the configuration file to set up an NFS server: /etc/exports. + This file contains a list of entries; + each entry indicates a volume that is shared and how it is shared. + For more information for a complete description of all the setup options for this file you can check in the man pages (man export).

+ An entry in /etc/exports will typically look like this: +

+ +

+ So for our example we export /export to the client 10.0.0.2 add the entry: +

+ +

+ In our case we are using all the default options except for the ro that we replaced with rw so that our client will have read and write access to the directory that we are exporting. +

+

+ After we do all the require configurations, we are ready to start the server with the next command: +

+ +

+ Note: If you later decide to add more NFS exports to the /etc/exports file, you will need to either restart NFS daemon +or run command exportfs. +

+ +

Or

+ +

+ Now we can check if the export directory and our mount point is properly set up. +

+ +

+ And also we can verify if NFS is running in the system with: +

+

+

+

+ Now your NFS sever is sharing /export directory to be accessed. +

+ + + diff --git a/nuttx/Documentation/NuttXDocumentation.html b/nuttx/Documentation/NuttXDocumentation.html index 242c5fb68..cec713135 100644 --- a/nuttx/Documentation/NuttXDocumentation.html +++ b/nuttx/Documentation/NuttXDocumentation.html @@ -35,6 +35,7 @@
  • NXFLAT
  • NX Graphics
  • NxWidgets
  • +
  • NFS How-To
  • Demand Paging
  • USB Trace
  • README Files