home *** CD-ROM | disk | FTP | other *** search
/ ftp.cse.unsw.edu.au / 2014.06.ftp.cse.unsw.edu.au.tar / ftp.cse.unsw.edu.au / pub / doc / standards / rfc / rfc1094.Z / rfc1094
Encoding:
Text File  |  1992-10-18  |  48.8 KB  |  1,509 lines

  1. Network Working Group                             Sun Microsystems, Inc.
  2. Request for Comments: 1094                                    March 1989
  3.  
  4.  
  5.             NFS: Network File System Protocol Specification
  6.  
  7. STATUS OF THIS MEMO
  8.  
  9.    This RFC describes a protocol that Sun Microsystems, Inc., and others
  10.    are using.  A new version of the protocol is under development, but
  11.    others may benefit from the descriptions of the current protocol, and
  12.    discussion of some of the design issues.  Distribution of this memo
  13.    is unlimited.
  14.  
  15. 1. INTRODUCTION
  16.  
  17.    The Sun Network Filesystem (NFS) protocol provides transparent remote
  18.    access to shared files across networks.  The NFS protocol is designed
  19.    to be portable across different machines, operating systems, network
  20.    architectures, and transport protocols.  This portability is achieved
  21.    through the use of Remote Procedure Call (RPC) primitives built on
  22.    top of an eXternal Data Representation (XDR).  Implementations
  23.    already exist for a variety of machines, from personal computers to
  24.    supercomputers.
  25.  
  26.    The supporting mount protocol allows the server to hand out remote
  27.    access privileges to a restricted set of clients.  It performs the
  28.    operating system-specific functions that allow, for example, to
  29.    attach remote directory trees to some local file system.
  30.  
  31. 1.1.  Remote Procedure Call
  32.  
  33.    Sun's Remote Procedure Call specification provides a procedure-
  34.    oriented interface to remote services.  Each server supplies a
  35.    "program" that is a set of procedures.  NFS is one such program.  The
  36.    combination of host address, program number, and procedure number
  37.    specifies one remote procedure.  A goal of NFS was to not require any
  38.    specific level of reliability from its lower levels, so it could
  39.    potentially be used on many underlying transport protocols, or even
  40.    another remote procedure call implementation.  For ease of
  41.    discussion, the rest of this document will assume NFS is implemented
  42.    on top of Sun RPC, described in  RFC 1057, "RPC: Remote Procedure
  43.    Call Protocol Specification".
  44.  
  45. 1.2.  External Data Representation
  46.  
  47.    The eXternal Data Representation (XDR) standard provides a common way
  48.    of representing a set of data types over a network.  The NFS Protocol
  49.  
  50.  
  51.  
  52. Sun Microsystems, Inc.                                          [Page 1]
  53.  
  54. RFC 1094                NFS: Network File System              March 1989
  55.  
  56.  
  57.    Specification is written using the RPC data description language.
  58.    For more information, see RFC 1014, "XDR: External Data
  59.    Representation Standard".  Although automated RPC/XDR compilers exist
  60.    to generate server and client "stubs", NFS does not require their
  61.    use.  Any software that provides equivalent functionality can be
  62.    used, and if the encoding is exactly the same it can interoperate
  63.    with other implementations of NFS.
  64.  
  65. 1.3.  Stateless Servers
  66.  
  67.    The NFS protocol was intended to be as stateless as possible.  That
  68.    is, a server should not need to maintain any protocol state
  69.    information about any of its clients in order to function correctly.
  70.    Stateless servers have a distinct advantage over stateful servers in
  71.    the event of a failure.  With stateless servers, a client need only
  72.    retry a request until the server responds; it does not even need to
  73.    know that the server has crashed, or the network temporarily went
  74.    down.  The client of a stateful server, on the other hand, needs to
  75.    either detect a server failure and rebuild the server's state when it
  76.    comes back up, or cause client operations to fail.
  77.  
  78.    This may not sound like an important issue, but it affects the
  79.    protocol in some unexpected ways.  We feel that it may be worth a bit
  80.    of extra complexity in the protocol to be able to write very simple
  81.    servers that do not require fancy crash recovery.  Note that even if
  82.    a so-called "reliable" transport protocol such as TCP is used, the
  83.    client must still be able to handle interruptions of service by re-
  84.    opening connections when they time out.  Thus, a stateless protocol
  85.    may actually simplify the  implementation.
  86.  
  87.    On the other hand, NFS deals with objects such as files and
  88.    directories that inherently have state -- what good would a file be
  89.    if it did not keep its contents intact?  The goal was to not
  90.    introduce any extra state in the protocol itself.  Inherently
  91.    stateful operations such as file or record locking, and remote
  92.    execution,  were implemented as separate services, not described in
  93.    this document.
  94.  
  95.    The basic way to simplify recovery was to make operations as
  96.    "idempotent" as possible (so that they can potentially be repeated).
  97.    Some operations in this version of the protocol did not attain this
  98.    goal; luckily most of the operations (such as Read and Write) are
  99.    idempotent.  Also, most server failures occur between operations, not
  100.    between the receipt of an operation and the response.  Finally,
  101.    although actual server failures may be rare, in complex networks,
  102.    failures of any network, router, or bridge may be indistinguishable
  103.    from a server failure.
  104.  
  105.  
  106.  
  107.  
  108. Sun Microsystems, Inc.                                          [Page 2]
  109.  
  110. RFC 1094                NFS: Network File System              March 1989
  111.  
  112.  
  113. 2. NFS PROTOCOL DEFINITION
  114.  
  115.    Servers change over time, and so can the protocol that they use.  RPC
  116.    provides a version number with each RPC request.  This RFC describes
  117.    version two of the NFS protocol.  Even in the second version, there
  118.    are a few obsolete procedures and parameters, which will be removed
  119.    in later versions.  An RFC for version three of the NFS protocol is
  120.    currently under preparation.
  121.  
  122. 2.1.  File System Model
  123.  
  124.    NFS assumes a file system that is hierarchical, with directories as
  125.    all but the bottom level of files.  Each entry in a directory (file,
  126.    directory, device, etc.) has a string name.  Different operating
  127.    systems may have restrictions on the depth of the tree or the names
  128.    used, as well as using different syntax to represent the "pathname",
  129.    which is the concatenation of all the "components" (directory and
  130.    file names) in the name.  A "file system" is a tree on a single
  131.    server (usually a single disk or physical partition) with a specified
  132.    "root".  Some operating systems provide a "mount" operation to make
  133.    all file systems appear as a single tree, while others maintain a
  134.    "forest" of file systems.  Files are unstructured streams of
  135.    uninterpreted bytes.  Version 3 of NFS uses slightly more general
  136.    file system model.
  137.  
  138.    NFS looks up one component of a pathname at a time.  It may not be
  139.    obvious why it does not just take the whole pathname, traipse down
  140.    the directories, and return a file handle when it is done.  There are
  141.    several good reasons not to do this.  First, pathnames need
  142.    separators between the directory components, and different operating
  143.    systems use different separators.  We could define a Network Standard
  144.    Pathname Representation, but then every pathname would have to be
  145.    parsed and converted at each end.  Other issues are discussed in
  146.    section 3, NFS Implementation Issues.
  147.  
  148.    Although files and directories are similar objects in many ways,
  149.    different procedures are used to read directories and files.  This
  150.    provides a network standard format for representing directories.  The
  151.    same argument as above could have been used to justify a procedure
  152.    that returns only one directory entry per call.  The problem is
  153.    efficiency.  Directories can contain many entries, and a remote call
  154.    to return each would be just too slow.
  155.  
  156. 2.2.  Server Procedures
  157.  
  158.    The protocol definition is given as a set of procedures with
  159.    arguments and results defined using the RPC language (XDR language
  160.    extended with program, version, and procedure declarations).  A brief
  161.  
  162.  
  163.  
  164. Sun Microsystems, Inc.                                          [Page 3]
  165.  
  166. RFC 1094                NFS: Network File System              March 1989
  167.  
  168.  
  169.    description of the function of each procedure should provide enough
  170.    information to allow implementation.  Section 2.3 describes the basic
  171.    data types in more detail.
  172.  
  173.    All of the procedures in the NFS protocol are assumed to be
  174.    synchronous.  When a procedure returns to the client, the client can
  175.    assume that the operation has completed and any data associated with
  176.    the request is now on stable storage.  For example, a client WRITE
  177.    request may cause the server to update data blocks, filesystem
  178.    information blocks (such as indirect blocks), and file attribute
  179.    information (size and modify times).  When the WRITE returns to the
  180.    client, it can assume that the write is safe, even in case of a
  181.    server crash, and it can discard the data written.  This is a very
  182.    important part of the statelessness of the server.  If the server
  183.    waited to flush data from remote requests, the client would have to
  184.    save those requests so that it could resend them in case of a server
  185.    crash.
  186.  
  187.            /*
  188.             * Remote file service routines
  189.             */
  190.            program NFS_PROGRAM {
  191.                    version NFS_VERSION {
  192.                            void
  193.                            NFSPROC_NULL(void)              = 0;
  194.  
  195.                            attrstat
  196.                            NFSPROC_GETATTR(fhandle)        = 1;
  197.  
  198.                            attrstat
  199.                            NFSPROC_SETATTR(sattrargs)      = 2;
  200.  
  201.                            void
  202.                            NFSPROC_ROOT(void)              = 3;
  203.  
  204.                            diropres
  205.                            NFSPROC_LOOKUP(diropargs)       = 4;
  206.  
  207.                            readlinkres
  208.                            NFSPROC_READLINK(fhandle)       = 5;
  209.  
  210.                            readres
  211.                            NFSPROC_READ(readargs)          = 6;
  212.  
  213.                            void
  214.                            NFSPROC_WRITECACHE(void)        = 7;
  215.  
  216.  
  217.  
  218.  
  219.  
  220. Sun Microsystems, Inc.                                          [Page 4]
  221.  
  222. RFC 1094                NFS: Network File System              March 1989
  223.  
  224.  
  225.                            attrstat
  226.                            NFSPROC_WRITE(writeargs)        = 8;
  227.  
  228.                            diropres
  229.                            NFSPROC_CREATE(createargs)      = 9;
  230.  
  231.                            stat
  232.                            NFSPROC_REMOVE(diropargs)       = 10;
  233.  
  234.                            stat
  235.                            NFSPROC_RENAME(renameargs)      = 11;
  236.  
  237.                            stat
  238.                            NFSPROC_LINK(linkargs)          = 12;
  239.  
  240.                            stat
  241.                            NFSPROC_SYMLINK(symlinkargs)    = 13;
  242.  
  243.                            diropres
  244.                            NFSPROC_MKDIR(createargs)       = 14;
  245.  
  246.                            stat
  247.                            NFSPROC_RMDIR(diropargs)        = 15;
  248.  
  249.                            readdirres
  250.                            NFSPROC_READDIR(readdirargs)    = 16;
  251.  
  252.                            statfsres
  253.                            NFSPROC_STATFS(fhandle)         = 17;
  254.                    } = 2;
  255.            } = 100003;
  256.  
  257. 2.2.1.  Do Nothing
  258.  
  259.            void
  260.            NFSPROC_NULL(void) = 0;
  261.  
  262.    This procedure does no work.  It is made available in all RPC
  263.    services to allow server response testing and timing.
  264.  
  265. 2.2.2.  Get File Attributes
  266.  
  267.            attrstat
  268.            NFSPROC_GETATTR (fhandle) = 1;
  269.  
  270.    If the reply status is NFS_OK, then the reply attributes contains the
  271.    attributes for the file given by the input fhandle.
  272.  
  273.  
  274.  
  275.  
  276. Sun Microsystems, Inc.                                          [Page 5]
  277.  
  278. RFC 1094                NFS: Network File System              March 1989
  279.  
  280.  
  281. 2.2.3.  Set File Attributes
  282.  
  283.            struct sattrargs {
  284.                    fhandle file;
  285.                    sattr attributes;
  286.            };
  287.  
  288.            attrstat
  289.            NFSPROC_SETATTR (sattrargs) = 2;
  290.  
  291.    The "attributes" argument contains fields which are either -1 or are
  292.    the new value for the attributes of "file".  If the reply status is
  293.    NFS_OK, then the reply attributes have the attributes of the file
  294.    after the "SETATTR" operation has completed.
  295.  
  296.    Notes:  The use of -1 to indicate an unused field in "attributes" is
  297.    changed in the next version of the protocol.
  298.  
  299. 2.2.4.  Get Filesystem Root
  300.  
  301.            void
  302.            NFSPROC_ROOT(void) = 3;
  303.  
  304.    Obsolete.  This procedure is no longer used because finding the root
  305.    file handle of a filesystem requires moving pathnames between client
  306.    and server.  To do this right, we would have to define a network
  307.    standard representation of pathnames.  Instead, the function of
  308.    looking up the root file handle is done by the MNTPROC_MNT procedure.
  309.    (See Appendix A, "Mount Protocol Definition", for details).
  310.  
  311. 2.2.5.  Look Up File Name
  312.  
  313.            diropres
  314.            NFSPROC_LOOKUP(diropargs) = 4;
  315.  
  316.    If the reply "status" is NFS_OK, then the reply "file" and reply
  317.    "attributes" are the file handle and attributes for the file "name"
  318.    in the directory given by "dir" in the argument.
  319.  
  320. 2.2.6.  Read From Symbolic Link
  321.  
  322.            union readlinkres switch (stat status) {
  323.            case NFS_OK:
  324.                path data;
  325.            default:
  326.                void;
  327.            };
  328.  
  329.  
  330.  
  331.  
  332. Sun Microsystems, Inc.                                          [Page 6]
  333.  
  334. RFC 1094                NFS: Network File System              March 1989
  335.  
  336.  
  337.            readlinkres
  338.            NFSPROC_READLINK(fhandle) = 5;
  339.  
  340.    If "status" has the value NFS_OK, then the reply "data" is the data
  341.    in the symbolic link given by the file referred to by the fhandle
  342.    argument.
  343.  
  344.    Notes:  Since NFS always parses pathnames on the client, the pathname
  345.    in a symbolic link may mean something different (or be meaningless)
  346.    on a different client or on the server if a different pathname syntax
  347.    is used.
  348.  
  349. 2.2.7.  Read From File
  350.  
  351.            struct readargs {
  352.                    fhandle file;
  353.                    unsigned offset;
  354.                    unsigned count;
  355.                    unsigned totalcount;
  356.            };
  357.  
  358.            union readres switch (stat status) {
  359.            case NFS_OK:
  360.                    fattr attributes;
  361.                    nfsdata data;
  362.            default:
  363.                    void;
  364.            };
  365.  
  366.            readres
  367.            NFSPROC_READ(readargs) = 6;
  368.  
  369.    Returns up to "count" bytes of "data" from the file given by "file",
  370.    starting at "offset" bytes from the beginning of the file.  The first
  371.    byte of the file is at offset zero.  The file attributes after the
  372.    read takes place are returned in "attributes".
  373.  
  374.    Notes:  The argument "totalcount" is unused, and is removed in the
  375.    next protocol revision.
  376.  
  377. 2.2.8.  Write to Cache
  378.  
  379.            void
  380.            NFSPROC_WRITECACHE(void) = 7;
  381.  
  382.    To be used in the next protocol revision.
  383.  
  384.  
  385.  
  386.  
  387.  
  388. Sun Microsystems, Inc.                                          [Page 7]
  389.  
  390. RFC 1094                NFS: Network File System              March 1989
  391.  
  392.  
  393. 2.2.9.  Write to File
  394.  
  395.            struct writeargs {
  396.                    fhandle file;
  397.                    unsigned beginoffset;
  398.                    unsigned offset;
  399.                    unsigned totalcount;
  400.                    nfsdata data;
  401.            };
  402.  
  403.            attrstat
  404.            NFSPROC_WRITE(writeargs) = 8;
  405.  
  406.    Writes "data" beginning "offset" bytes from the beginning of "file".
  407.    The first byte of the file is at offset zero.  If the reply "status"
  408.    is NFS_OK, then the reply "attributes" contains the attributes of the
  409.    file after the write has completed.  The write operation is atomic.
  410.    Data from this "WRITE" will not be mixed with data from another
  411.    client's "WRITE".
  412.  
  413.    Notes:  The arguments "beginoffset" and "totalcount" are ignored and
  414.    are removed in the next protocol revision.
  415.  
  416. 2.2.10.  Create File
  417.  
  418.            struct createargs {
  419.                    diropargs where;
  420.                    sattr attributes;
  421.            };
  422.  
  423.            diropres
  424.            NFSPROC_CREATE(createargs) = 9;
  425.  
  426.    The file "name" is created in the directory given by "dir".  The
  427.    initial attributes of the new file are given by "attributes".  A
  428.    reply "status" of NFS_OK indicates that the file was created, and
  429.    reply "file" and reply "attributes" are its file handle and
  430.    attributes.  Any other reply "status" means that the operation failed
  431.    and no file was created.
  432.  
  433.    Notes:  This routine should pass an exclusive create flag, meaning
  434.    "create the file only if it is not already there".
  435.  
  436. 2.2.11.  Remove File
  437.  
  438.            stat
  439.            NFSPROC_REMOVE(diropargs) = 10;
  440.  
  441.  
  442.  
  443.  
  444. Sun Microsystems, Inc.                                          [Page 8]
  445.  
  446. RFC 1094                NFS: Network File System              March 1989
  447.  
  448.  
  449.    The file "name" is removed from the directory given by "dir".  A
  450.    reply of NFS_OK means the directory entry was removed.
  451.  
  452.    Notes:  possibly non-idempotent operation.
  453.  
  454. 2.2.12.  Rename File
  455.  
  456.            struct renameargs {
  457.                    diropargs from;
  458.                    diropargs to;
  459.            };
  460.  
  461.            stat
  462.            NFSPROC_RENAME(renameargs) = 11;
  463.  
  464.    The existing file "from.name" in the directory given by "from.dir" is
  465.    renamed to "to.name" in the directory given by "to.dir".  If the
  466.    reply is NFS_OK, the file was renamed.  The RENAME operation is
  467.    atomic on the server; it cannot be interrupted in the middle.
  468.  
  469.    Notes:  possibly non-idempotent operation.
  470.  
  471. 2.2.13.  Create Link to File
  472.  
  473.    Procedure 12, Version 2.
  474.  
  475.            struct linkargs {
  476.                    fhandle from;
  477.                    diropargs to;
  478.            };
  479.  
  480.            stat
  481.            NFSPROC_LINK(linkargs) = 12;
  482.  
  483.    Creates the file "to.name" in the directory given by "to.dir", which
  484.    is a hard link to the existing file given by "from".  If the return
  485.    value is NFS_OK, a link was created.  Any other return value
  486.    indicates an error, and the link was not created.
  487.  
  488.    A hard link should have the property that changes to either of the
  489.    linked files are reflected in both files.  When a hard link is made
  490.    to a file, the attributes for the file should have a value for
  491.    "nlink" that is one greater than the value before the link.
  492.  
  493.    Notes:  possibly non-idempotent operation.
  494.  
  495.  
  496.  
  497.  
  498.  
  499.  
  500. Sun Microsystems, Inc.                                          [Page 9]
  501.  
  502. RFC 1094                NFS: Network File System              March 1989
  503.  
  504.  
  505. 2.2.14.  Create Symbolic Link
  506.  
  507.            struct symlinkargs {
  508.                    diropargs from;
  509.                    path to;
  510.                    sattr attributes;
  511.            };
  512.  
  513.            stat
  514.            NFSPROC_SYMLINK(symlinkargs) = 13;
  515.  
  516.    Creates the file "from.name" with ftype NFLNK in the directory given
  517.    by "from.dir".  The new file contains the pathname "to" and has
  518.    initial attributes given by "attributes".  If the return value is
  519.    NFS_OK, a link was created.  Any other return value indicates an
  520.    error, and the link was not created.
  521.  
  522.    A symbolic link is a pointer to another file.  The name given in "to"
  523.    is not interpreted by the server, only stored in the newly created
  524.    file.  When the client references a file that is a symbolic link, the
  525.    contents of the symbolic link are normally transparently
  526.    reinterpreted as a pathname to substitute.  A READLINK operation
  527.    returns the data to the client for interpretation.
  528.  
  529.    Notes:  On UNIX servers the attributes are never used, since symbolic
  530.    links always have mode 0777.
  531.  
  532. 2.2.15.  Create Directory
  533.  
  534.            diropres
  535.            NFSPROC_MKDIR (createargs) = 14;
  536.  
  537.    The new directory "where.name" is created in the directory given by
  538.    "where.dir".  The initial attributes of the new directory are given
  539.    by "attributes".  A reply "status" of NFS_OK indicates that the new
  540.    directory was created, and reply "file" and reply "attributes" are
  541.    its file handle and attributes.  Any other reply "status" means that
  542.    the operation failed and no directory was created.
  543.  
  544.    Notes:  possibly non-idempotent operation.
  545.  
  546. 2.2.16.  Remove Directory
  547.  
  548.            stat
  549.            NFSPROC_RMDIR(diropargs) = 15;
  550.  
  551.  
  552.  
  553.  
  554.  
  555.  
  556. Sun Microsystems, Inc.                                         [Page 10]
  557.  
  558. RFC 1094                NFS: Network File System              March 1989
  559.  
  560.  
  561.    The existing empty directory "name" in the directory given by "dir"
  562.    is removed.  If the reply is NFS_OK, the directory was removed.
  563.  
  564.    Notes:  possibly non-idempotent operation.
  565.  
  566. 2.2.17.  Read From Directory
  567.  
  568.            struct readdirargs {
  569.                    fhandle dir;
  570.                    nfscookie cookie;
  571.                    unsigned count;
  572.            };
  573.  
  574.            struct entry {
  575.                    unsigned fileid;
  576.                    filename name;
  577.                    nfscookie cookie;
  578.                    entry *nextentry;
  579.            };
  580.  
  581.            union readdirres switch (stat status) {
  582.            case NFS_OK:
  583.                    struct {
  584.                            entry *entries;
  585.                            bool eof;
  586.                    } readdirok;
  587.            default:
  588.                    void;
  589.            };
  590.  
  591.            readdirres
  592.            NFSPROC_READDIR (readdirargs) = 16;
  593.  
  594.    Returns a variable number of directory entries, with a total size of
  595.    up to "count" bytes, from the directory given by "dir".  If the
  596.    returned value of "status" is NFS_OK, then it is followed by a
  597.    variable number of "entry"s.  Each "entry" contains a "fileid" which
  598.    consists of a unique number to identify the file within a filesystem,
  599.    the "name" of the file, and a "cookie" which is an opaque pointer to
  600.    the next entry in the directory.  The cookie is used in the next
  601.    READDIR call to get more entries starting at a given point in the
  602.    directory.  The special cookie zero (all bits zero) can be used to
  603.    get the entries starting at the beginning of the directory.  The
  604.    "fileid" field should be the same number as the "fileid" in the the
  605.    attributes of the file.  (See section "2.3.5. fattr" under "Basic
  606.    Data Types".)  The "eof" flag has a value of TRUE if there are no
  607.    more entries in the directory.
  608.  
  609.  
  610.  
  611.  
  612. Sun Microsystems, Inc.                                         [Page 11]
  613.  
  614. RFC 1094                NFS: Network File System              March 1989
  615.  
  616.  
  617. 2.2.18.  Get Filesystem Attributes
  618.  
  619.            union statfsres (stat status) {
  620.            case NFS_OK:
  621.                struct {
  622.                    unsigned tsize;
  623.                    unsigned bsize;
  624.                    unsigned blocks;
  625.                    unsigned bfree;
  626.                    unsigned bavail;
  627.                } info;
  628.            default:
  629.                    void;
  630.            };
  631.  
  632.            statfsres
  633.            NFSPROC_STATFS(fhandle) = 17;
  634.  
  635.    If the reply "status" is NFS_OK, then the reply "info" gives the
  636.    attributes for the filesystem that contains file referred to by the
  637.    input fhandle.  The attribute fields contain the following values:
  638.  
  639.       tsize   The optimum transfer size of the server in bytes.  This is
  640.               the number of bytes the server would like to have in the
  641.               data part of READ and WRITE requests.
  642.  
  643.       bsize   The block size in bytes of the filesystem.
  644.  
  645.       blocks  The total number of "bsize" blocks on the filesystem.
  646.  
  647.       bfree   The number of free "bsize" blocks on the filesystem.
  648.  
  649.       bavail  The number of "bsize" blocks available to non-privileged
  650.               users.
  651.  
  652.    Notes:  This call does not work well if a filesystem has variable
  653.    size blocks.
  654.  
  655. 2.3.  Basic Data Types
  656.  
  657.    The following XDR definitions are basic structures and types used in
  658.    other structures described further on.
  659.  
  660. 2.3.1.  stat
  661.  
  662.        enum stat {
  663.            NFS_OK = 0,
  664.            NFSERR_PERM=1,
  665.  
  666.  
  667.  
  668. Sun Microsystems, Inc.                                         [Page 12]
  669.  
  670. RFC 1094                NFS: Network File System              March 1989
  671.  
  672.  
  673.            NFSERR_NOENT=2,
  674.            NFSERR_IO=5,
  675.            NFSERR_NXIO=6,
  676.            NFSERR_ACCES=13,
  677.            NFSERR_EXIST=17,
  678.            NFSERR_NODEV=19,
  679.            NFSERR_NOTDIR=20,
  680.            NFSERR_ISDIR=21,
  681.            NFSERR_FBIG=27,
  682.            NFSERR_NOSPC=28,
  683.            NFSERR_ROFS=30,
  684.            NFSERR_NAMETOOLONG=63,
  685.            NFSERR_NOTEMPTY=66,
  686.            NFSERR_DQUOT=69,
  687.            NFSERR_STALE=70,
  688.            NFSERR_WFLUSH=99
  689.        };
  690.  
  691.    The "stat" type is returned with every procedure's results.  A value
  692.    of NFS_OK indicates that the call completed successfully and the
  693.    results are valid.  The other values indicate some kind of error
  694.    occurred on the server side during the servicing of the procedure.
  695.    The error values are derived from UNIX error numbers.
  696.  
  697.    NFSERR_PERM
  698.       Not owner.  The caller does not have correct ownership to perform
  699.       the requested operation.
  700.  
  701.    NFSERR_NOENT
  702.       No such file or directory.  The file or directory specified does
  703.       not exist.
  704.  
  705.    NFSERR_IO
  706.       Some sort of hard error occurred when the operation was in
  707.       progress.  This could be a disk error, for example.
  708.  
  709.    NFSERR_NXIO
  710.       No such device or address.
  711.  
  712.    NFSERR_ACCES
  713.       Permission denied.  The caller does not have the correct
  714.       permission to perform the requested operation.
  715.  
  716.    NFSERR_EXIST
  717.       File exists.  The file specified already exists.
  718.  
  719.    NFSERR_NODEV
  720.       No such device.
  721.  
  722.  
  723.  
  724. Sun Microsystems, Inc.                                         [Page 13]
  725.  
  726. RFC 1094                NFS: Network File System              March 1989
  727.  
  728.  
  729.    NFSERR_NOTDIR
  730.       Not a directory.  The caller specified a non-directory in a
  731.       directory operation.
  732.  
  733.    NFSERR_ISDIR
  734.       Is a directory.  The caller specified a directory in a non-
  735.       directory operation.
  736.  
  737.    NFSERR_FBIG
  738.       File too large.  The operation caused a file to grow beyond the
  739.       server's limit.
  740.  
  741.    NFSERR_NOSPC
  742.       No space left on device.  The operation caused the server's
  743.       filesystem to reach its limit.
  744.  
  745.    NFSERR_ROFS
  746.       Read-only filesystem.  Write attempted on a read-only filesystem.
  747.  
  748.    NFSERR_NAMETOOLONG
  749.       File name too long.  The file name in an operation was too long.
  750.  
  751.    NFSERR_NOTEMPTY
  752.       Directory not empty.  Attempted to remove a directory that was not
  753.       empty.
  754.  
  755.    NFSERR_DQUOT
  756.       Disk quota exceeded.  The client's disk quota on the server has
  757.       been exceeded.
  758.  
  759.    NFSERR_STALE
  760.       The "fhandle" given in the arguments was invalid.  That is, the
  761.       file referred to by that file handle no longer exists, or access
  762.       to it has been revoked.
  763.  
  764.    NFSERR_WFLUSH
  765.       The server's write cache used in the "WRITECACHE" call got flushed
  766.       to disk.
  767.  
  768.  
  769.  
  770.  
  771.  
  772.  
  773.  
  774.  
  775.  
  776.  
  777.  
  778.  
  779.  
  780. Sun Microsystems, Inc.                                         [Page 14]
  781.  
  782. RFC 1094                NFS: Network File System              March 1989
  783.  
  784.  
  785. 2.3.2.  ftype
  786.  
  787.           enum ftype {
  788.               NFNON = 0,
  789.               NFREG = 1,
  790.               NFDIR = 2,
  791.               NFBLK = 3,
  792.               NFCHR = 4,
  793.               NFLNK = 5
  794.           };
  795.  
  796.       The enumeration "ftype" gives the type of a file.  The type NFNON
  797.       indicates a non-file, NFREG is a regular file, NFDIR is a
  798.       directory, NFBLK is a block-special device, NFCHR is a character-
  799.       special device, and NFLNK is a symbolic link.
  800.  
  801. 2.3.3.  fhandle
  802.  
  803.           typedef opaque fhandle[FHSIZE];
  804.  
  805.       The "fhandle" is the file handle passed between the server and the
  806.       client.  All file operations are done using file handles to refer
  807.       to a file or directory.  The file handle can contain whatever
  808.       information the server needs to distinguish an individual file.
  809.  
  810. 2.3.4.  timeval
  811.  
  812.           struct timeval {
  813.               unsigned int seconds;
  814.               unsigned int useconds;
  815.           };
  816.  
  817.       The "timeval" structure is the number of seconds and microseconds
  818.       since midnight January 1, 1970, Greenwich Mean Time.  It is used
  819.       to pass time and date information.
  820.  
  821. 2.3.5.  fattr
  822.  
  823.           struct fattr {
  824.               ftype        type;
  825.               unsigned int mode;
  826.               unsigned int nlink;
  827.               unsigned int uid;
  828.               unsigned int gid;
  829.               unsigned int size;
  830.               unsigned int blocksize;
  831.               unsigned int rdev;
  832.               unsigned int blocks;
  833.  
  834.  
  835.  
  836. Sun Microsystems, Inc.                                         [Page 15]
  837.  
  838. RFC 1094                NFS: Network File System              March 1989
  839.  
  840.  
  841.               unsigned int fsid;
  842.               unsigned int fileid;
  843.               timeval      atime;
  844.               timeval      mtime;
  845.               timeval      ctime;
  846.           };
  847.  
  848.       The "fattr" structure contains the attributes of a file; "type" is
  849.       the type of the file; "nlink" is the number of hard links to the
  850.       file (the number of different names for the same file); "uid" is
  851.       the user identification number of the owner of the file; "gid" is
  852.       the group identification number of the group of the file; "size"
  853.       is the size in bytes of the file; "blocksize" is the size in bytes
  854.       of a block of the file; "rdev" is the device number of the file if
  855.       it is type NFCHR or NFBLK; "blocks" is the number of blocks the
  856.       file takes up on disk; "fsid" is the file system identifier for
  857.       the filesystem containing the file; "fileid" is a number that
  858.       uniquely identifies the file within its filesystem; "atime" is the
  859.       time when the file was last accessed for either read or write;
  860.       "mtime" is the time when the file data was last modified
  861.       (written); and "ctime" is the time when the status of the file was
  862.       last changed.  Writing to the file also changes "ctime" if the
  863.       size of the file changes.
  864.  
  865.       "Mode" is the access mode encoded as a set of bits.  Notice that
  866.       the file type is specified both in the mode bits and in the file
  867.       type.  This is really a bug in the protocol and will be fixed in
  868.       future versions.  The descriptions given below specify the bit
  869.       positions using octal numbers.
  870.  
  871.       0040000 This is a directory; "type" field should be NFDIR.
  872.       0020000 This is a character special file; "type" field should
  873.               be NFCHR.
  874.       0060000 This is a block special file; "type" field should be
  875.               NFBLK.
  876.       0100000 This is a regular file; "type" field should be NFREG.
  877.       0120000 This is a symbolic link file;  "type" field should be
  878.               NFLNK.
  879.       0140000 This is a named socket; "type" field should be NFNON.
  880.       0004000 Set user id on execution.
  881.       0002000 Set group id on execution.
  882.       0001000 Save swapped text even after use.
  883.       0000400 Read permission for owner.
  884.       0000200 Write permission for owner.
  885.       0000100 Execute and search permission for owner.
  886.       0000040 Read permission for group.
  887.       0000020 Write permission for group.
  888.       0000010 Execute and search permission for group.
  889.  
  890.  
  891.  
  892. Sun Microsystems, Inc.                                         [Page 16]
  893.  
  894. RFC 1094                NFS: Network File System              March 1989
  895.  
  896.  
  897.       0000004 Read permission for others.
  898.       0000002 Write permission for others.
  899.       0000001 Execute and search permission for others.
  900.  
  901.       Notes:  The bits are the same as the mode bits returned by the
  902.       stat(2) system call in UNIX.  The file type is specified both in
  903.       the mode bits and in the file type.  This is fixed in future
  904.       versions.
  905.  
  906.       The "rdev" field in the attributes structure is an operating
  907.       system specific device specifier.  It will be removed and
  908.       generalized in the next revision of the protocol.
  909.  
  910. 2.3.6.  sattr
  911.  
  912.           struct sattr {
  913.               unsigned int mode;
  914.               unsigned int uid;
  915.               unsigned int gid;
  916.               unsigned int size;
  917.               timeval      atime;
  918.               timeval      mtime;
  919.           };
  920.  
  921.       The "sattr" structure contains the file attributes which can be
  922.       set from the client.  The fields are the same as for "fattr"
  923.       above.  A "size" of zero means the file should be truncated.  A
  924.       value of -1 indicates a field that should be ignored.
  925.  
  926. 2.3.7.  filename
  927.  
  928.           typedef string filename<MAXNAMLEN>;
  929.  
  930.       The type "filename" is used for passing file names or pathname
  931.       components.
  932.  
  933. 2.3.8.  path
  934.  
  935.           typedef string path<MAXPATHLEN>;
  936.  
  937.       The type "path" is a pathname.  The server considers it as a
  938.       string with no internal structure, but to the client it is the
  939.       name of a node in a filesystem tree.
  940.  
  941. 2.3.9.  attrstat
  942.  
  943.           union attrstat switch (stat status) {
  944.           case NFS_OK:
  945.  
  946.  
  947.  
  948. Sun Microsystems, Inc.                                         [Page 17]
  949.  
  950. RFC 1094                NFS: Network File System              March 1989
  951.  
  952.  
  953.               fattr attributes;
  954.           default:
  955.               void;
  956.           };
  957.  
  958.       The "attrstat" structure is a common procedure result.  It
  959.       contains a "status" and, if the call succeeded, it also contains
  960.       the attributes of the file on which the operation was done.
  961.  
  962. 2.3.10.  diropargs
  963.  
  964.           struct diropargs {
  965.               fhandle  dir;
  966.               filename name;
  967.           };
  968.  
  969.       The "diropargs" structure is used in directory operations.  The
  970.       "fhandle" "dir" is the directory in which to find the file "name".
  971.       A directory operation is one in which the directory is affected.
  972.  
  973. 2.3.11.  diropres
  974.  
  975.           union diropres switch (stat status) {
  976.           case NFS_OK:
  977.               struct {
  978.                   fhandle file;
  979.                   fattr   attributes;
  980.               } diropok;
  981.           default:
  982.               void;
  983.           };
  984.  
  985.       The results of a directory operation are returned in a "diropres"
  986.       structure.  If the call succeeded, a new file handle "file" and
  987.       the "attributes" associated with that file are returned along with
  988.       the "status".
  989.  
  990. 3. NFS IMPLEMENTATION ISSUES
  991.  
  992.    The NFS protocol was designed to allow different operating systems to
  993.    share files.  However, since it was designed in a UNIX environment,
  994.    many operations have semantics similar to the operations of the UNIX
  995.    file system.  This section discusses some of the implementation-
  996.    specific details and semantic issues.
  997.  
  998. 3.1.  Server/Client Relationship
  999.  
  1000.    The NFS protocol is designed to allow servers to be as simple and
  1001.  
  1002.  
  1003.  
  1004. Sun Microsystems, Inc.                                         [Page 18]
  1005.  
  1006. RFC 1094                NFS: Network File System              March 1989
  1007.  
  1008.  
  1009.    general as possible.  Sometimes the simplicity of the server can be a
  1010.    problem, if the client wants to implement complicated filesystem
  1011.    semantics.
  1012.  
  1013.    For example, some operating systems allow removal of open files.  A
  1014.    process can open a file and, while it is open, remove it from the
  1015.    directory.  The file can be read and written as long as the process
  1016.    keeps it open, even though the file has no name in the filesystem.
  1017.    It is impossible for a stateless server to implement these semantics.
  1018.    The client can do some tricks such as renaming the file on remove,
  1019.    and only removing it on close.  We believe that the server provides
  1020.    enough functionality to implement most file system semantics on the
  1021.    client.
  1022.  
  1023.    Every NFS client can also potentially be a server, and remote and
  1024.    local mounted filesystems can be freely intermixed.  This leads to
  1025.    some interesting problems when a client travels down the directory
  1026.    tree of a remote filesystem and reaches the mount point on the server
  1027.    for another remote filesystem.  Allowing the server to follow the
  1028.    second remote mount would require loop detection, server lookup, and
  1029.    user revalidation.  Instead, we decided not to let clients cross a
  1030.    server's mount point.  When a client does a LOOKUP on a directory on
  1031.    which the server has mounted a filesystem, the client sees the
  1032.    underlying directory instead of the mounted directory.
  1033.  
  1034.    For example, if a server has a file system called "/usr" and mounts
  1035.    another file system on  "/usr/src", if a client mounts "/usr", it
  1036.    does NOT see the mounted version of "/usr/src".  A client could do
  1037.    remote mounts that match the server's mount points to maintain the
  1038.    server's view.  In this example, the client would also have to mount
  1039.    "/usr/src" in addition to "/usr", even if they are from the same
  1040.    server.
  1041.  
  1042. 3.2. Pathname Interpretation
  1043.  
  1044.    There are a few complications to the rule that pathnames are always
  1045.    parsed on the client.  For example, symbolic links could have
  1046.    different interpretations on different clients.  Another common
  1047.    problem for non-UNIX implementations is the special interpretation of
  1048.    the pathname ".." to mean the parent of a given directory.  The next
  1049.    revision of the protocol uses an explicit flag to indicate the parent
  1050.    instead.
  1051.  
  1052. 3.3.  Permission Issues
  1053.  
  1054.    The NFS protocol, strictly speaking, does not define the permission
  1055.    checking used by servers.  However, it is expected that a server will
  1056.    do normal operating system permission checking using AUTH_UNIX style
  1057.  
  1058.  
  1059.  
  1060. Sun Microsystems, Inc.                                         [Page 19]
  1061.  
  1062. RFC 1094                NFS: Network File System              March 1989
  1063.  
  1064.  
  1065.    authentication as the basis of its protection mechanism.  The server
  1066.    gets the client's effective "uid", effective "gid", and groups on
  1067.    each call and uses them to check permission.  There are various
  1068.    problems with this method that can been resolved in interesting ways.
  1069.  
  1070.    Using "uid" and "gid" implies that the client and server share the
  1071.    same "uid" list.  Every server and client pair must have the same
  1072.    mapping from user to "uid" and from group to "gid".  Since every
  1073.    client can also be a server, this tends to imply that the whole
  1074.    network shares the same "uid/gid" space.  AUTH_DES (and the next
  1075.    revision of the NFS protocol) uses string names instead of numbers,
  1076.    but there are still complex problems to be solved.
  1077.  
  1078.    Another problem arises due to the usually stateful open operation.
  1079.    Most operating systems check permission at open time, and then check
  1080.    that the file is open on each read and write request.  With stateless
  1081.    servers, the server has no idea that the file is open and must do
  1082.    permission checking on each read and write call.  On a local
  1083.    filesystem, a user can open a file and then change the permissions so
  1084.    that no one is allowed to touch it, but will still be able to write
  1085.    to the file because it is open.  On a remote filesystem, by contrast,
  1086.    the write would fail.  To get around this problem, the server's
  1087.    permission checking algorithm should allow the owner of a file to
  1088.    access it regardless of the permission setting.
  1089.  
  1090.    A similar problem has to do with paging in from a file over the
  1091.    network.  The operating system usually checks for execute permission
  1092.    before opening a file for demand paging, and then reads blocks from
  1093.    the open file.  The file may not have read permission, but after it
  1094.    is opened it does not matter.  An NFS server can not tell the
  1095.    difference between a normal file read and a demand page-in read.  To
  1096.    make this work, the server allows reading of files if the "uid" given
  1097.    in the call has either execute or read permission on the file.
  1098.  
  1099.    In most operating systems, a particular user (on UNIX, the user ID
  1100.    zero) has access to all files no matter what permission and ownership
  1101.    they have.  This "super-user" permission may not be allowed on the
  1102.    server, since anyone who can become super-user on their workstation
  1103.    could gain access to all remote files.  The UNIX server by default
  1104.    maps user id 0 to -2 before doing its access checking.  This works
  1105.    except for NFS root filesystems, where super-user access cannot be
  1106.    avoided.
  1107.  
  1108. 3.4.  RPC Information
  1109.  
  1110.    Authentication
  1111.       The NFS service uses AUTH_UNIX,  AUTH_DES, or AUTH_SHORT style
  1112.       authentication, except in the NULL procedure where AUTH_NONE is
  1113.  
  1114.  
  1115.  
  1116. Sun Microsystems, Inc.                                         [Page 20]
  1117.  
  1118. RFC 1094                NFS: Network File System              March 1989
  1119.  
  1120.  
  1121.       also allowed.
  1122.  
  1123.    Transport Protocols
  1124.       NFS is supported normally on UDP.
  1125.  
  1126.    Port Number
  1127.       The NFS protocol currently uses the UDP port number 2049.  This is
  1128.       not an officially assigned port, so later versions of the protocol
  1129.       use the "Portmapping" facility of RPC.
  1130.  
  1131. 3.5.  Sizes of XDR Structures
  1132.  
  1133.    These are the sizes, given in decimal bytes, of various XDR
  1134.    structures used in the protocol:
  1135.  
  1136.    /*
  1137.     * The maximum number of bytes of data in a READ or WRITE
  1138.     * request.
  1139.     */
  1140.    const MAXDATA = 8192;
  1141.  
  1142.    /* The maximum number of bytes in a pathname argument. */
  1143.    const MAXPATHLEN = 1024;
  1144.  
  1145.    /* The maximum number of bytes in a file name argument. */
  1146.    const MAXNAMLEN = 255;
  1147.  
  1148.    /* The size in bytes of the opaque "cookie" passed by READDIR. */
  1149.    const COOKIESIZE  = 4;
  1150.  
  1151.    /* The size in bytes of the opaque file handle. */
  1152.    const FHSIZE = 32;
  1153.  
  1154. 3.6. Setting RPC Parameters
  1155.  
  1156.    Various file system parameters and options should be set at mount
  1157.    time.  The mount protocol is described in the appendix below.  For
  1158.    example, "Soft" mounts as well as "Hard" mounts are usually both
  1159.    provided.  Soft mounted file systems return errors when RPC
  1160.    operations fail (after a given number of optional retransmissions),
  1161.    while hard mounted file systems continue to retransmit forever.  The
  1162.    maximum transfer sizes are implementation dependent.  For efficient
  1163.    operation over a local network, 8192 bytes of data are normally used.
  1164.    This may result in lower-level fragmentation (such as at the IP
  1165.    level).  Since some network interfaces may not allow such packets,
  1166.    for operation over slower-speed networks or hosts, or through
  1167.    gateways, transfer sizes of 512 or 1024 bytes often provide better
  1168.    results.
  1169.  
  1170.  
  1171.  
  1172. Sun Microsystems, Inc.                                         [Page 21]
  1173.  
  1174. RFC 1094                NFS: Network File System              March 1989
  1175.  
  1176.  
  1177.    Clients and servers may need to keep caches of recent operations to
  1178.    help avoid problems with non-idempotent operations.  For example, if
  1179.    the transport protocol drops the response for a Remove File
  1180.    operation, upon retransmission the server may return an error code of
  1181.    NFSERR_NOENT instead of NFS_OK.  But if the server keeps around the
  1182.    last operation requested and its result, it could return the proper
  1183.    success code.  Of course, the server could be crashed and rebooted
  1184.    between retransmissions, but a small cache (even a single entry)
  1185.    would solve most problems.
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192.  
  1193.  
  1194.  
  1195.  
  1196.  
  1197.  
  1198.  
  1199.  
  1200.  
  1201.  
  1202.  
  1203.  
  1204.  
  1205.  
  1206.  
  1207.  
  1208.  
  1209.  
  1210.  
  1211.  
  1212.  
  1213.  
  1214.  
  1215.  
  1216.  
  1217.  
  1218.  
  1219.  
  1220.  
  1221.  
  1222.  
  1223.  
  1224.  
  1225.  
  1226.  
  1227.  
  1228. Sun Microsystems, Inc.                                         [Page 22]
  1229.  
  1230. RFC 1094                NFS: Network File System              March 1989
  1231.  
  1232.  
  1233.                    Appendix A. MOUNT PROTOCOL DEFINITION
  1234.  
  1235. A.1.  Introduction
  1236.  
  1237.    The mount protocol is separate from, but related to, the NFS
  1238.    protocol.  It provides operating system specific services to get the
  1239.    NFS off the ground -- looking up server path names, validating user
  1240.    identity, and checking access permissions.  Clients use the mount
  1241.    protocol to get the first file handle, which allows them entry into a
  1242.    remote filesystem.
  1243.  
  1244.    The mount protocol is kept separate from the NFS protocol to make it
  1245.    easy to plug in new access checking and validation methods without
  1246.    changing the NFS server protocol.
  1247.  
  1248.    Notice that the protocol definition implies stateful servers because
  1249.    the server maintains a list of client's mount requests.  The mount
  1250.    list information is not critical for the correct functioning of
  1251.    either the client or the server.  It is intended for advisory use
  1252.    only, for example, to warn possible clients when a server is going
  1253.    down.
  1254.  
  1255.    Version one of the mount protocol is used with version two of the NFS
  1256.    protocol.  The only information communicated between these two
  1257.    protocols is the "fhandle" structure.
  1258.  
  1259. A.2.  RPC Information
  1260.  
  1261.    Authentication
  1262.       The mount service uses AUTH_UNIX and AUTH_NONE style
  1263.       authentication only.
  1264.  
  1265.    Transport Protocols
  1266.       The mount service is supported on both UDP and TCP.
  1267.  
  1268.    Port Number
  1269.       Consult the server's portmapper, described in RFC 1057, "RPC:
  1270.       Remote Procedure Call Protocol Specification", to find the port
  1271.       number on which the mount service is registered.
  1272.  
  1273. A.3.  Sizes of XDR Structures
  1274.  
  1275.    These are the sizes, given in decimal bytes, of various XDR
  1276.    structures used in the protocol:
  1277.  
  1278.            /* The maximum number of bytes in a pathname argument. */
  1279.            const MNTPATHLEN = 1024;
  1280.  
  1281.  
  1282.  
  1283.  
  1284. Sun Microsystems, Inc.                                         [Page 23]
  1285.  
  1286. RFC 1094                NFS: Network File System              March 1989
  1287.  
  1288.  
  1289.            /* The maximum number of bytes in a name argument. */
  1290.            const MNTNAMLEN = 255;
  1291.  
  1292.            /* The size in bytes of the opaque file handle. */
  1293.            const FHSIZE = 32;
  1294.  
  1295. A.4.  Basic Data Types
  1296.  
  1297.    This section presents the data types used by the mount protocol.  In
  1298.    many cases they are similar to the types used in NFS.
  1299.  
  1300. A.4.1.  fhandle
  1301.  
  1302.        typedef opaque fhandle[FHSIZE];
  1303.  
  1304.    The type "fhandle" is the file handle that the server passes to the
  1305.    client.  All file operations are done using file handles to refer to
  1306.    a file or directory.  The file handle can contain whatever
  1307.    information the server needs to distinguish an individual file.
  1308.  
  1309.    This is the same as the "fhandle" XDR definition in version 2 of the
  1310.    NFS protocol; see section "2.3.3. fhandle" under "Basic Data Types".
  1311.  
  1312. A.4.2.  fhstatus
  1313.  
  1314.        union fhstatus switch (unsigned status) {
  1315.        case 0:
  1316.            fhandle directory;
  1317.        default:
  1318.            void;
  1319.        }
  1320.  
  1321.    The type "fhstatus" is a union.  If a "status" of zero is returned,
  1322.    the call completed successfully, and a file handle for the
  1323.    "directory" follows.  A non-zero status indicates some sort of error.
  1324.    In this case, the status is a UNIX error number.
  1325.  
  1326. A.4.3.  dirpath
  1327.  
  1328.        typedef string dirpath<MNTPATHLEN>;
  1329.  
  1330.    The type "dirpath" is a server pathname of a directory.
  1331.  
  1332. A.4.4.  name
  1333.  
  1334.        typedef string name<MNTNAMLEN>;
  1335.  
  1336.    The type "name" is an arbitrary string used for various names.
  1337.  
  1338.  
  1339.  
  1340. Sun Microsystems, Inc.                                         [Page 24]
  1341.  
  1342. RFC 1094                NFS: Network File System              March 1989
  1343.  
  1344.  
  1345. A.5.  Server Procedures
  1346.  
  1347.    The following sections define the RPC procedures supplied by a mount
  1348.    server.
  1349.  
  1350.            /*
  1351.             * Protocol description for the mount program
  1352.             */
  1353.            program MOUNTPROG {
  1354.                    /*
  1355.                     * Version 1 of the mount protocol used with
  1356.                     * version 2 of the NFS protocol.
  1357.                     */
  1358.                    version MOUNTVERS {
  1359.  
  1360.                            void
  1361.                            MOUNTPROC_NULL(void) = 0;
  1362.  
  1363.                            fhstatus
  1364.                            MOUNTPROC_MNT(dirpath) = 1;
  1365.  
  1366.                            mountlist
  1367.                            MOUNTPROC_DUMP(void) = 2;
  1368.  
  1369.                            void
  1370.                            MOUNTPROC_UMNT(dirpath) = 3;
  1371.  
  1372.                            void
  1373.                            MOUNTPROC_UMNTALL(void) = 4;
  1374.  
  1375.                            exportlist
  1376.                            MOUNTPROC_EXPORT(void)  = 5;
  1377.                    } = 1;
  1378.            } = 100005;
  1379.  
  1380. A.5.1.  Do Nothing
  1381.  
  1382.            void
  1383.            MNTPROC_NULL(void) = 0;
  1384.  
  1385.    This procedure does no work.  It is made available in all RPC
  1386.    services to allow server response testing and timing.
  1387.  
  1388. A.5.2.  Add Mount Entry
  1389.  
  1390.            fhstatus
  1391.            MNTPROC_MNT(dirpath) = 1;
  1392.  
  1393.  
  1394.  
  1395.  
  1396. Sun Microsystems, Inc.                                         [Page 25]
  1397.  
  1398. RFC 1094                NFS: Network File System              March 1989
  1399.  
  1400.  
  1401.    If the reply "status" is 0, then the reply "directory" contains the
  1402.    file handle for the directory "dirname".  This file handle may be
  1403.    used in the NFS protocol.  This procedure also adds a new entry to
  1404.    the mount list for this client mounting "dirname".
  1405.  
  1406. A.5.3.  Return Mount Entries
  1407.  
  1408.            struct *mountlist {
  1409.                    name      hostname;
  1410.                    dirpath   directory;
  1411.                    mountlist nextentry;
  1412.            };
  1413.  
  1414.            mountlist
  1415.            MNTPROC_DUMP(void) = 2;
  1416.  
  1417.    Returns the list of remote mounted filesystems.  The "mountlist"
  1418.    contains one entry for each "hostname" and "directory" pair.
  1419.  
  1420. A.5.4.  Remove Mount Entry
  1421.  
  1422.            void
  1423.            MNTPROC_UMNT(dirpath) = 3;
  1424.  
  1425.    Removes the mount list entry for the input "dirpath".
  1426.  
  1427. A.5.5.  Remove All Mount Entries
  1428.  
  1429.            void
  1430.            MNTPROC_UMNTALL(void) = 4;
  1431.  
  1432.    Removes all of the mount list entries for this client.
  1433.  
  1434. A.5.6.  Return Export List
  1435.  
  1436.            struct *groups {
  1437.                    name grname;
  1438.                    groups grnext;
  1439.            };
  1440.  
  1441.            struct *exportlist {
  1442.                    dirpath filesys;
  1443.                    groups groups;
  1444.                    exportlist next;
  1445.            };
  1446.  
  1447.            exportlist
  1448.            MNTPROC_EXPORT(void) = 5;
  1449.  
  1450.  
  1451.  
  1452. Sun Microsystems, Inc.                                         [Page 26]
  1453.  
  1454. RFC 1094                NFS: Network File System              March 1989
  1455.  
  1456.  
  1457.    Returns a variable number of export list entries.  Each entry
  1458.    contains a filesystem name and a list of groups that are allowed to
  1459.    import it.  The filesystem name is in "filesys", and the group name
  1460.    is in the list "groups".
  1461.  
  1462.    Notes:  The exportlist should contain more information about the
  1463.    status of the filesystem, such as a read-only flag.
  1464.  
  1465. Author's Address:
  1466.  
  1467.    Bill Nowicki
  1468.    Sun Microsystems, Inc.
  1469.    Mail Stop 1-40
  1470.    2550 Garcia Avenue
  1471.    Mountain View, CA 94043
  1472.  
  1473.    Phone: (415) 336-7278
  1474.  
  1475.    Email: nowicki@SUN.COM
  1476.  
  1477.  
  1478.  
  1479.  
  1480.  
  1481.  
  1482.  
  1483.  
  1484.  
  1485.  
  1486.  
  1487.  
  1488.  
  1489.  
  1490.  
  1491.  
  1492.  
  1493.  
  1494.  
  1495.  
  1496.  
  1497.  
  1498.  
  1499.  
  1500.  
  1501.  
  1502.  
  1503.  
  1504.  
  1505.  
  1506.  
  1507.  
  1508. Sun Microsystems, Inc.                                         [Page 27]
  1509.