proto files: add a simplified bsd licence to the dot-x files
[deb_libnfs.git] / nfs / nfs.x
CommitLineData
2f5c161b
RS
1/*
2Copyright (c) 2014, Ronnie Sahlberg
3All rights reserved.
4
5Redistribution and use in source and binary forms, with or without
6modification, are permitted provided that the following conditions are met:
7
81. Redistributions of source code must retain the above copyright notice, this
9 list of conditions and the following disclaimer.
102. Redistributions in binary form must reproduce the above copyright notice,
11 this list of conditions and the following disclaimer in the documentation
12 and/or other materials provided with the distribution.
13
14THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
15ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
16WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
17DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
18ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
19(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
20LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
21ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
23SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24
25The views and conclusions contained in the software and documentation are those
26of the authors and should not be interpreted as representing official policies,
27either expressed or implied, of the FreeBSD Project.
28*/
84004dbf 29
f38aacf8
RS
30/*
31 * NFS v3 Definitions
32 */
84004dbf
RS
33const NFS3_FHSIZE = 64; /* Maximum bytes in a V3 file handle */
34const NFS3_WRITEVERFSIZE = 8;
35const NFS3_CREATEVERFSIZE = 8;
36const NFS3_COOKIEVERFSIZE = 8;
37
38typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
39
6b93021b 40/*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE="
20601559
M
41 where rpcgen doesn't know anything about hyper
42 default to unsigned hyper as of rfc 1813 */
43#ifndef U_INT64_PLATTFORM_TYPE
44#define U_INT64_PLATTFORM_TYPE unsigned hyper
45#endif/*U_INT64_PLATTFORM_TYPE*/
46
47typedef U_INT64_PLATTFORM_TYPE uint64;
6b93021b 48
84004dbf
RS
49typedef uint64 cookie3;
50
51struct nfs_fh3 {
52 opaque data<NFS3_FHSIZE>;
53};
54
55typedef string filename3<>;
56
57struct diropargs3 {
58 nfs_fh3 dir;
59 filename3 name;
60};
61
62enum ftype3 {
63 NF3REG = 1,
64 NF3DIR = 2,
65 NF3BLK = 3,
66 NF3CHR = 4,
67 NF3LNK = 5,
68 NF3SOCK = 6,
69 NF3FIFO = 7
70};
71
c0ebf57b 72typedef unsigned int mode3;
84004dbf 73
c0ebf57b 74typedef unsigned int uid3;
84004dbf 75
c0ebf57b 76typedef unsigned int gid3;
84004dbf
RS
77
78typedef uint64 size3;
79
80typedef uint64 fileid3;
81
82struct specdata3 {
c0ebf57b
RS
83 unsigned int specdata1;
84 unsigned int specdata2;
84004dbf
RS
85};
86
87struct nfstime3 {
c0ebf57b
RS
88 unsigned int seconds;
89 unsigned int nseconds;
84004dbf
RS
90};
91
92struct fattr3 {
c0ebf57b
RS
93 ftype3 type;
94 mode3 mode;
95 unsigned int nlink;
96 uid3 uid;
97 gid3 gid;
98 size3 size;
99 size3 used;
100 specdata3 rdev;
101 uint64 fsid;
102 fileid3 fileid;
103 nfstime3 atime;
104 nfstime3 mtime;
105 nfstime3 ctime;
84004dbf
RS
106};
107
108union post_op_attr switch (bool attributes_follow) {
109 case TRUE:
110 fattr3 attributes;
111 case FALSE:
112 void;
113};
114
115
116enum nfsstat3 {
117 NFS3_OK = 0,
118 NFS3ERR_PERM = 1,
119 NFS3ERR_NOENT = 2,
120 NFS3ERR_IO = 5,
121 NFS3ERR_NXIO = 6,
122 NFS3ERR_ACCES = 13,
123 NFS3ERR_EXIST = 17,
124 NFS3ERR_XDEV = 18,
125 NFS3ERR_NODEV = 19,
126 NFS3ERR_NOTDIR = 20,
127 NFS3ERR_ISDIR = 21,
128 NFS3ERR_INVAL = 22,
129 NFS3ERR_FBIG = 27,
130 NFS3ERR_NOSPC = 28,
131 NFS3ERR_ROFS = 30,
132 NFS3ERR_MLINK = 31,
133 NFS3ERR_NAMETOOLONG = 63,
134 NFS3ERR_NOTEMPTY = 66,
135 NFS3ERR_DQUOT = 69,
136 NFS3ERR_STALE = 70,
137 NFS3ERR_REMOTE = 71,
138 NFS3ERR_BADHANDLE = 10001,
139 NFS3ERR_NOT_SYNC = 10002,
140 NFS3ERR_BAD_COOKIE = 10003,
141 NFS3ERR_NOTSUPP = 10004,
142 NFS3ERR_TOOSMALL = 10005,
143 NFS3ERR_SERVERFAULT = 10006,
144 NFS3ERR_BADTYPE = 10007,
145 NFS3ERR_JUKEBOX = 10008
146};
147
148enum stable_how {
149 UNSTABLE = 0,
150 DATA_SYNC = 1,
151 FILE_SYNC = 2
152};
153
154typedef uint64 offset3;
155
c0ebf57b 156typedef unsigned int count3;
84004dbf
RS
157
158struct wcc_attr {
159 size3 size;
160 nfstime3 mtime;
161 nfstime3 ctime;
162};
163
164union pre_op_attr switch (bool attributes_follow) {
165 case TRUE:
166 wcc_attr attributes;
167 case FALSE:
168 void;
169};
170
171struct wcc_data {
172 pre_op_attr before;
173 post_op_attr after;
174};
175
176struct WRITE3args {
177 nfs_fh3 file;
178 offset3 offset;
179 count3 count;
180 stable_how stable;
181 opaque data<>;
182};
183
184typedef opaque writeverf3[NFS3_WRITEVERFSIZE];
185
186struct WRITE3resok {
187 wcc_data file_wcc;
188 count3 count;
189 stable_how committed;
190 writeverf3 verf;
191};
192
193struct WRITE3resfail {
194 wcc_data file_wcc;
195};
196
197union WRITE3res switch (nfsstat3 status) {
198 case NFS3_OK:
199 WRITE3resok resok;
200 default:
201 WRITE3resfail resfail;
202};
203
204struct LOOKUP3args {
205 diropargs3 what;
206};
207
208struct LOOKUP3resok {
209 nfs_fh3 object;
210 post_op_attr obj_attributes;
211 post_op_attr dir_attributes;
212};
213
214struct LOOKUP3resfail {
215 post_op_attr dir_attributes;
216};
217
218
219
220union LOOKUP3res switch (nfsstat3 status) {
221 case NFS3_OK:
222 LOOKUP3resok resok;
223 default:
224 LOOKUP3resfail resfail;
225};
226
227struct COMMIT3args {
228 nfs_fh3 file;
229 offset3 offset;
230 count3 count;
231};
232
233struct COMMIT3resok {
234 wcc_data file_wcc;
235 writeverf3 verf;
236};
237
238struct COMMIT3resfail {
239 wcc_data file_wcc;
240};
241
242union COMMIT3res switch (nfsstat3 status) {
243 case NFS3_OK:
244 COMMIT3resok resok;
245 default:
246 COMMIT3resfail resfail;
247};
248
249const ACCESS3_READ = 0x0001;
250const ACCESS3_LOOKUP = 0x0002;
251const ACCESS3_MODIFY = 0x0004;
252const ACCESS3_EXTEND = 0x0008;
253const ACCESS3_DELETE = 0x0010;
254const ACCESS3_EXECUTE = 0x0020;
255
256struct ACCESS3args {
c0ebf57b
RS
257 nfs_fh3 object;
258 unsigned int access;
84004dbf
RS
259};
260
261struct ACCESS3resok {
c0ebf57b
RS
262 post_op_attr obj_attributes;
263 unsigned int access;
84004dbf
RS
264};
265
266struct ACCESS3resfail {
267 post_op_attr obj_attributes;
268};
269
270union ACCESS3res switch (nfsstat3 status) {
271case NFS3_OK:
272 ACCESS3resok resok;
273default:
274 ACCESS3resfail resfail;
275};
276
277struct GETATTR3args {
278 nfs_fh3 object;
279};
280
281struct GETATTR3resok {
282 fattr3 obj_attributes;
283};
284
285union GETATTR3res switch (nfsstat3 status) {
286 case NFS3_OK:
287 GETATTR3resok resok;
288 default:
289 void;
290};
291
292
293
294enum time_how {
295 DONT_CHANGE = 0,
296 SET_TO_SERVER_TIME = 1,
297 SET_TO_CLIENT_TIME = 2
298};
299
300union set_mode3 switch (bool set_it) {
301 case TRUE:
302 mode3 mode;
303 default:
304 void;
305};
306
307union set_uid3 switch (bool set_it) {
308 case TRUE:
309 uid3 uid;
310 default:
311 void;
312};
313
314union set_gid3 switch (bool set_it) {
315 case TRUE:
316 gid3 gid;
317 default:
318 void;
319};
320
321union set_size3 switch (bool set_it) {
322 case TRUE:
323 size3 size;
324 default:
325 void;
326};
327
328union set_atime switch (time_how set_it) {
329 case SET_TO_CLIENT_TIME:
330 nfstime3 atime;
331 default:
332 void;
333};
334
335union set_mtime switch (time_how set_it) {
336 case SET_TO_CLIENT_TIME:
337 nfstime3 mtime;
338 default:
339 void;
340};
341
342struct sattr3 {
343 set_mode3 mode;
344 set_uid3 uid;
345 set_gid3 gid;
346 set_size3 size;
347 set_atime atime;
348 set_mtime mtime;
349};
350
351enum createmode3 {
352 UNCHECKED = 0,
353 GUARDED = 1,
354 EXCLUSIVE = 2
355};
356
357
358typedef opaque createverf3[NFS3_CREATEVERFSIZE];
359
360union createhow3 switch (createmode3 mode) {
361 case UNCHECKED:
84004dbf 362 sattr3 obj_attributes;
e0261457
RS
363 case GUARDED:
364 sattr3 g_obj_attributes;
84004dbf
RS
365 case EXCLUSIVE:
366 createverf3 verf;
367};
368
369struct CREATE3args {
370 diropargs3 where;
371 createhow3 how;
372};
373
374union post_op_fh3 switch (bool handle_follows) {
375 case TRUE:
376 nfs_fh3 handle;
377 case FALSE:
378 void;
379};
380
381struct CREATE3resok {
382 post_op_fh3 obj;
383 post_op_attr obj_attributes;
384 wcc_data dir_wcc;
385};
386
387struct CREATE3resfail {
388 wcc_data dir_wcc;
389 };
390
391union CREATE3res switch (nfsstat3 status) {
392 case NFS3_OK:
393 CREATE3resok resok;
394 default:
395 CREATE3resfail resfail;
396};
397
398struct REMOVE3args {
399 diropargs3 object;
400};
401
402struct REMOVE3resok {
403 wcc_data dir_wcc;
404};
405
406struct REMOVE3resfail {
407 wcc_data dir_wcc;
408};
409
410union REMOVE3res switch (nfsstat3 status) {
411 case NFS3_OK:
412 REMOVE3resok resok;
413 default:
414 REMOVE3resfail resfail;
415};
416
417struct READ3args {
418 nfs_fh3 file;
419 offset3 offset;
420 count3 count;
421};
422
423struct READ3resok {
424 post_op_attr file_attributes;
425 count3 count;
426 bool eof;
427 opaque data<>;
428};
429
430struct READ3resfail {
431 post_op_attr file_attributes;
432};
433
434union READ3res switch (nfsstat3 status) {
435 case NFS3_OK:
436 READ3resok resok;
437 default:
438 READ3resfail resfail;
439};
440
441
442const FSF3_LINK = 0x0001;
443const FSF3_SYMLINK = 0x0002;
444const FSF3_HOMOGENEOUS = 0x0008;
445const FSF3_CANSETTIME = 0x0010;
446
447struct FSINFO3args {
448 nfs_fh3 fsroot;
449};
450
451struct FSINFO3resok {
452 post_op_attr obj_attributes;
c0ebf57b
RS
453 unsigned int rtmax;
454 unsigned int rtpref;
455 unsigned int rtmult;
456 unsigned int wtmax;
457 unsigned int wtpref;
458 unsigned int wtmult;
459 unsigned int dtpref;
84004dbf
RS
460 size3 maxfilesize;
461 nfstime3 time_delta;
c0ebf57b 462 unsigned int properties;
84004dbf
RS
463};
464
465struct FSINFO3resfail {
466 post_op_attr obj_attributes;
467};
468
469union FSINFO3res switch (nfsstat3 status) {
470 case NFS3_OK:
471 FSINFO3resok resok;
472 default:
473 FSINFO3resfail resfail;
474};
475
476
477struct FSSTAT3args {
478 nfs_fh3 fsroot;
479};
480
481struct FSSTAT3resok {
482 post_op_attr obj_attributes;
483 size3 tbytes;
484 size3 fbytes;
485 size3 abytes;
486 size3 tfiles;
487 size3 ffiles;
488 size3 afiles;
c0ebf57b 489 unsigned int invarsec;
84004dbf
RS
490};
491
492struct FSSTAT3resfail {
493 post_op_attr obj_attributes;
494};
495
496union FSSTAT3res switch (nfsstat3 status) {
497 case NFS3_OK:
498 FSSTAT3resok resok;
499 default:
500 FSSTAT3resfail resfail;
501};
502
503struct PATHCONF3args {
504 nfs_fh3 object;
505};
506
507struct PATHCONF3resok {
508 post_op_attr obj_attributes;
c0ebf57b
RS
509 unsigned int linkmax;
510 unsigned int name_max;
84004dbf
RS
511 bool no_trunc;
512 bool chown_restricted;
513 bool case_insensitive;
514 bool case_preserving;
515};
516
517struct PATHCONF3resfail {
518 post_op_attr obj_attributes;
519};
520
521union PATHCONF3res switch (nfsstat3 status) {
522 case NFS3_OK:
523 PATHCONF3resok resok;
524 default:
525 PATHCONF3resfail resfail;
526};
527
528typedef string nfspath3<>;
529
530struct symlinkdata3 {
531 sattr3 symlink_attributes;
532 nfspath3 symlink_data;
533};
534
535struct SYMLINK3args {
536 diropargs3 where;
537 symlinkdata3 symlink;
538};
539
540struct SYMLINK3resok {
541 post_op_fh3 obj;
542 post_op_attr obj_attributes;
543 wcc_data dir_wcc;
544};
545
546struct SYMLINK3resfail {
547 wcc_data dir_wcc;
548};
549
550union SYMLINK3res switch (nfsstat3 status) {
551 case NFS3_OK:
552 SYMLINK3resok resok;
553 default:
554 SYMLINK3resfail resfail;
555};
556
557
558struct READLINK3args {
559 nfs_fh3 symlink;
560};
561
562struct READLINK3resok {
563 post_op_attr symlink_attributes;
564 nfspath3 data;
565};
566
567struct READLINK3resfail {
568 post_op_attr symlink_attributes;
569};
570
571union READLINK3res switch (nfsstat3 status) {
572 case NFS3_OK:
573 READLINK3resok resok;
574 default:
575 READLINK3resfail resfail;
576};
577
578
579struct devicedata3 {
580 sattr3 dev_attributes;
581 specdata3 spec;
582};
583
584union mknoddata3 switch (ftype3 type) {
585 case NF3CHR:
e0261457 586 devicedata3 chr_device;
84004dbf 587 case NF3BLK:
e0261457 588 devicedata3 blk_device;
84004dbf 589 case NF3SOCK:
e0261457 590 sattr3 sock_attributes;
84004dbf
RS
591 case NF3FIFO:
592 sattr3 pipe_attributes;
593 default:
594 void;
595};
596
597struct MKNOD3args {
598 diropargs3 where;
599 mknoddata3 what;
600};
601
602struct MKNOD3resok {
603 post_op_fh3 obj;
604 post_op_attr obj_attributes;
605 wcc_data dir_wcc;
606};
607
608struct MKNOD3resfail {
609 wcc_data dir_wcc;
610};
611
612union MKNOD3res switch (nfsstat3 status) {
613 case NFS3_OK:
614 MKNOD3resok resok;
615 default:
616 MKNOD3resfail resfail;
617};
618
619
620struct MKDIR3args {
621 diropargs3 where;
622 sattr3 attributes;
623};
624
625struct MKDIR3resok {
626 post_op_fh3 obj;
627 post_op_attr obj_attributes;
628 wcc_data dir_wcc;
629};
630
631struct MKDIR3resfail {
632 wcc_data dir_wcc;
633};
634
635union MKDIR3res switch (nfsstat3 status) {
636 case NFS3_OK:
637 MKDIR3resok resok;
638 default:
639 MKDIR3resfail resfail;
640};
641
642struct RMDIR3args {
643 diropargs3 object;
644};
645
646struct RMDIR3resok {
647 wcc_data dir_wcc;
648};
649
650struct RMDIR3resfail {
651 wcc_data dir_wcc;
652};
653
654union RMDIR3res switch (nfsstat3 status) {
655 case NFS3_OK:
656 RMDIR3resok resok;
657 default:
658 RMDIR3resfail resfail;
659};
660
661struct RENAME3args {
662 diropargs3 from;
663 diropargs3 to;
664};
665
666struct RENAME3resok {
667 wcc_data fromdir_wcc;
668 wcc_data todir_wcc;
669};
670
671struct RENAME3resfail {
672 wcc_data fromdir_wcc;
673 wcc_data todir_wcc;
674};
675
676union RENAME3res switch (nfsstat3 status) {
677 case NFS3_OK:
678 RENAME3resok resok;
679 default:
680 RENAME3resfail resfail;
681};
682
683struct READDIRPLUS3args {
684 nfs_fh3 dir;
685 cookie3 cookie;
686 cookieverf3 cookieverf;
687 count3 dircount;
688 count3 maxcount;
689};
690
691struct entryplus3 {
692 fileid3 fileid;
693 filename3 name;
694 cookie3 cookie;
695 post_op_attr name_attributes;
696 post_op_fh3 name_handle;
697 entryplus3 *nextentry;
698};
699
700struct dirlistplus3 {
701 entryplus3 *entries;
702 bool eof;
703};
704
705struct READDIRPLUS3resok {
706 post_op_attr dir_attributes;
707 cookieverf3 cookieverf;
708 dirlistplus3 reply;
709};
710
711
712struct READDIRPLUS3resfail {
713 post_op_attr dir_attributes;
714};
715
716union READDIRPLUS3res switch (nfsstat3 status) {
717 case NFS3_OK:
718 READDIRPLUS3resok resok;
719 default:
720 READDIRPLUS3resfail resfail;
721};
722
723struct READDIR3args {
724 nfs_fh3 dir;
725 cookie3 cookie;
726 cookieverf3 cookieverf;
727 count3 count;
728};
729
730
731struct entry3 {
732 fileid3 fileid;
733 filename3 name;
734 cookie3 cookie;
735 entry3 *nextentry;
736};
737
738struct dirlist3 {
739 entry3 *entries;
740 bool eof;
741};
742
743struct READDIR3resok {
744 post_op_attr dir_attributes;
745 cookieverf3 cookieverf;
746 dirlist3 reply;
747};
748
749struct READDIR3resfail {
750 post_op_attr dir_attributes;
751};
752
753union READDIR3res switch (nfsstat3 status) {
754 case NFS3_OK:
755 READDIR3resok resok;
756 default:
757 READDIR3resfail resfail;
758};
759
760struct LINK3args {
761 nfs_fh3 file;
762 diropargs3 link;
763};
764
765struct LINK3resok {
766 post_op_attr file_attributes;
767 wcc_data linkdir_wcc;
768};
769
770struct LINK3resfail {
771 post_op_attr file_attributes;
772 wcc_data linkdir_wcc;
773};
774
775union LINK3res switch (nfsstat3 status) {
776 case NFS3_OK:
777 LINK3resok resok;
778 default:
779 LINK3resfail resfail;
780};
781
782union sattrguard3 switch (bool check) {
783 case TRUE:
784 nfstime3 obj_ctime;
785 case FALSE:
786 void;
787};
788
789struct SETATTR3args {
790 nfs_fh3 object;
791 sattr3 new_attributes;
792 sattrguard3 guard;
793};
794
795struct SETATTR3resok {
796 wcc_data obj_wcc;
797};
798
799struct SETATTR3resfail {
800 wcc_data obj_wcc;
801};
802
803union SETATTR3res switch (nfsstat3 status) {
804 case NFS3_OK:
805 SETATTR3resok resok;
806 default:
807 SETATTR3resfail resfail;
808};
809
f38aacf8
RS
810/*
811 * NFS v2 Definitions
812 * We share many definitions from v3
813 */
814const FHSIZE2 = 32;
815typedef opaque fhandle2[FHSIZE2];
816
817enum ftype2 {
818 NF2NON = 0,
819 NF2REG = 1,
820 NF2DIR = 2,
821 NF2BLK = 3,
822 NF2CHR = 4,
823 NF2LNK = 5
824};
825
826struct fattr2 {
827 ftype2 type;
828 unsigned int mode;
829 unsigned int nlink;
830 unsigned int uid;
831 unsigned int gid;
832 unsigned int size;
833 unsigned int blocksize;
834 unsigned int rdev;
835 unsigned int blocks;
836 unsigned int fsid;
837 unsigned int fileid;
838 nfstime3 atime;
839 nfstime3 mtime;
840 nfstime3 ctime;
841};
842
843struct sattr2 {
844 unsigned int mode;
845 unsigned int uid;
846 unsigned int gid;
847 unsigned int size;
848 nfstime3 atime;
849 nfstime3 mtime;
850};
851
852const MAXNAMLEN2 = 255;
853typedef string filename2<MAXNAMLEN2>;
854
855const MAXPATHLEN2 = 1024;
856typedef string path2<MAXPATHLEN2>;
857
858const NFSMAXDATA2 = 8192;
859typedef opaque nfsdata2<NFSMAXDATA2>;
860
861const NFSCOOKIESIZE2 = 4;
862typedef opaque nfscookie2[NFSCOOKIESIZE2];
863
864struct entry2 {
865 unsigned int fileid;
866 filename2 name;
867 nfscookie2 cookie;
868 entry2 *nextentry;
869};
870
871struct diropargs2 {
872 fhandle2 dir;
873 filename2 name;
874};
875
876struct GETATTR2args {
877 fhandle2 fhandle;
878};
879
880struct GETATTR2resok {
881 fattr2 attributes;
882};
883
884union GETATTR2res switch (nfsstat3 status) {
885 case NFS3_OK:
886 GETATTR2resok resok;
887 default:
888 void;
889};
890
891struct SETATTR2args {
892 fhandle2 fhandle;
893 sattr2 attributes;
894};
895
896struct SETATTR2resok {
897 fattr2 attributes;
898};
899
900union SETATTR2res switch (nfsstat3 status) {
901 case NFS3_OK:
902 SETATTR2resok resok;
903 default:
904 void;
905};
906
907struct LOOKUP2args {
908 diropargs2 what;
909};
910
911struct LOOKUP2resok {
912 fhandle2 file;
913 fattr2 attributes;
914};
915
916union LOOKUP2res switch (nfsstat3 status) {
917 case NFS3_OK:
918 LOOKUP2resok resok;
919 default:
920 void;
921};
922
923struct READLINK2args {
924 fhandle2 file;
925};
926
927struct READLINK2resok {
928 path2 data;
929};
930
931union READLINK2res switch (nfsstat3 status) {
932 case NFS3_OK:
933 READLINK2resok resok;
934 default:
935 void;
936};
937
938struct READ2args {
939 fhandle2 file;
940 unsigned int offset;
941 unsigned int count;
942 unsigned int totalcount;
943};
944
945struct READ2resok {
946 fattr2 attributes;
947 nfsdata2 data;
948};
949
950union READ2res switch (nfsstat3 status) {
951 case NFS3_OK:
952 READ2resok resok;
953 default:
954 void;
955};
956
957struct WRITE2args {
958 fhandle2 file;
959 unsigned int beginoffset;
960 unsigned int offset;
961 unsigned int totalcount;
962 nfsdata2 data;
963};
964
965struct WRITE2resok {
966 fattr2 attributes;
967};
968
969union WRITE2res switch (nfsstat3 status) {
970 case NFS3_OK:
971 WRITE2resok resok;
972 default:
973 void;
974};
975
976struct CREATE2args {
977 diropargs2 where;
978 sattr2 attributes;
979};
980
981struct CREATE2resok {
982 fhandle2 file;
983 fattr2 attributes;
984};
985
986union CREATE2res switch (nfsstat3 status) {
987 case NFS3_OK:
988 CREATE2resok resok;
989 default:
990 void;
991};
992
993struct REMOVE2args {
994 diropargs2 what;
995};
996
997struct REMOVE2res {
998 nfsstat3 status;
999};
1000
1001struct RENAME2args {
1002 diropargs2 from;
1003 diropargs2 to;
1004};
1005
1006struct RENAME2res {
1007 nfsstat3 status;
1008};
1009
1010struct LINK2args {
1011 fhandle2 from;
1012 diropargs2 to;
1013};
1014
1015struct LINK2res {
1016 nfsstat3 status;
1017};
1018
1019struct SYMLINK2args {
1020 diropargs2 from;
1021 path2 to;
1022 sattr2 attributes;
1023};
1024
1025struct SYMLINK2res {
1026 nfsstat3 status;
1027};
1028
1029struct MKDIR2args {
1030 diropargs2 where;
1031 sattr2 attributes;
1032};
1033
1034struct MKDIR2resok {
1035 fhandle2 file;
1036 fattr2 attributes;
1037};
1038
1039union MKDIR2res switch (nfsstat3 status) {
1040 case NFS3_OK:
1041 MKDIR2resok resok;
1042 default:
1043 void;
1044};
1045
1046struct RMDIR2args {
1047 diropargs2 what;
1048};
1049
1050struct RMDIR2res {
1051 nfsstat3 status;
1052};
1053
1054struct READDIR2args {
1055 fhandle2 dir;
1056 nfscookie2 cookie;
1057 unsigned int count;
1058};
1059
1060struct READDIR2resok {
1061 entry2 *entries;
1062 bool eof;
1063};
1064
1065union READDIR2res switch (nfsstat3 status) {
1066 case NFS3_OK:
1067 READDIR2resok resok;
1068 default:
1069 void;
1070};
1071
1072struct STATFS2args {
1073 fhandle2 dir;
1074};
1075
1076struct STATFS2resok {
1077 unsigned int tsize;
1078 unsigned int bsize;
1079 unsigned int blocks;
1080 unsigned int bfree;
1081 unsigned int bavail;
1082};
1083
1084union STATFS2res switch (nfsstat3 status) {
1085 case NFS3_OK:
1086 STATFS2resok resok;
1087 default:
1088 void;
1089};
1090
84004dbf 1091program NFS_PROGRAM {
f38aacf8
RS
1092 version NFS_V2 {
1093 void
1094 NFS2_NULL(void) = 0;
1095
1096 GETATTR2res
1097 NFS2_GETATTR(GETATTR2args) = 1;
1098
1099 SETATTR2res
1100 NFS2_SETATTR(SETATTR2args) = 2;
1101
1102 LOOKUP2res
1103 NFS2_LOOKUP(LOOKUP2args) = 4;
1104
1105 READLINK2res
1106 NFS2_READLINK(READLINK2args) = 5;
1107
1108 READ2res
1109 NFS2_READ(READ2args) = 6;
1110
1111 WRITE2res
1112 NFS2_WRITE(WRITE2args) = 8;
1113
1114 CREATE2res
1115 NFS2_CREATE(CREATE2args) = 9;
1116
1117 REMOVE2res
1118 NFS2_REMOVE(REMOVE2args) = 10;
1119
1120 RENAME2res
1121 NFS2_RENAME(RENAME2args) = 11;
1122
1123 LINK2res
1124 NFS2_LINK(LINK2args) = 12;
1125
1126 SYMLINK2res
1127 NFS2_SYMLINK(SYMLINK2args) = 13;
1128
1129 MKDIR2res
1130 NFS2_MKDIR(MKDIR2args) = 14;
1131
1132 RMDIR2res
1133 NFS2_RMDIR(RMDIR2args) = 15;
1134
1135 READDIR2res
1136 NFS2_READDIR(READDIR2args) = 16;
1137
1138 STATFS2res
1139 NFS2_STATFS(STATFS2args) = 17;
1140 } = 2;
1141
84004dbf
RS
1142 version NFS_V3 {
1143 void
1144 NFS3_NULL(void) = 0;
1145
1146 GETATTR3res
1147 NFS3_GETATTR(GETATTR3args) = 1;
1148
1149 SETATTR3res
1150 NFS3_SETATTR(SETATTR3args) = 2;
1151
1152 LOOKUP3res
1153 NFS3_LOOKUP(LOOKUP3args) = 3;
1154
1155 ACCESS3res
1156 NFS3_ACCESS(ACCESS3args) = 4;
1157
1158 READLINK3res
1159 NFS3_READLINK(READLINK3args) = 5;
1160
1161 READ3res
1162 NFS3_READ(READ3args) = 6;
1163
1164 WRITE3res
1165 NFS3_WRITE(WRITE3args) = 7;
1166
1167 CREATE3res
1168 NFS3_CREATE(CREATE3args) = 8;
1169
1170 MKDIR3res
1171 NFS3_MKDIR(MKDIR3args) = 9;
1172
1173 SYMLINK3res
1174 NFS3_SYMLINK(SYMLINK3args) = 10;
1175
1ec6b50a
RS
1176 MKNOD3res
1177 NFS3_MKNOD(MKNOD3args) = 11;
84004dbf
RS
1178
1179 REMOVE3res
1180 NFS3_REMOVE(REMOVE3args) = 12;
1181
1182 RMDIR3res
1183 NFS3_RMDIR(RMDIR3args) = 13;
1184
1185 RENAME3res
1186 NFS3_RENAME(RENAME3args) = 14;
1187
1188 LINK3res
1189 NFS3_LINK(LINK3args) = 15;
1190
1191 READDIR3res
1192 NFS3_READDIR(READDIR3args) = 16;
1193
1194 READDIRPLUS3res
1195 NFS3_READDIRPLUS(READDIRPLUS3args) = 17;
1196
1197 FSSTAT3res
1198 NFS3_FSSTAT(FSSTAT3args) = 18;
1199
1200 FSINFO3res
1201 NFS3_FSINFO(FSINFO3args) = 19;
1202
1203 PATHCONF3res
1204 NFS3_PATHCONF(PATHCONF3args) = 20;
1205
1206 COMMIT3res
1207 NFS3_COMMIT(COMMIT3args) = 21;
1208 } = 3;
1209} = 100003;
3847f8f6
RS
1210
1211
1212
1213/* NFS ACL definitions based on wireshark souces and network traces */
1214/* NFSACL interface. Uses same port/process as NFS */
1215
1216enum nfsacl_type {
1217 NFSACL_TYPE_USER_OBJ = 0x0001,
1218 NFSACL_TYPE_USER = 0x0002,
1219 NFSACL_TYPE_GROUP_OBJ = 0x0004,
1220 NFSACL_TYPE_GROUP = 0x0008,
1221 NFSACL_TYPE_CLASS_OBJ = 0x0010,
1222 NFSACL_TYPE_CLASS = 0x0020,
1223 NFSACL_TYPE_DEFAULT = 0x1000,
1224 NFSACL_TYPE_DEFAULT_USER_OBJ = 0x1001,
1225 NFSACL_TYPE_DEFAULT_USER = 0x1002,
1226 NFSACL_TYPE_DEFAULT_GROUP_OBJ = 0x1004,
1227 NFSACL_TYPE_DEFAULT_GROUP = 0x1008,
1228 NFSACL_TYPE_DEFAULT_CLASS_OBJ = 0x1010,
1229 NFSACL_TYPE_DEFAULT_OTHER_OBJ = 0x1020
1230};
1231
1232const NFSACL_PERM_READ = 0x04;
1233const NFSACL_PERM_WRITE = 0x02;
1234const NFSACL_PERM_EXEC = 0x01;
1235
1236struct nfsacl_ace {
1237 enum nfsacl_type type;
c0ebf57b
RS
1238 unsigned int id;
1239 unsigned int perm;
3847f8f6
RS
1240};
1241
1242const NFSACL_MASK_ACL_ENTRY = 0x0001;
1243const NFSACL_MASK_ACL_COUNT = 0x0002;
1244const NFSACL_MASK_ACL_DEFAULT_ENTRY = 0x0004;
1245const NFSACL_MASK_ACL_DEFAULT_COUNT = 0x0008;
1246
1247struct GETACL3args {
c0ebf57b
RS
1248 nfs_fh3 dir;
1249 unsigned int mask;
3847f8f6
RS
1250};
1251
1252struct GETACL3resok {
c0ebf57b
RS
1253 post_op_attr attr;
1254 unsigned int mask;
1255 unsigned int ace_count;
1256 struct nfsacl_ace ace<>;
1257 unsigned int default_ace_count;
1258 struct nfsacl_ace default_ace<>;
3847f8f6
RS
1259};
1260
1261union GETACL3res switch (nfsstat3 status) {
1262case NFS3_OK:
1263 GETACL3resok resok;
1264default:
1265 void;
1266};
1267
fa3c25be 1268struct SETACL3args {
c0ebf57b
RS
1269 nfs_fh3 dir;
1270 unsigned int mask;
1271 unsigned int ace_count;
1272 struct nfsacl_ace ace<>;
1273 unsigned int default_ace_count;
1274 struct nfsacl_ace default_ace<>;
fa3c25be
RS
1275};
1276
1277struct SETACL3resok {
1278 post_op_attr attr;
1279};
1280
1281union SETACL3res switch (nfsstat3 status) {
1282case NFS3_OK:
1283 SETACL3resok resok;
1284default:
1285 void;
1286};
1287
3847f8f6
RS
1288program NFSACL_PROGRAM {
1289 version NFSACL_V3 {
1290 void
1291 NFSACL3_NULL(void) = 0;
1292
1293 GETACL3res
1294 NFSACL3_GETACL(GETACL3args) = 1;
fa3c25be
RS
1295
1296 SETACL3res
1297 NFSACL3_SETACL(SETACL3args) = 2;
3847f8f6
RS
1298 } = 3;
1299} = 100227;