/include/rpcsvc/nfs_prot.x

https://bitbucket.org/freebsd/freebsd-head/ · Alex · 1266 lines · 1071 code · 195 blank · 0 comment · 0 complexity · 04067040456b41a5704ddaa0ee1a0508 MD5 · raw file

  1. /*
  2. * Sun RPC is a product of Sun Microsystems, Inc. and is provided for
  3. * unrestricted use provided that this legend is included on all tape
  4. * media and as a part of the software program in whole or part. Users
  5. * may copy or modify Sun RPC without charge, but are not authorized
  6. * to license or distribute it to anyone else except as part of a product or
  7. * program developed by the user.
  8. *
  9. * SUN RPC IS PROVIDED AS IS WITH NO WARRANTIES OF ANY KIND INCLUDING THE
  10. * WARRANTIES OF DESIGN, MERCHANTIBILITY AND FITNESS FOR A PARTICULAR
  11. * PURPOSE, OR ARISING FROM A COURSE OF DEALING, USAGE OR TRADE PRACTICE.
  12. *
  13. * Sun RPC is provided with no support and without any obligation on the
  14. * part of Sun Microsystems, Inc. to assist in its use, correction,
  15. * modification or enhancement.
  16. *
  17. * SUN MICROSYSTEMS, INC. SHALL HAVE NO LIABILITY WITH RESPECT TO THE
  18. * INFRINGEMENT OF COPYRIGHTS, TRADE SECRETS OR ANY PATENTS BY SUN RPC
  19. * OR ANY PART THEREOF.
  20. *
  21. * In no event will Sun Microsystems, Inc. be liable for any lost revenue
  22. * or profits or other special, indirect and consequential damages, even if
  23. * Sun has been advised of the possibility of such damages.
  24. *
  25. * Sun Microsystems, Inc.
  26. * 2550 Garcia Avenue
  27. * Mountain View, California 94043
  28. */
  29. #ifndef RPC_HDR
  30. %#ifndef lint
  31. %/*static char sccsid[] = "from: @(#)nfs_prot.x 1.2 87/10/12 Copyr 1987 Sun Micro";*/
  32. %/*static char sccsid[] = "from: @(#)nfs_prot.x 2.1 88/08/01 4.0 RPCSRC";*/
  33. %#endif /* not lint */
  34. %#include <sys/cdefs.h>
  35. %__FBSDID("$FreeBSD$");
  36. #endif
  37. const NFS_PORT = 2049;
  38. const NFS_MAXDATA = 8192;
  39. const NFS_MAXPATHLEN = 1024;
  40. const NFS_MAXNAMLEN = 255;
  41. const NFS_FHSIZE = 32;
  42. const NFS_COOKIESIZE = 4;
  43. const NFS_FIFO_DEV = -1; /* size kludge for named pipes */
  44. /*
  45. * File types
  46. */
  47. const NFSMODE_FMT = 0170000; /* type of file */
  48. const NFSMODE_DIR = 0040000; /* directory */
  49. const NFSMODE_CHR = 0020000; /* character special */
  50. const NFSMODE_BLK = 0060000; /* block special */
  51. const NFSMODE_REG = 0100000; /* regular */
  52. const NFSMODE_LNK = 0120000; /* symbolic link */
  53. const NFSMODE_SOCK = 0140000; /* socket */
  54. const NFSMODE_FIFO = 0010000; /* fifo */
  55. /*
  56. * Error status
  57. */
  58. enum nfsstat {
  59. NFS_OK= 0, /* no error */
  60. NFSERR_PERM=1, /* Not owner */
  61. NFSERR_NOENT=2, /* No such file or directory */
  62. NFSERR_IO=5, /* I/O error */
  63. NFSERR_NXIO=6, /* No such device or address */
  64. NFSERR_ACCES=13, /* Permission denied */
  65. NFSERR_EXIST=17, /* File exists */
  66. NFSERR_NODEV=19, /* No such device */
  67. NFSERR_NOTDIR=20, /* Not a directory*/
  68. NFSERR_ISDIR=21, /* Is a directory */
  69. NFSERR_FBIG=27, /* File too large */
  70. NFSERR_NOSPC=28, /* No space left on device */
  71. NFSERR_ROFS=30, /* Read-only file system */
  72. NFSERR_NAMETOOLONG=63, /* File name too long */
  73. NFSERR_NOTEMPTY=66, /* Directory not empty */
  74. NFSERR_DQUOT=69, /* Disc quota exceeded */
  75. NFSERR_STALE=70, /* Stale NFS file handle */
  76. NFSERR_WFLUSH=99 /* write cache flushed */
  77. };
  78. /*
  79. * File types
  80. */
  81. enum ftype {
  82. NFNON = 0, /* non-file */
  83. NFREG = 1, /* regular file */
  84. NFDIR = 2, /* directory */
  85. NFBLK = 3, /* block special */
  86. NFCHR = 4, /* character special */
  87. NFLNK = 5, /* symbolic link */
  88. NFSOCK = 6, /* unix domain sockets */
  89. NFBAD = 7, /* unused */
  90. NFFIFO = 8 /* named pipe */
  91. };
  92. /*
  93. * File access handle
  94. */
  95. struct nfs_fh {
  96. opaque data[NFS_FHSIZE];
  97. };
  98. /*
  99. * Timeval
  100. */
  101. struct nfstime {
  102. unsigned seconds;
  103. unsigned useconds;
  104. };
  105. /*
  106. * File attributes
  107. */
  108. struct fattr {
  109. ftype type; /* file type */
  110. unsigned mode; /* protection mode bits */
  111. unsigned nlink; /* # hard links */
  112. unsigned uid; /* owner user id */
  113. unsigned gid; /* owner group id */
  114. unsigned size; /* file size in bytes */
  115. unsigned blocksize; /* preferred block size */
  116. unsigned rdev; /* special device # */
  117. unsigned blocks; /* Kb of disk used by file */
  118. unsigned fsid; /* device # */
  119. unsigned fileid; /* inode # */
  120. nfstime atime; /* time of last access */
  121. nfstime mtime; /* time of last modification */
  122. nfstime ctime; /* time of last change */
  123. };
  124. /*
  125. * File attributes which can be set
  126. */
  127. struct sattr {
  128. unsigned mode; /* protection mode bits */
  129. unsigned uid; /* owner user id */
  130. unsigned gid; /* owner group id */
  131. unsigned size; /* file size in bytes */
  132. nfstime atime; /* time of last access */
  133. nfstime mtime; /* time of last modification */
  134. };
  135. typedef string filename<NFS_MAXNAMLEN>;
  136. typedef string nfspath<NFS_MAXPATHLEN>;
  137. /*
  138. * Reply status with file attributes
  139. */
  140. union attrstat switch (nfsstat status) {
  141. case NFS_OK:
  142. fattr attributes;
  143. default:
  144. void;
  145. };
  146. struct sattrargs {
  147. nfs_fh file;
  148. sattr attributes;
  149. };
  150. /*
  151. * Arguments for directory operations
  152. */
  153. struct diropargs {
  154. nfs_fh dir; /* directory file handle */
  155. filename name; /* name (up to NFS_MAXNAMLEN bytes) */
  156. };
  157. struct diropokres {
  158. nfs_fh file;
  159. fattr attributes;
  160. };
  161. /*
  162. * Results from directory operation
  163. */
  164. union diropres switch (nfsstat status) {
  165. case NFS_OK:
  166. diropokres diropres;
  167. default:
  168. void;
  169. };
  170. union readlinkres switch (nfsstat status) {
  171. case NFS_OK:
  172. nfspath data;
  173. default:
  174. void;
  175. };
  176. /*
  177. * Arguments to remote read
  178. */
  179. struct readargs {
  180. nfs_fh file; /* handle for file */
  181. unsigned offset; /* byte offset in file */
  182. unsigned count; /* immediate read count */
  183. unsigned totalcount; /* total read count (from this offset)*/
  184. };
  185. /*
  186. * Status OK portion of remote read reply
  187. */
  188. struct readokres {
  189. fattr attributes; /* attributes, need for pagin*/
  190. opaque data<NFS_MAXDATA>;
  191. };
  192. union readres switch (nfsstat status) {
  193. case NFS_OK:
  194. readokres reply;
  195. default:
  196. void;
  197. };
  198. /*
  199. * Arguments to remote write
  200. */
  201. struct writeargs {
  202. nfs_fh file; /* handle for file */
  203. unsigned beginoffset; /* beginning byte offset in file */
  204. unsigned offset; /* current byte offset in file */
  205. unsigned totalcount; /* total write count (to this offset)*/
  206. opaque data<NFS_MAXDATA>;
  207. };
  208. struct createargs {
  209. diropargs where;
  210. sattr attributes;
  211. };
  212. struct renameargs {
  213. diropargs from;
  214. diropargs to;
  215. };
  216. struct linkargs {
  217. nfs_fh from;
  218. diropargs to;
  219. };
  220. struct symlinkargs {
  221. diropargs from;
  222. nfspath to;
  223. sattr attributes;
  224. };
  225. typedef opaque nfscookie[NFS_COOKIESIZE];
  226. /*
  227. * Arguments to readdir
  228. */
  229. struct readdirargs {
  230. nfs_fh dir; /* directory handle */
  231. nfscookie cookie;
  232. unsigned count; /* number of directory bytes to read */
  233. };
  234. struct entry {
  235. unsigned fileid;
  236. filename name;
  237. nfscookie cookie;
  238. entry *nextentry;
  239. };
  240. struct dirlist {
  241. entry *entries;
  242. bool eof;
  243. };
  244. union readdirres switch (nfsstat status) {
  245. case NFS_OK:
  246. dirlist reply;
  247. default:
  248. void;
  249. };
  250. struct statfsokres {
  251. unsigned tsize; /* preferred transfer size in bytes */
  252. unsigned bsize; /* fundamental file system block size */
  253. unsigned blocks; /* total blocks in file system */
  254. unsigned bfree; /* free blocks in fs */
  255. unsigned bavail; /* free blocks avail to non-superuser */
  256. };
  257. union statfsres switch (nfsstat status) {
  258. case NFS_OK:
  259. statfsokres reply;
  260. default:
  261. void;
  262. };
  263. #ifdef WANT_NFS3
  264. /*
  265. * NFSv3 constants and types
  266. */
  267. const NFS3_FHSIZE = 64; /* maximum size in bytes of a file handle */
  268. const NFS3_COOKIEVERFSIZE = 8; /* size of a cookie verifier for READDIR */
  269. const NFS3_CREATEVERFSIZE = 8; /* size of the verifier used for CREATE */
  270. const NFS3_WRITEVERFSIZE = 8; /* size of the verifier used for WRITE */
  271. typedef unsigned hyper uint64;
  272. typedef hyper int64;
  273. typedef unsigned long uint32;
  274. typedef long int32;
  275. typedef string filename3<>;
  276. typedef string nfspath3<>;
  277. typedef uint64 fileid3;
  278. typedef uint64 cookie3;
  279. typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
  280. typedef opaque createverf3[NFS3_CREATEVERFSIZE];
  281. typedef opaque writeverf3[NFS3_WRITEVERFSIZE];
  282. typedef uint32 uid3;
  283. typedef uint32 gid3;
  284. typedef uint64 size3;
  285. typedef uint64 offset3;
  286. typedef uint32 mode3;
  287. typedef uint32 count3;
  288. /*
  289. * Error status (v3)
  290. */
  291. enum nfsstat3 {
  292. NFS3_OK = 0,
  293. NFS3ERR_PERM = 1,
  294. NFS3ERR_NOENT = 2,
  295. NFS3ERR_IO = 5,
  296. NFS3ERR_NXIO = 6,
  297. NFS3ERR_ACCES = 13,
  298. NFS3ERR_EXIST = 17,
  299. NFS3ERR_XDEV = 18,
  300. NFS3ERR_NODEV = 19,
  301. NFS3ERR_NOTDIR = 20,
  302. NFS3ERR_ISDIR = 21,
  303. NFS3ERR_INVAL = 22,
  304. NFS3ERR_FBIG = 27,
  305. NFS3ERR_NOSPC = 28,
  306. NFS3ERR_ROFS = 30,
  307. NFS3ERR_MLINK = 31,
  308. NFS3ERR_NAMETOOLONG = 63,
  309. NFS3ERR_NOTEMPTY = 66,
  310. NFS3ERR_DQUOT = 69,
  311. NFS3ERR_STALE = 70,
  312. NFS3ERR_REMOTE = 71,
  313. NFS3ERR_BADHANDLE = 10001,
  314. NFS3ERR_NOT_SYNC = 10002,
  315. NFS3ERR_BAD_COOKIE = 10003,
  316. NFS3ERR_NOTSUPP = 10004,
  317. NFS3ERR_TOOSMALL = 10005,
  318. NFS3ERR_SERVERFAULT = 10006,
  319. NFS3ERR_BADTYPE = 10007,
  320. NFS3ERR_JUKEBOX = 10008
  321. };
  322. /*
  323. * File types (v3)
  324. */
  325. enum ftype3 {
  326. NF3REG = 1, /* regular file */
  327. NF3DIR = 2, /* directory */
  328. NF3BLK = 3, /* block special */
  329. NF3CHR = 4, /* character special */
  330. NF3LNK = 5, /* symbolic link */
  331. NF3SOCK = 6, /* unix domain sockets */
  332. NF3FIFO = 7 /* named pipe */
  333. };
  334. struct specdata3 {
  335. uint32 specdata1;
  336. uint32 specdata2;
  337. };
  338. /*
  339. * File access handle (v3)
  340. */
  341. struct nfs_fh3 {
  342. opaque data<NFS3_FHSIZE>;
  343. };
  344. /*
  345. * Timeval (v3)
  346. */
  347. struct nfstime3 {
  348. uint32 seconds;
  349. uint32 nseconds;
  350. };
  351. /*
  352. * File attributes (v3)
  353. */
  354. struct fattr3 {
  355. ftype3 type; /* file type */
  356. mode3 mode; /* protection mode bits */
  357. uint32 nlink; /* # hard links */
  358. uid3 uid; /* owner user id */
  359. gid3 gid; /* owner group id */
  360. size3 size; /* file size in bytes */
  361. size3 used; /* preferred block size */
  362. specdata3 rdev; /* special device # */
  363. uint64 fsid; /* device # */
  364. fileid3 fileid; /* inode # */
  365. nfstime3 atime; /* time of last access */
  366. nfstime3 mtime; /* time of last modification */
  367. nfstime3 ctime; /* time of last change */
  368. };
  369. union post_op_attr switch (bool attributes_follow) {
  370. case TRUE:
  371. fattr3 attributes;
  372. case FALSE:
  373. void;
  374. };
  375. struct wcc_attr {
  376. size3 size;
  377. nfstime3 mtime;
  378. nfstime3 ctime;
  379. };
  380. union pre_op_attr switch (bool attributes_follow) {
  381. case TRUE:
  382. wcc_attr attributes;
  383. case FALSE:
  384. void;
  385. };
  386. struct wcc_data {
  387. pre_op_attr before;
  388. post_op_attr after;
  389. };
  390. union post_op_fh3 switch (bool handle_follows) {
  391. case TRUE:
  392. nfs_fh3 handle;
  393. case FALSE:
  394. void;
  395. };
  396. /*
  397. * File attributes which can be set (v3)
  398. */
  399. enum time_how {
  400. DONT_CHANGE = 0,
  401. SET_TO_SERVER_TIME = 1,
  402. SET_TO_CLIENT_TIME = 2
  403. };
  404. union set_mode3 switch (bool set_it) {
  405. case TRUE:
  406. mode3 mode;
  407. default:
  408. void;
  409. };
  410. union set_uid3 switch (bool set_it) {
  411. case TRUE:
  412. uid3 uid;
  413. default:
  414. void;
  415. };
  416. union set_gid3 switch (bool set_it) {
  417. case TRUE:
  418. gid3 gid;
  419. default:
  420. void;
  421. };
  422. union set_size3 switch (bool set_it) {
  423. case TRUE:
  424. size3 size;
  425. default:
  426. void;
  427. };
  428. union set_atime switch (time_how set_it) {
  429. case SET_TO_CLIENT_TIME:
  430. nfstime3 atime;
  431. default:
  432. void;
  433. };
  434. union set_mtime switch (time_how set_it) {
  435. case SET_TO_CLIENT_TIME:
  436. nfstime3 mtime;
  437. default:
  438. void;
  439. };
  440. struct sattr3 {
  441. set_mode3 mode;
  442. set_uid3 uid;
  443. set_gid3 gid;
  444. set_size3 size;
  445. set_atime atime;
  446. set_mtime mtime;
  447. };
  448. /*
  449. * Arguments for directory operations (v3)
  450. */
  451. struct diropargs3 {
  452. nfs_fh3 dir; /* directory file handle */
  453. filename3 name; /* name (up to NFS_MAXNAMLEN bytes) */
  454. };
  455. /*
  456. * Arguments to getattr (v3).
  457. */
  458. struct GETATTR3args {
  459. nfs_fh3 object;
  460. };
  461. struct GETATTR3resok {
  462. fattr3 obj_attributes;
  463. };
  464. union GETATTR3res switch (nfsstat3 status) {
  465. case NFS3_OK:
  466. GETATTR3resok resok;
  467. default:
  468. void;
  469. };
  470. /*
  471. * Arguments to setattr (v3).
  472. */
  473. union sattrguard3 switch (bool check) {
  474. case TRUE:
  475. nfstime3 obj_ctime;
  476. case FALSE:
  477. void;
  478. };
  479. struct SETATTR3args {
  480. nfs_fh3 object;
  481. sattr3 new_attributes;
  482. sattrguard3 guard;
  483. };
  484. struct SETATTR3resok {
  485. wcc_data obj_wcc;
  486. };
  487. struct SETATTR3resfail {
  488. wcc_data obj_wcc;
  489. };
  490. union SETATTR3res switch (nfsstat3 status) {
  491. case NFS3_OK:
  492. SETATTR3resok resok;
  493. default:
  494. SETATTR3resfail resfail;
  495. };
  496. /*
  497. * Arguments to lookup (v3).
  498. */
  499. struct LOOKUP3args {
  500. diropargs3 what;
  501. };
  502. struct LOOKUP3resok {
  503. nfs_fh3 object;
  504. post_op_attr obj_attributes;
  505. post_op_attr dir_attributes;
  506. };
  507. struct LOOKUP3resfail {
  508. post_op_attr dir_attributes;
  509. };
  510. union LOOKUP3res switch (nfsstat3 status) {
  511. case NFS3_OK:
  512. LOOKUP3resok resok;
  513. default:
  514. LOOKUP3resfail resfail;
  515. };
  516. /*
  517. * Arguments to access (v3).
  518. */
  519. const ACCESS3_READ = 0x0001;
  520. const ACCESS3_LOOKUP = 0x0002;
  521. const ACCESS3_MODIFY = 0x0004;
  522. const ACCESS3_EXTEND = 0x0008;
  523. const ACCESS3_DELETE = 0x0010;
  524. const ACCESS3_EXECUTE = 0x0020;
  525. struct ACCESS3args {
  526. nfs_fh3 object;
  527. uint32 access;
  528. };
  529. struct ACCESS3resok {
  530. post_op_attr obj_attributes;
  531. uint32 access;
  532. };
  533. struct ACCESS3resfail {
  534. post_op_attr obj_attributes;
  535. };
  536. union ACCESS3res switch (nfsstat3 status) {
  537. case NFS3_OK:
  538. ACCESS3resok resok;
  539. default:
  540. ACCESS3resfail resfail;
  541. };
  542. /*
  543. * Arguments to readlink (v3).
  544. */
  545. struct READLINK3args {
  546. nfs_fh3 symlink;
  547. };
  548. struct READLINK3resok {
  549. post_op_attr symlink_attributes;
  550. nfspath3 data;
  551. };
  552. struct READLINK3resfail {
  553. post_op_attr symlink_attributes;
  554. };
  555. union READLINK3res switch (nfsstat3 status) {
  556. case NFS3_OK:
  557. READLINK3resok resok;
  558. default:
  559. READLINK3resfail resfail;
  560. };
  561. /*
  562. * Arguments to read (v3).
  563. */
  564. struct READ3args {
  565. nfs_fh3 file;
  566. offset3 offset;
  567. count3 count;
  568. };
  569. struct READ3resok {
  570. post_op_attr file_attributes;
  571. count3 count;
  572. bool eof;
  573. opaque data<>;
  574. };
  575. struct READ3resfail {
  576. post_op_attr file_attributes;
  577. };
  578. /* XXX: solaris 2.6 uses ``nfsstat'' here */
  579. union READ3res switch (nfsstat3 status) {
  580. case NFS3_OK:
  581. READ3resok resok;
  582. default:
  583. READ3resfail resfail;
  584. };
  585. /*
  586. * Arguments to write (v3).
  587. */
  588. enum stable_how {
  589. UNSTABLE = 0,
  590. DATA_SYNC = 1,
  591. FILE_SYNC = 2
  592. };
  593. struct WRITE3args {
  594. nfs_fh3 file;
  595. offset3 offset;
  596. count3 count;
  597. stable_how stable;
  598. opaque data<>;
  599. };
  600. struct WRITE3resok {
  601. wcc_data file_wcc;
  602. count3 count;
  603. stable_how committed;
  604. writeverf3 verf;
  605. };
  606. struct WRITE3resfail {
  607. wcc_data file_wcc;
  608. };
  609. union WRITE3res switch (nfsstat3 status) {
  610. case NFS3_OK:
  611. WRITE3resok resok;
  612. default:
  613. WRITE3resfail resfail;
  614. };
  615. /*
  616. * Arguments to create (v3).
  617. */
  618. enum createmode3 {
  619. UNCHECKED = 0,
  620. GUARDED = 1,
  621. EXCLUSIVE = 2
  622. };
  623. union createhow3 switch (createmode3 mode) {
  624. case UNCHECKED:
  625. case GUARDED:
  626. sattr3 obj_attributes;
  627. case EXCLUSIVE:
  628. createverf3 verf;
  629. };
  630. struct CREATE3args {
  631. diropargs3 where;
  632. createhow3 how;
  633. };
  634. struct CREATE3resok {
  635. post_op_fh3 obj;
  636. post_op_attr obj_attributes;
  637. wcc_data dir_wcc;
  638. };
  639. struct CREATE3resfail {
  640. wcc_data dir_wcc;
  641. };
  642. union CREATE3res switch (nfsstat3 status) {
  643. case NFS3_OK:
  644. CREATE3resok resok;
  645. default:
  646. CREATE3resfail resfail;
  647. };
  648. /*
  649. * Arguments to mkdir (v3).
  650. */
  651. struct MKDIR3args {
  652. diropargs3 where;
  653. sattr3 attributes;
  654. };
  655. struct MKDIR3resok {
  656. post_op_fh3 obj;
  657. post_op_attr obj_attributes;
  658. wcc_data dir_wcc;
  659. };
  660. struct MKDIR3resfail {
  661. wcc_data dir_wcc;
  662. };
  663. union MKDIR3res switch (nfsstat3 status) {
  664. case NFS3_OK:
  665. MKDIR3resok resok;
  666. default:
  667. MKDIR3resfail resfail;
  668. };
  669. /*
  670. * Arguments to symlink (v3).
  671. */
  672. struct symlinkdata3 {
  673. sattr3 symlink_attributes;
  674. nfspath3 symlink_data;
  675. };
  676. struct SYMLINK3args {
  677. diropargs3 where;
  678. symlinkdata3 symlink;
  679. };
  680. struct SYMLINK3resok {
  681. post_op_fh3 obj;
  682. post_op_attr obj_attributes;
  683. wcc_data dir_wcc;
  684. };
  685. struct SYMLINK3resfail {
  686. wcc_data dir_wcc;
  687. };
  688. union SYMLINK3res switch (nfsstat3 status) {
  689. case NFS3_OK:
  690. SYMLINK3resok resok;
  691. default:
  692. SYMLINK3resfail resfail;
  693. };
  694. /*
  695. * Arguments to mknod (v3).
  696. */
  697. struct devicedata3 {
  698. sattr3 dev_attributes;
  699. specdata3 spec;
  700. };
  701. union mknoddata3 switch (ftype3 type) {
  702. case NF3CHR:
  703. case NF3BLK:
  704. devicedata3 device;
  705. case NF3SOCK:
  706. case NF3FIFO:
  707. sattr3 pipe_attributes;
  708. default:
  709. void;
  710. };
  711. struct MKNOD3args {
  712. diropargs3 where;
  713. mknoddata3 what;
  714. };
  715. struct MKNOD3resok {
  716. post_op_fh3 obj;
  717. post_op_attr obj_attributes;
  718. wcc_data dir_wcc;
  719. };
  720. struct MKNOD3resfail {
  721. wcc_data dir_wcc;
  722. };
  723. union MKNOD3res switch (nfsstat3 status) {
  724. case NFS3_OK:
  725. MKNOD3resok resok;
  726. default:
  727. MKNOD3resfail resfail;
  728. };
  729. /*
  730. * Arguments to remove (v3).
  731. */
  732. struct REMOVE3args {
  733. diropargs3 object;
  734. };
  735. struct REMOVE3resok {
  736. wcc_data dir_wcc;
  737. };
  738. struct REMOVE3resfail {
  739. wcc_data dir_wcc;
  740. };
  741. union REMOVE3res switch (nfsstat3 status) {
  742. case NFS3_OK:
  743. REMOVE3resok resok;
  744. default:
  745. REMOVE3resfail resfail;
  746. };
  747. /*
  748. * Arguments to rmdir (v3).
  749. */
  750. struct RMDIR3args {
  751. diropargs3 object;
  752. };
  753. struct RMDIR3resok {
  754. wcc_data dir_wcc;
  755. };
  756. struct RMDIR3resfail {
  757. wcc_data dir_wcc;
  758. };
  759. union RMDIR3res switch (nfsstat3 status) {
  760. case NFS3_OK:
  761. RMDIR3resok resok;
  762. default:
  763. RMDIR3resfail resfail;
  764. };
  765. /*
  766. * Arguments to rename (v3).
  767. */
  768. struct RENAME3args {
  769. diropargs3 from;
  770. diropargs3 to;
  771. };
  772. struct RENAME3resok {
  773. wcc_data fromdir_wcc;
  774. wcc_data todir_wcc;
  775. };
  776. struct RENAME3resfail {
  777. wcc_data fromdir_wcc;
  778. wcc_data todir_wcc;
  779. };
  780. union RENAME3res switch (nfsstat3 status) {
  781. case NFS3_OK:
  782. RENAME3resok resok;
  783. default:
  784. RENAME3resfail resfail;
  785. };
  786. /*
  787. * Arguments to link (v3).
  788. */
  789. struct LINK3args {
  790. nfs_fh3 file;
  791. diropargs3 link;
  792. };
  793. struct LINK3resok {
  794. post_op_attr file_attributes;
  795. wcc_data linkdir_wcc;
  796. };
  797. struct LINK3resfail {
  798. post_op_attr file_attributes;
  799. wcc_data linkdir_wcc;
  800. };
  801. union LINK3res switch (nfsstat3 status) {
  802. case NFS3_OK:
  803. LINK3resok resok;
  804. default:
  805. LINK3resfail resfail;
  806. };
  807. /*
  808. * Arguments to readdir (v3).
  809. */
  810. struct READDIR3args {
  811. nfs_fh3 dir;
  812. cookie3 cookie;
  813. cookieverf3 cookieverf;
  814. count3 count;
  815. };
  816. struct entry3 {
  817. fileid3 fileid;
  818. filename3 name;
  819. cookie3 cookie;
  820. entry3 *nextentry;
  821. };
  822. struct dirlist3 {
  823. entry3 *entries;
  824. bool eof;
  825. };
  826. struct READDIR3resok {
  827. post_op_attr dir_attributes;
  828. cookieverf3 cookieverf;
  829. dirlist3 reply;
  830. };
  831. struct READDIR3resfail {
  832. post_op_attr dir_attributes;
  833. };
  834. union READDIR3res switch (nfsstat3 status) {
  835. case NFS3_OK:
  836. READDIR3resok resok;
  837. default:
  838. READDIR3resfail resfail;
  839. };
  840. /*
  841. * Arguments to readdirplus (v3).
  842. */
  843. struct READDIRPLUS3args {
  844. nfs_fh3 dir;
  845. cookie3 cookie;
  846. cookieverf3 cookieverf;
  847. count3 dircount;
  848. count3 maxcount;
  849. };
  850. struct entryplus3 {
  851. fileid3 fileid;
  852. filename3 name;
  853. cookie3 cookie;
  854. post_op_attr name_attributes;
  855. post_op_fh3 name_handle;
  856. entryplus3 *nextentry;
  857. };
  858. struct dirlistplus3 {
  859. entryplus3 *entries;
  860. bool eof;
  861. };
  862. struct READDIRPLUS3resok {
  863. post_op_attr dir_attributes;
  864. cookieverf3 cookieverf;
  865. dirlistplus3 reply;
  866. };
  867. struct READDIRPLUS3resfail {
  868. post_op_attr dir_attributes;
  869. };
  870. union READDIRPLUS3res switch (nfsstat3 status) {
  871. case NFS3_OK:
  872. READDIRPLUS3resok resok;
  873. default:
  874. READDIRPLUS3resfail resfail;
  875. };
  876. /*
  877. * Arguments to fsstat (v3).
  878. */
  879. struct FSSTAT3args {
  880. nfs_fh3 fsroot;
  881. };
  882. struct FSSTAT3resok {
  883. post_op_attr obj_attributes;
  884. size3 tbytes;
  885. size3 fbytes;
  886. size3 abytes;
  887. size3 tfiles;
  888. size3 ffiles;
  889. size3 afiles;
  890. uint32 invarsec;
  891. };
  892. struct FSSTAT3resfail {
  893. post_op_attr obj_attributes;
  894. };
  895. union FSSTAT3res switch (nfsstat3 status) {
  896. case NFS3_OK:
  897. FSSTAT3resok resok;
  898. default:
  899. FSSTAT3resfail resfail;
  900. };
  901. /*
  902. * Arguments to fsinfo (v3).
  903. */
  904. const FSF3_LINK = 0x0001;
  905. const FSF3_SYMLINK = 0x0002;
  906. const FSF3_HOMOGENEOUS = 0x0008;
  907. const FSF3_CANSETTIME = 0x0010;
  908. struct FSINFO3args {
  909. nfs_fh3 fsroot;
  910. };
  911. struct FSINFO3resok {
  912. post_op_attr obj_attributes;
  913. uint32 rtmax;
  914. uint32 rtpref;
  915. uint32 rtmult;
  916. uint32 wtmax;
  917. uint32 wtpref;
  918. uint32 wtmult;
  919. uint32 dtpref;
  920. size3 maxfilesize;
  921. nfstime3 time_delta;
  922. uint32 properties;
  923. };
  924. struct FSINFO3resfail {
  925. post_op_attr obj_attributes;
  926. };
  927. union FSINFO3res switch (nfsstat3 status) {
  928. case NFS3_OK:
  929. FSINFO3resok resok;
  930. default:
  931. FSINFO3resfail resfail;
  932. };
  933. /*
  934. * Arguments to pathconf (v3).
  935. */
  936. struct PATHCONF3args {
  937. nfs_fh3 object;
  938. };
  939. struct PATHCONF3resok {
  940. post_op_attr obj_attributes;
  941. uint32 linkmax;
  942. uint32 name_max;
  943. bool no_trunc;
  944. bool chown_restricted;
  945. bool case_insensitive;
  946. bool case_preserving;
  947. };
  948. struct PATHCONF3resfail {
  949. post_op_attr obj_attributes;
  950. };
  951. union PATHCONF3res switch (nfsstat3 status) {
  952. case NFS3_OK:
  953. PATHCONF3resok resok;
  954. default:
  955. PATHCONF3resfail resfail;
  956. };
  957. /*
  958. * Arguments to commit (v3).
  959. */
  960. struct COMMIT3args {
  961. nfs_fh3 file;
  962. offset3 offset;
  963. count3 count;
  964. };
  965. struct COMMIT3resok {
  966. wcc_data file_wcc;
  967. writeverf3 verf;
  968. };
  969. struct COMMIT3resfail {
  970. wcc_data file_wcc;
  971. };
  972. union COMMIT3res switch (nfsstat3 status) {
  973. case NFS3_OK:
  974. COMMIT3resok resok;
  975. default:
  976. COMMIT3resfail resfail;
  977. };
  978. #endif /* WANT_NFS3 */
  979. /*
  980. * Remote file service routines
  981. */
  982. program NFS_PROGRAM {
  983. version NFS_VERSION {
  984. void
  985. NFSPROC_NULL(void) = 0;
  986. attrstat
  987. NFSPROC_GETATTR(nfs_fh) = 1;
  988. attrstat
  989. NFSPROC_SETATTR(sattrargs) = 2;
  990. void
  991. NFSPROC_ROOT(void) = 3;
  992. diropres
  993. NFSPROC_LOOKUP(diropargs) = 4;
  994. readlinkres
  995. NFSPROC_READLINK(nfs_fh) = 5;
  996. readres
  997. NFSPROC_READ(readargs) = 6;
  998. void
  999. NFSPROC_WRITECACHE(void) = 7;
  1000. attrstat
  1001. NFSPROC_WRITE(writeargs) = 8;
  1002. diropres
  1003. NFSPROC_CREATE(createargs) = 9;
  1004. nfsstat
  1005. NFSPROC_REMOVE(diropargs) = 10;
  1006. nfsstat
  1007. NFSPROC_RENAME(renameargs) = 11;
  1008. nfsstat
  1009. NFSPROC_LINK(linkargs) = 12;
  1010. nfsstat
  1011. NFSPROC_SYMLINK(symlinkargs) = 13;
  1012. diropres
  1013. NFSPROC_MKDIR(createargs) = 14;
  1014. nfsstat
  1015. NFSPROC_RMDIR(diropargs) = 15;
  1016. readdirres
  1017. NFSPROC_READDIR(readdirargs) = 16;
  1018. statfsres
  1019. NFSPROC_STATFS(nfs_fh) = 17;
  1020. } = 2;
  1021. } = 100003;
  1022. #ifdef WANT_NFS3
  1023. program NFS3_PROGRAM {
  1024. version NFS_V3 {
  1025. void
  1026. NFSPROC3_NULL(void) = 0;
  1027. GETATTR3res
  1028. NFSPROC3_GETATTR(GETATTR3args) = 1;
  1029. SETATTR3res
  1030. NFSPROC3_SETATTR(SETATTR3args) = 2;
  1031. LOOKUP3res
  1032. NFSPROC3_LOOKUP(LOOKUP3args) = 3;
  1033. ACCESS3res
  1034. NFSPROC3_ACCESS(ACCESS3args) = 4;
  1035. READLINK3res
  1036. NFSPROC3_READLINK(READLINK3args) = 5;
  1037. READ3res
  1038. NFSPROC3_READ(READ3args) = 6;
  1039. WRITE3res
  1040. NFSPROC3_WRITE(WRITE3args) = 7;
  1041. CREATE3res
  1042. NFSPROC3_CREATE(CREATE3args) = 8;
  1043. MKDIR3res
  1044. NFSPROC3_MKDIR(MKDIR3args) = 9;
  1045. SYMLINK3res
  1046. NFSPROC3_SYMLINK(SYMLINK3args) = 10;
  1047. MKNOD3res
  1048. NFSPROC3_MKNOD(MKNOD3args) = 11;
  1049. REMOVE3res
  1050. NFSPROC3_REMOVE(REMOVE3args) = 12;
  1051. RMDIR3res
  1052. NFSPROC3_RMDIR(RMDIR3args) = 13;
  1053. RENAME3res
  1054. NFSPROC3_RENAME(RENAME3args) = 14;
  1055. LINK3res
  1056. NFSPROC3_LINK(LINK3args) = 15;
  1057. READDIR3res
  1058. NFSPROC3_READDIR(READDIR3args) = 16;
  1059. READDIRPLUS3res
  1060. NFSPROC3_READDIRPLUS(READDIRPLUS3args) = 17;
  1061. FSSTAT3res
  1062. NFSPROC3_FSSTAT(FSSTAT3args) = 18;
  1063. FSINFO3res
  1064. NFSPROC3_FSINFO(FSINFO3args) = 19;
  1065. PATHCONF3res
  1066. NFSPROC3_PATHCONF(PATHCONF3args) = 20;
  1067. COMMIT3res
  1068. NFSPROC3_COMMIT(COMMIT3args) = 21;
  1069. } = 3;
  1070. } = 100003;
  1071. #endif