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