Sun (TM) NFS (TM) is one of the most widely used network file access
systems. NFS uses RPC to provide the access primitives from client to
server. Sun have devised their own RPC protocol, together with their
own external data representation language called XDR.
The NFS model of the world is of stateless Servers. Servers keep no
track of whether any clients exist, or who they are if they do.
Instead, client retry is relied on to provide reliability. The RPC is
an At Most Once time, so the defined operations are all idempotent, as
far as possible (i.e. assuming the actual file data doesn't change,
repeating the operation produces the same client and server state change.
Since NFS is usually used for access from or to Unix systems, this
means that there is a level of indirection, since the Unix file access
primitives are by no means idempotent (a <#2410#> read<#2410#> operation, moves
an implicit pointer through a file, while an NFS read references an
absolute offset in a file).
The model of the actual filesystem is that of Unix. The name space
is a hierarchy which consists of directories or files. Directories are
everything except the leaf nodes.
Location transparency is provided by permitting any point in the tree
to be a link to a (possibly) remote file system (a ;SPM_quot;mount point;SPM_quot;).
Thus, NFS looks up one component of a pathname at a time.
A table is kept that maps mount points to remote server machine names,
and thus provides the location service.
The collection of server procedures are fairly simple, and a subset of
these is reproduced in figure #fnnfs#2411> from the RFC that describes NFS.
#figure2412#
Figure: NFS XDR Declaration
-
NFSPROC_NULL(void) = 0;
This procedure does no work. It is made available in all RPC
services to allow server response testing and timing.
-
attrstat NFSPROC_GETATTR (fhandle) = 1;
If the reply status is NFS_OK, then the reply attributes contains the
attributes for the file given by the input fhandle.
-
attrstat NFSPROC_SETATTR (sattrargs) = 2;
verbatim90
The ;SPM_quot;attributes;SPM_quot; argument contains fields which are either -1 or are
the new value for the attributes of ;SPM_quot;file;SPM_quot;. If the reply status is
NFS_OK, then the reply attributes have the attributes of the file
after the ;SPM_quot;SETATTR;SPM_quot; operation has completed.
Notes: The use of -1 to indicate an unused field in ;SPM_quot;attributes;SPM_quot; is
changed in the next version of the protocol.
-
diropres NFSPROC_LOOKUP(diropargs) = 4;
If the reply ;SPM_quot;status;SPM_quot; is NFS_OK, then the reply ;SPM_quot;file;SPM_quot; and reply
;SPM_quot;attributes;SPM_quot; are the file handle and attributes for the file ;SPM_quot;name;SPM_quot;
in the directory given by ;SPM_quot;dir;SPM_quot; in the argument.
-
readlinkres NFSPROC_READLINK(fhandle) = 5;
verbatim91
If ;SPM_quot;status;SPM_quot; has the value NFS_OK, then the reply ;SPM_quot;data;SPM_quot; is the data
in the symbolic link given by the file referred to by the fhandle
argument.
Notes: Since NFS always parses pathnames on the client, the pathname
in a symbolic link may mean something different (or be meaningless)
on a different client or on the server if a different pathname syntax
is used.
-
readres NFSPROC_READ(readargs) = 6;
verbatim92
Returns up to ;SPM_quot;count;SPM_quot; bytes of ;SPM_quot;data;SPM_quot; from the file given by ;SPM_quot;file;SPM_quot;,
starting at ;SPM_quot;offset;SPM_quot; bytes from the beginning of the file. The first
byte of the file is at offset zero. The file attributes after the
read takes place are returned in ;SPM_quot;attributes;SPM_quot;.
Notes: The argument ;SPM_quot;totalcount;SPM_quot; is unused, and is removed in the
next protocol revision.
-
attrstat NFSPROC_WRITE(writeargs) = 8;
verbatim93
Writes ;SPM_quot;data;SPM_quot; beginning ;SPM_quot;offset;SPM_quot; bytes from the beginning of ;SPM_quot;file;SPM_quot;.
The first byte of the file is at offset zero. If the reply ;SPM_quot;status;SPM_quot;
is NFS_OK, then the reply ;SPM_quot;attributes;SPM_quot; contains the attributes of the
file after the write has completed. The write operation is atomic.
Data from this ;SPM_quot;WRITE;SPM_quot; will not be mixed with data from another
client's ;SPM_quot;WRITE;SPM_quot;.
Notes: The arguments ;SPM_quot;beginoffset;SPM_quot; and ;SPM_quot;totalcount;SPM_quot; are ignored and
are removed in the next protocol revision.
-
diropres NFSPROC_CREATE(createargs) = 9;
verbatim94
The file ;SPM_quot;name;SPM_quot; is created in the directory given by ;SPM_quot;dir;SPM_quot;. The
initial attributes of the new file are given by ;SPM_quot;attributes;SPM_quot;. A
reply ;SPM_quot;status;SPM_quot; of NFS_OK indicates that the file was created, and
reply ;SPM_quot;file;SPM_quot; and reply ;SPM_quot;attributes;SPM_quot; are its file handle and
attributes. Any other reply ;SPM_quot;status;SPM_quot; means that the operation failed
and no file was created.
Notes: This routine should pass an exclusive create flag, meaning
;SPM_quot;create the file only if it is not already there;SPM_quot;.
-
stat NFSPROC_REMOVE(diropargs) = 10;
The file ;SPM_quot;name;SPM_quot; is removed from the directory given by ;SPM_quot;dir;SPM_quot;. A
reply of NFS_OK means the directory entry was removed.
Notes: possibly non-idempotent operation.