The mount protocol is separate from, but related to, the NFS protocol. It provides operating system specific services to get the NFS off the ground -- looking up server path names, validating user identity, and checking access permissions. Clients use the mount protocol to get the first file handle, which allows them entry into a remote filesystem.
The mount protocol is kept separate from the NFS protocol to make it easy to plug in new access checking and validation methods without changing the NFS server protocol.
Notice that the protocol definition implies stateful servers because the server maintains a list of client's mount requests. The mount list information is not critical for the correct functioning of either the client or the server. It is intended for advisory use only, for example, to warn possible clients when a server is going down.
Version one of the mount protocol is used with version two of the NFS protocol. The only connecting point is the fhandle structure, which is the same for both protocols.
These are the sizes, given in decimal bytes, of various XDR structures used in the protocol:
/* The maximum number of bytes in a pathname argument */ const MNTPATHLEN = 1024; /* The maximum number of bytes in a name argument */ const MNTNAMLEN = 255; /* The size in bytes of the opaque file handle */ const FHSIZE = 32;
This section presents the data types used by the mount protocol. In many cases they are similar to the types used in NFS.
typedef opaque fhandle[FHSIZE];
This is the same as the "fhandle" XDR definition in version 2 of the NFS protocol; see Basic Data Types in the definition of the NFS protocol, above.
union fhstatus switch (unsigned status) { case 0: fhandle directory; default: void; };
typedef string dirpath<MNTPATHLEN>;
typedef string name<MNTNAMLEN>;
The following sections define the RPC procedures supplied by a mount server.
/* * Protocol description for the mount program */ program MOUNTPROG { /* * Version 1 of the mount protocol used with * version 2 of the NFS protocol. */ version MOUNTVERS { void MOUNTPROC_NULL(void) = 0; fhstatus MOUNTPROC_MNT(dirpath) = 1; mountlist MOUNTPROC_DUMP(void) = 2; void MOUNTPROC_UMNT(dirpath) = 3; void MOUNTPROC_UMNTALL(void) = 4; exportlist MOUNTPROC_EXPORT(void) = 5; } = 1; } = 100005;
void MNTPROC_NULL(void) = 0;
fhstatus MNTPROC_MNT(dirpath) = 1;
struct *mountlist { name hostname; dirpath directory; mountlist nextentry; }; mountlist MNTPROC_DUMP(void) = 2;
void MNTPROC_UMNT(dirpath) = 3;
void MNTPROC_UMNTALL(void) = 4;
struct *groups { name grname; groups grnext; }; struct *exportlist { dirpath filesys; groups groups; exportlist next; }; exportlist MNTPROC_EXPORT(void) = 5;
Note: The exportlist should contain more information about the status of the filesystem, such as a read-only flag.