VxWorks Reference Manual : Libraries
nfsLib - Network File System (NFS) library
nfsHelp( ) - display the NFS help menu
nfsExportShow( ) - display the exported file systems of a remote host
nfsAuthUnixPrompt( ) - modify the NFS UNIX authentication parameters
nfsAuthUnixShow( ) - display the NFS UNIX authentication parameters
nfsAuthUnixSet( ) - set the NFS UNIX authentication parameters
nfsAuthUnixGet( ) - get the NFS UNIX authentication parameters
nfsIdSet( ) - set the ID number of the NFS UNIX authentication parameters
This library provides the client side of services for NFS (Network File System) devices. Most routines in this library should not be called by users, but rather by device drivers. The driver is responsible for keeping track of file pointers, mounted disks, and cached buffers. This library uses Remote Procedure Calls (RPC) to make the NFS calls.
VxWorks is delivered with NFS disabled. The configuration macro for NFS is INCLUDE_NFS.
In the same file, NFS_USER_ID and NFS_GROUP_ID should be defined to set the default user ID and group ID at system start-up. For information about creating NFS devices, see the VxWorks Programmer's Guide: Network.
Normal use of NFS requires no more than 2000 bytes of stack.
NFS is built on top of RPC and uses a type of RPC authentication known as AUTH_UNIX, which is passed onto the NFS server with every NFS request. AUTH_UNIX is a structure that contains necessary information for NFS, including the user ID number and a list of group IDs to which the user belongs. On UNIX systems, a user ID is specified in the file /etc/passwd. The list of groups to which a user belongs is specified in the file /etc/group.
To change the default authentication parameters, use nfsAuthUnixPrompt( ). To change just the AUTH_UNIX ID, use nfsIdSet( ). Usually, only the user ID needs to be changed to indicate a new NFS user.
nfsLib.h
rpcLib, ioLib, nfsDrv, VxWorks Programmer's Guide: Network
nfsHelp( ) - display the NFS help menu
void nfsHelp (void)
This routine displays a summary of NFS facilities typically called from the shell:
nfsHelp Print this list netHelp Print general network help list nfsMount "host","filesystem"[,"devname"] Create device with file system/directory from host nfsUnmount "devname" Remove an NFS device nfsAuthUnixShow Print current UNIX authentication nfsAuthUnixPrompt Prompt for UNIX authentication nfsIdSet id Set user ID for UNIX authentication nfsDevShow Print list of NFS devices nfsExportShow "host" Print a list of NFS file systems which are exported on the specified host mkdir "dirname" Create directory rm "file" Remove file EXAMPLE: -> hostAdd "wrs", "90.0.0.2" -> nfsMount "wrs","/disk0/path/mydir","/mydir/" -> cd "/mydir/" -> nfsAuthUnixPrompt /* fill in user ID, etc. */ -> ls /* list /disk0/path/mydir */ -> copy < foo /* copy foo to standard out */ -> ld < foo.o /* load object module foo.o */ -> nfsUnmount "/mydir/" /* remove NFS device /mydir/ */
N/A
nfsExportShow( ) - display the exported file systems of a remote host
STATUS nfsExportShow ( char * hostName /* host machine to show exports for */ )
This routine displays the file systems of a specified host and the groups that are allowed to mount them.
-> nfsExportShow "wrs" /d0 staff /d1 staff eng /d2 eng /d3 value = 0 = 0x0
OK or ERROR.
nfsAuthUnixPrompt( ) - modify the NFS UNIX authentication parameters
void nfsAuthUnixPrompt (void)
This routine allows UNIX authentication parameters to be changed from the shell. The user is prompted for each parameter, which can be changed by entering the new value next to the current one.
-> nfsAuthUnixPrompt machine name: yuba user ID: 2001 128 group ID: 100 num of groups: 1 3 group #1: 100 100 group #2: 0 120 group #3: 0 200 value = 3 = 0x3
nfsLib, nfsAuthUnixShow( ), nfsAuthUnixSet( ), nfsAuthUnixGet( ), nfsIdSet( )
nfsAuthUnixShow( ) - display the NFS UNIX authentication parameters
void nfsAuthUnixShow (void)
This routine displays the parameters set by nfsAuthUnixSet( ) or nfsAuthUnixPrompt( ).
-> nfsAuthUnixShow machine name = yuba user ID = 2001 group ID = 100 group [0] = 100 value = 1 = 0x1
N/A
nfsLib, nfsAuthUnixPrompt( ), nfsAuthUnixSet( ), nfsAuthUnixGet( ), nfsIdSet( )
nfsAuthUnixSet( ) - set the NFS UNIX authentication parameters
void nfsAuthUnixSet ( char * machname, /* host machine */ int uid, /* user ID */ int gid, /* group ID */ int ngids, /* number of group IDs */ int * aup_gids /* array of group IDs */ )
This routine sets UNIX authentication parameters. It is initially called by usrNetInit( ) in usrConfig.c. machname should be set with the name of the mounted system (i.e. the target name itself) to distinguish hosts from hosts on a NFS network.
N/A
nfsLib, nfsAuthUnixPrompt( ), nfsAuthUnixShow( ), nfsAuthUnixGet( ), nfsIdSet( ), usrConfig
nfsAuthUnixGet( ) - get the NFS UNIX authentication parameters
void nfsAuthUnixGet ( char * machname, /* where to store host machine */ int * pUid, /* where to store user ID */ int * pGid, /* where to store group ID */ int * pNgids, /* where to store number of group IDs */ int * gids /* where to store array of group IDs */ )
This routine gets the previously set UNIX authentication values.
N/A
nfsLib, nfsAuthUnixPrompt( ), nfsAuthUnixShow( ), nfsAuthUnixSet( ), nfsIdSet( )
nfsIdSet( ) - set the ID number of the NFS UNIX authentication parameters
void nfsIdSet ( int uid /* user ID on host machine */ )
This routine sets only the UNIX authentication user ID number. For most NFS permission needs, only the user ID needs to be changed. Set uid to the user ID on the NFS server.
N/A
nfsLib, nfsAuthUnixPrompt( ), nfsAuthUnixShow( ), nfsAuthUnixSet( ), nfsAuthUnixGet( )