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