home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / unix / volume13 / rpc3.9 / part15 / nfs.rfc.ms
Encoding:
Text File  |  1988-02-27  |  40.7 KB  |  1,364 lines

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