VxWorks Reference Manual : Libraries

mountLib

NAME

mountLib - Mount protocol library

ROUTINES

mountdInit( ) - initialize the mount daemon
nfsExport( ) - specify a file system to be NFS exported
nfsUnexport( ) - remove a file system from the list of exported file systems

DESCRIPTION

This library implements a mount server to support mounting VxWorks file systems remotely. The mount server is an implementation of version 1 of the mount protocol as defined in RFC 1094. It is closely connected with version 2 of the Network File System Protocol Specification, which in turn is implemented by the library nfsdLib.

NOTE

The only routines in this library that are normally called by applications are nfsExport( ) and nfsUnexport( ). The mount daemon is normally initialized indirectly by nfsdInit( ).

The mount server is initialized by calling mountdInit( ). Normally, this is done by nfsdInit( ), although it is possible to call mountdInit( ) directly if the NFS server is not being initialized. Defining INCLUDE_NFS_SERVER enables the call to nfsdInit( ) during the boot process, which in turn calls mountdInit( ), so there is normally no need to call either routine manually. mountdInit( ) spawns one task, tMountd, which registers as an RPC service with the portmapper.

Currently, only dosFsLib file systems are supported; RT11 file systems cannot be exported. File systems are exported with the nfsExport( ) call.

To export VxWorks file systems via NFS, you need facilities from both this library and from nfsdLib. To include both, define the configuration macro INCLUDE_NFS_SERVER and rebuild VxWorks.

Example

The following example illustrates how to export an existing dosFs file system.

First, initialize the block device containing your file system.

Then assuming the dosFs system is called "/export" execute the following code on the target:

nfsExport ("/export", 0, FALSE, 0);           /* make available remotely */
This makes it available to all clients to be mounted using the client's NFS mounting command. (On UNIX systems, mounting file systems normally requires root privileges.)

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 Appendix A of RFC 1094, "NFS: Network File System Protocol Specification."

Procedure Name Procedure Number

MOUNTPROC_NULL 0
MOUNTPROC_MNT 1
MOUNTPROC_DUMP 2
MOUNTPROC_UMNT 3
MOUNTPROC_UMNTALL 4
MOUNTPROC_EXPORT 5

SEE ALSO

mountLib, dosFsLib, nfsdLib, RFC 1094


Libraries : Routines

mountdInit( )

NAME

mountdInit( ) - initialize the mount daemon

SYNOPSIS

STATUS mountdInit
    (
    int     priority,  /* priority of the mount daemon */
    int     stackSize, /* stack size of the mount daemon */
    FUNCPTR authHook,  /* hook to run to authorize each request */
    int     nExports,  /* maximum number of exported file systems */
    int     options    /* currently unused - set to 0 */
    )

DESCRIPTION

This routine spawns a mount daemon if one does not already exist. Defaults for the priority and stackSize arguments are in the global variables mountdPriorityDefault and mountdStackSizeDefault, and are initially set to MOUNTD_PRIORITY_DEFAULT and MOUNTD_STACKSIZE_DEFAULT respectively.

Normally, no authorization checking is performed by either mountd or nfsd. To add authorization checking, set authHook to point 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 */
    MOUNTD_ARGUMENT *  mountdArg      /* argument of the call */
    )
The authHook callback must return OK if the request is authorized, and any defined NFS error code (usually NFSERR_ACCES) if not.

RETURNS

OK, or ERROR if the mount daemon could not be correctly initialized.

SEE ALSO

mountLib


Libraries : Routines

nfsExport( )

NAME

nfsExport( ) - specify a file system to be NFS exported

SYNOPSIS

STATUS nfsExport
    (
    char * directory, /* Directory to export - FS must support NFS */
    int    id,        /* ID number for file system */
    BOOL   readOnly,  /* TRUE if file system is exported read-only */
    int    options    /* Reserved for future use - set to 0 */
    )

DESCRIPTION

This routine makes a file system available for mounting by a client. The client should be in the local host table (see hostAdd( )), although this is not required.

The id parameter can either be set to a specific value, or to 0. If it is set to 0, an ID number is assigned sequentially. Every time a file system is exported, it must have the same ID number, or clients currently mounting the file system will not be able to access files.

To display a list of exported file systems, use:

    -> nfsExportShow "localhost"

RETURNS

OK, or ERROR if the file system could not be exported.

SEE ALSO

mountLib, nfsLib, nfsExportShow( ), nfsUnexport( )


Libraries : Routines

nfsUnexport( )

NAME

nfsUnexport( ) - remove a file system from the list of exported file systems

SYNOPSIS

STATUS nfsUnexport
    (
    char * dirName /* Name of the directory to unexport */
    )

DESCRIPTION

This routine removes a file system from the list of file systems exported from the target. Any client attempting to mount a file system that is not exported will receive an error (NFSERR_ACCESS).

RETURNS

OK, or ERROR if the file system could not be removed from the exports list.

ERRNO

ENOENT

SEE ALSO

mountLib, nfsLib, nfsExportShow( ), nfsExport( )