xref: /freebsd/include/rpcsvc/nfs_prot.x (revision a8445737e740901f5f2c8d24c12ef7fc8b00134e)
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.4 1997/04/18 12:31:27 dfr 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	uid;
464 default:
465 	void;
466 };
467 
468 union set_gid3 switch (bool set_it) {
469 case TRUE:
470 	gid3	gid;
471 default:
472 	void;
473 };
474 
475 union set_size3 switch (bool set_it) {
476 case TRUE:
477 	size3	size;
478 default:
479 	void;
480 };
481 
482 union set_atime switch (time_how set_it) {
483 case SET_TO_CLIENT_TIME:
484 	nfstime3	atime;
485 default:
486 	void;
487 };
488 
489 union set_mtime switch (time_how set_it) {
490 case SET_TO_CLIENT_TIME:
491 	nfstime3	mtime;
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 /* XXX: solaris 2.6 uses ``nfsstat'' here */
661 union READ3res switch (nfsstat3 status) {
662 case NFS3_OK:
663 	READ3resok	resok;
664 default:
665 	READ3resfail	resfail;
666 };
667 
668 /*
669  * Arguments to write (v3).
670  */
671 enum stable_how {
672 	UNSTABLE	= 0,
673 	DATA_SYNC	= 1,
674 	FILE_SYNC	= 2
675 };
676 
677 struct WRITE3args {
678 	nfs_fh3		file;
679 	offset3		offset;
680 	count3		count;
681 	stable_how	stable;
682 	opaque		data<>;
683 };
684 
685 struct WRITE3resok {
686 	wcc_data	file_wcc;
687 	count3		count;
688 	stable_how	committed;
689 	writeverf3	verf;
690 };
691 
692 struct WRITE3resfail {
693 	wcc_data	file_wcc;
694 };
695 
696 union WRITE3res switch (nfsstat3 status) {
697 case NFS3_OK:
698 	WRITE3resok	resok;
699 default:
700 	WRITE3resfail	resfail;
701 };
702 
703 /*
704  * Arguments to create (v3).
705  */
706 enum createmode3 {
707 	UNCHECKED	= 0,
708 	GUARDED		= 1,
709 	EXCLUSIVE	= 2
710 };
711 
712 union createhow3 switch (createmode3 mode) {
713 case UNCHECKED:
714 case GUARDED:
715 	sattr3		obj_attributes;
716 case EXCLUSIVE:
717 	createverf3	verf;
718 };
719 
720 struct CREATE3args {
721 	diropargs3	where;
722 	createhow3	how;
723 };
724 
725 struct CREATE3resok {
726 	post_op_fh3	obj;
727 	post_op_attr	obj_attributes;
728 	wcc_data	dir_wcc;
729 };
730 
731 struct CREATE3resfail {
732 	wcc_data	dir_wcc;
733 };
734 
735 union CREATE3res switch (nfsstat3 status) {
736 case NFS3_OK:
737 	CREATE3resok	resok;
738 default:
739 	CREATE3resfail	resfail;
740 };
741 
742 /*
743  * Arguments to mkdir (v3).
744  */
745 struct MKDIR3args {
746 	diropargs3	where;
747 	sattr3		attributes;
748 };
749 
750 struct MKDIR3resok {
751 	post_op_fh3	obj;
752 	post_op_attr	obj_attributes;
753 	wcc_data	dir_wcc;
754 };
755 
756 struct MKDIR3resfail {
757 	wcc_data	dir_wcc;
758 };
759 
760 union MKDIR3res switch (nfsstat3 status) {
761 case NFS3_OK:
762 	MKDIR3resok	resok;
763 default:
764 	MKDIR3resfail	resfail;
765 };
766 
767 /*
768  * Arguments to symlink (v3).
769  */
770 struct symlinkdata3 {
771 	sattr3		symlink_attributes;
772 	nfspath3	symlink_data;
773 };
774 
775 struct SYMLINK3args {
776 	diropargs3	where;
777 	symlinkdata3	symlink;
778 };
779 
780 struct SYMLINK3resok {
781 	post_op_fh3	obj;
782 	post_op_attr	obj_attributes;
783 	wcc_data	dir_wcc;
784 };
785 
786 struct SYMLINK3resfail {
787 	wcc_data	dir_wcc;
788 };
789 
790 union SYMLINK3res switch (nfsstat3 status) {
791 case NFS3_OK:
792 	SYMLINK3resok	resok;
793 default:
794 	SYMLINK3resfail	resfail;
795 };
796 
797 /*
798  * Arguments to mknod (v3).
799  */
800 struct devicedata3 {
801 	sattr3		dev_attributes;
802 	specdata3	spec;
803 };
804 
805 union mknoddata3 switch (ftype3 type) {
806 case NF3CHR:
807 case NF3BLK:
808 	devicedata3	device;
809 case NF3SOCK:
810 case NF3FIFO:
811 	sattr3		pipe_attributes;
812 default:
813 	void;
814 };
815 
816 struct MKNOD3args {
817 	diropargs3	where;
818 	mknoddata3	what;
819 };
820 
821 struct MKNOD3resok {
822 	post_op_fh3	obj;
823 	post_op_attr	obj_attributes;
824 	wcc_data	dir_wcc;
825 };
826 
827 struct MKNOD3resfail {
828 	wcc_data	dir_wcc;
829 };
830 
831 union MKNOD3res switch (nfsstat3 status) {
832 case NFS3_OK:
833 	MKNOD3resok	resok;
834 default:
835 	MKNOD3resfail	resfail;
836 };
837 
838 /*
839  * Arguments to remove (v3).
840  */
841 struct REMOVE3args {
842 	diropargs3	object;
843 };
844 
845 struct REMOVE3resok {
846 	wcc_data	dir_wcc;
847 };
848 
849 struct REMOVE3resfail {
850 	wcc_data	dir_wcc;
851 };
852 
853 union REMOVE3res switch (nfsstat3 status) {
854 case NFS3_OK:
855 	REMOVE3resok	resok;
856 default:
857 	REMOVE3resfail	resfail;
858 };
859 
860 /*
861  * Arguments to rmdir (v3).
862  */
863 struct RMDIR3args {
864 	diropargs3	object;
865 };
866 
867 struct RMDIR3resok {
868 	wcc_data	dir_wcc;
869 };
870 
871 struct RMDIR3resfail {
872 	wcc_data	dir_wcc;
873 };
874 
875 union RMDIR3res switch (nfsstat3 status) {
876 case NFS3_OK:
877 	RMDIR3resok	resok;
878 default:
879 	RMDIR3resfail	resfail;
880 };
881 
882 /*
883  * Arguments to rename (v3).
884  */
885 struct RENAME3args {
886 	diropargs3	from;
887 	diropargs3	to;
888 };
889 
890 struct RENAME3resok {
891 	wcc_data	fromdir_wcc;
892 	wcc_data	todir_wcc;
893 };
894 
895 struct RENAME3resfail {
896 	wcc_data	fromdir_wcc;
897 	wcc_data	todir_wcc;
898 };
899 
900 union RENAME3res switch (nfsstat3 status) {
901 case NFS3_OK:
902 	RENAME3resok	resok;
903 default:
904 	RENAME3resfail	resfail;
905 };
906 
907 /*
908  * Arguments to link (v3).
909  */
910 struct LINK3args {
911 	nfs_fh3		file;
912 	diropargs3	link;
913 };
914 
915 struct LINK3resok {
916 	post_op_attr	file_attributes;
917 	wcc_data	linkdir_wcc;
918 };
919 
920 struct LINK3resfail {
921 	post_op_attr	file_attributes;
922 	wcc_data	linkdir_wcc;
923 };
924 
925 union LINK3res switch (nfsstat3 status) {
926 case NFS3_OK:
927 	LINK3resok	resok;
928 default:
929 	LINK3resfail	resfail;
930 };
931 
932 /*
933  * Arguments to readdir (v3).
934  */
935 struct READDIR3args {
936 	nfs_fh3		dir;
937 	cookie3		cookie;
938 	cookieverf3	cookieverf;
939 	count3		count;
940 };
941 
942 struct entry3 {
943 	fileid3		fileid;
944 	filename3	name;
945 	cookie3		cookie;
946 	entry3		*nextentry;
947 };
948 
949 struct dirlist3 {
950 	entry3		*entries;
951 	bool		eof;
952 };
953 
954 struct READDIR3resok {
955 	post_op_attr	dir_attributes;
956 	cookieverf3	cookieverf;
957 	dirlist3	reply;
958 };
959 
960 struct READDIR3resfail {
961 	post_op_attr	dir_attributes;
962 };
963 
964 union READDIR3res switch (nfsstat3 status) {
965 case NFS3_OK:
966 	READDIR3resok	resok;
967 default:
968 	READDIR3resfail	resfail;
969 };
970 
971 /*
972  * Arguments to readdirplus (v3).
973  */
974 struct READDIRPLUS3args {
975 	nfs_fh3		dir;
976 	cookie3		cookie;
977 	cookieverf3	cookieverf;
978 	count3		dircount;
979 	count3		maxcount;
980 };
981 
982 struct entryplus3 {
983 	fileid3		fileid;
984 	filename3	name;
985 	cookie3		cookie;
986 	post_op_attr	name_attributes;
987 	post_op_fh3	name_handle;
988 	entryplus3	*nextentry;
989 };
990 
991 struct dirlistplus3 {
992 	entryplus3	*entries;
993 	bool		eof;
994 };
995 
996 struct READDIRPLUS3resok {
997 	post_op_attr	dir_attributes;
998 	cookieverf3	cookieverf;
999 	dirlistplus3	reply;
1000 };
1001 
1002 struct READDIRPLUS3resfail {
1003 	post_op_attr	dir_attributes;
1004 };
1005 
1006 union READDIRPLUS3res switch (nfsstat3 status) {
1007 case NFS3_OK:
1008 	READDIRPLUS3resok	resok;
1009 default:
1010 	READDIRPLUS3resfail	resfail;
1011 };
1012 
1013 /*
1014  * Arguments to fsstat (v3).
1015  */
1016 struct FSSTAT3args {
1017 	nfs_fh3		fsroot;
1018 };
1019 
1020 struct FSSTAT3resok {
1021 	post_op_attr	obj_attributes;
1022 	size3		tbytes;
1023 	size3		fbytes;
1024 	size3		abytes;
1025 	size3		tfiles;
1026 	size3		ffiles;
1027 	size3		afiles;
1028 	uint32		invarsec;
1029 };
1030 
1031 struct FSSTAT3resfail {
1032 	post_op_attr	obj_attributes;
1033 };
1034 
1035 union FSSTAT3res switch (nfsstat3 status) {
1036 case NFS3_OK:
1037 	FSSTAT3resok	resok;
1038 default:
1039 	FSSTAT3resfail	resfail;
1040 };
1041 
1042 /*
1043  * Arguments to fsinfo (v3).
1044  */
1045 const FSF3_LINK		= 0x0001;
1046 const FSF3_SYMLINK	= 0x0002;
1047 const FSF3_HOMOGENEOUS	= 0x0008;
1048 const FSF3_CANSETTIME	= 0x0010;
1049 
1050 struct FSINFO3args {
1051 	nfs_fh3		fsroot;
1052 };
1053 
1054 struct FSINFO3resok {
1055 	post_op_attr	obj_attributes;
1056 	uint32		rtmax;
1057 	uint32		rtpref;
1058 	uint32		rtmult;
1059 	uint32		wtmax;
1060 	uint32		wtpref;
1061 	uint32		wtmult;
1062 	uint32		dtpref;
1063 	size3		maxfilesize;
1064 	nfstime3	time_delta;
1065 	uint32		properties;
1066 };
1067 
1068 struct FSINFO3resfail {
1069 	post_op_attr	obj_attributes;
1070 };
1071 
1072 union FSINFO3res switch (nfsstat3 status) {
1073 case NFS3_OK:
1074 	FSINFO3resok	resok;
1075 default:
1076 	FSINFO3resfail	resfail;
1077 };
1078 
1079 /*
1080  * Arguments to pathconf (v3).
1081  */
1082 struct PATHCONF3args {
1083 	nfs_fh3		object;
1084 };
1085 
1086 struct PATHCONF3resok {
1087 	post_op_attr	obj_attributes;
1088 	uint32		linkmax;
1089 	uint32		name_max;
1090 	bool		no_trunc;
1091 	bool		chown_restricted;
1092 	bool		case_insensitive;
1093 	bool		case_preserving;
1094 };
1095 
1096 struct PATHCONF3resfail {
1097 	post_op_attr	obj_attributes;
1098 };
1099 
1100 union PATHCONF3res switch (nfsstat3 status) {
1101 case NFS3_OK:
1102 	PATHCONF3resok	resok;
1103 default:
1104 	PATHCONF3resfail	resfail;
1105 };
1106 
1107 /*
1108  * Arguments to commit (v3).
1109  */
1110 struct COMMIT3args {
1111 	nfs_fh3		file;
1112 	offset3		offset;
1113 	count3		count;
1114 };
1115 
1116 struct COMMIT3resok {
1117 	wcc_data	file_wcc;
1118 	writeverf3	verf;
1119 };
1120 
1121 struct COMMIT3resfail {
1122 	wcc_data	file_wcc;
1123 };
1124 
1125 union COMMIT3res switch (nfsstat3 status) {
1126 case NFS3_OK:
1127 	COMMIT3resok	resok;
1128 default:
1129 	COMMIT3resfail	resfail;
1130 };
1131 
1132 #endif /* WANT_NFS3 */
1133 
1134 /*
1135  * Remote file service routines
1136  */
1137 program NFS_PROGRAM {
1138 	version NFS_VERSION {
1139 		void
1140 		NFSPROC_NULL(void) = 0;
1141 
1142 		attrstat
1143 		NFSPROC_GETATTR(nfs_fh) =	1;
1144 
1145 		attrstat
1146 		NFSPROC_SETATTR(sattrargs) = 2;
1147 
1148 		void
1149 		NFSPROC_ROOT(void) = 3;
1150 
1151 		diropres
1152 		NFSPROC_LOOKUP(diropargs) = 4;
1153 
1154 		readlinkres
1155 		NFSPROC_READLINK(nfs_fh) = 5;
1156 
1157 		readres
1158 		NFSPROC_READ(readargs) = 6;
1159 
1160 		void
1161 		NFSPROC_WRITECACHE(void) = 7;
1162 
1163 		attrstat
1164 		NFSPROC_WRITE(writeargs) = 8;
1165 
1166 		diropres
1167 		NFSPROC_CREATE(createargs) = 9;
1168 
1169 		nfsstat
1170 		NFSPROC_REMOVE(diropargs) = 10;
1171 
1172 		nfsstat
1173 		NFSPROC_RENAME(renameargs) = 11;
1174 
1175 		nfsstat
1176 		NFSPROC_LINK(linkargs) = 12;
1177 
1178 		nfsstat
1179 		NFSPROC_SYMLINK(symlinkargs) = 13;
1180 
1181 		diropres
1182 		NFSPROC_MKDIR(createargs) = 14;
1183 
1184 		nfsstat
1185 		NFSPROC_RMDIR(diropargs) = 15;
1186 
1187 		readdirres
1188 		NFSPROC_READDIR(readdirargs) = 16;
1189 
1190 		statfsres
1191 		NFSPROC_STATFS(nfs_fh) = 17;
1192 	} = 2;
1193 } = 100003;
1194 #ifdef WANT_NFS3
1195 program NFS3_PROGRAM {
1196 	version NFS_V3 {
1197 		void
1198 		NFSPROC3_NULL(void)			= 0;
1199 
1200 		GETATTR3res
1201 		NFSPROC3_GETATTR(GETATTR3args)		= 1;
1202 
1203 		SETATTR3res
1204 		NFSPROC3_SETATTR(SETATTR3args)		= 2;
1205 
1206 		LOOKUP3res
1207 		NFSPROC3_LOOKUP(LOOKUP3args)		= 3;
1208 
1209 		ACCESS3res
1210 		NFSPROC3_ACCESS(ACCESS3args)		= 4;
1211 
1212 		READLINK3res
1213 		NFSPROC3_READLINK(READLINK3args)	= 5;
1214 
1215 		READ3res
1216 		NFSPROC3_READ(READ3args)		= 6;
1217 
1218 		WRITE3res
1219 		NFSPROC3_WRITE(WRITE3args)		= 7;
1220 
1221 		CREATE3res
1222 		NFSPROC3_CREATE(CREATE3args)		= 8;
1223 
1224 		MKDIR3res
1225 		NFSPROC3_MKDIR(MKDIR3args)		= 9;
1226 
1227 		SYMLINK3res
1228 		NFSPROC3_SYMLINK(SYMLINK3args)		= 10;
1229 
1230 		MKNOD3res
1231 		NFSPROC3_MKNOD(MKNOD3args)		= 11;
1232 
1233 		REMOVE3res
1234 		NFSPROC3_REMOVE(REMOVE3args)		= 12;
1235 
1236 		RMDIR3res
1237 		NFSPROC3_RMDIR(RMDIR3args)		= 13;
1238 
1239 		RENAME3res
1240 		NFSPROC3_RENAME(RENAME3args)		= 14;
1241 
1242 		LINK3res
1243 		NFSPROC3_LINK(LINK3args)		= 15;
1244 
1245 		READDIR3res
1246 		NFSPROC3_READDIR(READDIR3args)		= 16;
1247 
1248 		READDIRPLUS3res
1249 		NFSPROC3_READDIRPLUS(READDIRPLUS3args)	= 17;
1250 
1251 		FSSTAT3res
1252 		NFSPROC3_FSSTAT(FSSTAT3args)		= 18;
1253 
1254 		FSINFO3res
1255 		NFSPROC3_FSINFO(FSINFO3args)		= 19;
1256 
1257 		PATHCONF3res
1258 		NFSPROC3_PATHCONF(PATHCONF3args)	= 20;
1259 
1260 		COMMIT3res
1261 		NFSPROC3_COMMIT(COMMIT3args)		= 21;
1262 	} = 3;
1263 } = 100003;
1264 #endif
1265 
1266