VxWorks Reference Manual : Libraries
nfsdLib - Network File System (NFS) server library
nfsdInit( ) - initialize the NFS server
nfsdStatusGet( ) - get the status of the NFS server
nfsdStatusShow( ) - show the status of the NFS server
This library is an implementation of version 2 of the Network File System Protocol Specification as defined in RFC 1094. It is closely connected with version 1 of the mount protocol, also defined in RFC 1094 and implemented in turn by mountLib.
The NFS server is initialized by calling nfsdInit( ). This is done automatically at boot time if the configuration macro INCLUDE_NFS_SERVER is defined.
Currently, only dosFsLib file systems are supported; RT11 file systems cannot be exported. File systems are exported with the nfsExport( ) call.
To create and export a file system, define the configuration macro INCLUDE_NFS_SERVER and rebuild VxWorks.
To export VxWorks file systems via NFS, you need facilities from both this library and from mountLib. To include both, define INCLUDE_NFS_SERVER and rebuild VxWorks.
Use the mountLib routine nfsExport( ) to export file systems. For an example, see the manual page for mountLib.
VxWorks does not normally provide authentication services for NFS requests, and the DOS file system does not provide file permissions. If you need to authenticate incoming requests, see the documentation for nfsdInit( ) and mountdInit( ) for information about authorization hooks.
The following requests are accepted from clients. For details of their use, see RFC 1094, "NFS: Network File System Protocol Specification."
Procedure Name Procedure Number NFSPROC_NULL 0 NFSPROC_GETATTR 1 NFSPROC_SETATTR 2 NFSPROC_ROOT 3 NFSPROC_LOOKUP 4 NFSPROC_READLINK 5 NFSPROC_READ 6 NFSPROC_WRITE 8 NFSPROC_CREATE 9 NFSPROC_REMOVE 10 NFSPROC_RENAME 11 NFSPROC_LINK 12 NFSPROC_SYMLINK 13 NFSPROC_MKDIR 14 NFSPROC_RMDIR 15 NFSPROC_READDIR 16 NFSPROC_STATFS 17
Currently, no authentication is done on NFS requests. nfsdInit( ) describes the authentication hooks that can be added should authentication be necessary.
Note that the DOS file system does not provide information about ownership or permissions on individual files. Before initializing a dosFs file system, three global variables--dosFsUserId, dosFsGroupId, and dosFsFileMode--can be set to define the user ID, group ID, and permissions byte for all files in all dosFs volumes initialized after setting these variables. To arrange for different dosFs volumes to use different user and group ID numbers, reset these variables before each volume is initialized. See the manual entry for dosFsLib for more information.
Several NFS tasks are created by nfsdInit( ). They are:
- tMountd
- The mount daemon, which handles all incoming mount requests. This daemon is created by mountdInit( ), which is automatically called from nfsdInit( ).
- tNfsd
- The NFS daemon, which queues all incoming NFS requests.
- tNfsdX
- The NFS request handlers, which dequeues and processes all incoming NFS requests.
Performance of the NFS file system can be improved by increasing the number of servers specified in the nfsdInit( ) call, if there are several different dosFs volumes exported from the same target system. The spy( ) utility can be called to determine whether this is useful for a particular configuration.
nfsdInit( ) - initialize the NFS server
STATUS nfsdInit ( int nServers, /* the number of NFS servers to create */ int nExportedFs, /* maximum number of exported file systems */ int priority, /* the priority for the NFS servers */ FUNCPTR authHook, /* authentication hook */ FUNCPTR mountAuthHook, /* authentication hook for mount daemon */ int options /* currently unused */ )
This routine initializes the NFS server. nServers specifies the number of tasks to be spawned to handle NFS requests. priority is the priority that those tasks will run at. authHook is a pointer to an authorization routine. mountAuthHook is a pointer to a similar routine, passed to mountdInit( ). options is provided for future expansion.
Normally, no authorization is performed by either mountd or nfsd. If you want to add authorization, set authHook to a function pointer to a routine declared as follows:
nfsstat routine ( int progNum, /* RPC program number */ int versNum, /* RPC program version number */ int procNum, /* RPC procedure number */ struct sockaddr_in clientAddr, /* address of the client */ NFSD_ARGUMENT * nfsdArg /* argument of the call */ )The authHook routine should return NFS_OK if the request is authorized, and NFSERR_ACCES if not. (NFSERR_ACCES is not required; any legitimate NFS error code can be returned.)See mountdInit( ) for documentation on mountAuthHook. Note that mountAuthHook and authHook can point to the same routine. Simply use the progNum, versNum, and procNum fields to decide whether the request is an NFS request or a mountd request.
OK, or ERROR if the NFS server cannot be started.
nfsdLib, nfsExport( ), mountdInit( )
nfsdStatusGet( ) - get the status of the NFS server
STATUS nfsdStatusGet ( NFS_SERVER_STATUS * serverStats /* pointer to status structure */ )
This routine gets status information about the NFS server.
OK, or ERROR if the information cannot be obtained.
nfsdStatusShow( ) - show the status of the NFS server
STATUS nfsdStatusShow ( int options /* unused */ )
This routine shows status information about the NFS server.
OK, or ERROR if the information cannot be obtained.