Take maintenance for libnfs
[deb_libnfs.git] / nfs / nfs.x
CommitLineData
dabf4152
AM
1/* NFS part from rfc 1813, NFSACL part is from wireshark sources */
2
ee872606
RRS
3/*
4 * NFS v3 Definitions
5 */
dabf4152
AM
6const NFS3_FHSIZE = 64; /* Maximum bytes in a V3 file handle */
7const NFS3_WRITEVERFSIZE = 8;
8const NFS3_CREATEVERFSIZE = 8;
9const NFS3_COOKIEVERFSIZE = 8;
10
11typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
12
ee872606 13/*unsigned hyper can be overridden by giving rpcgen -DU_INT64_PLATTFORM_TYPE="
dabf4152
AM
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
20typedef U_INT64_PLATTFORM_TYPE uint64;
ee872606 21
dabf4152
AM
22typedef uint64 cookie3;
23
24struct nfs_fh3 {
25 opaque data<NFS3_FHSIZE>;
26};
27
28typedef string filename3<>;
29
30struct diropargs3 {
31 nfs_fh3 dir;
32 filename3 name;
33};
34
35enum ftype3 {
36 NF3REG = 1,
37 NF3DIR = 2,
38 NF3BLK = 3,
39 NF3CHR = 4,
40 NF3LNK = 5,
41 NF3SOCK = 6,
42 NF3FIFO = 7
43};
44
ee872606 45typedef unsigned int mode3;
dabf4152 46
ee872606 47typedef unsigned int uid3;
dabf4152 48
ee872606 49typedef unsigned int gid3;
dabf4152
AM
50
51typedef uint64 size3;
52
53typedef uint64 fileid3;
54
55struct specdata3 {
ee872606
RRS
56 unsigned int specdata1;
57 unsigned int specdata2;
dabf4152
AM
58};
59
60struct nfstime3 {
ee872606
RRS
61 unsigned int seconds;
62 unsigned int nseconds;
dabf4152
AM
63};
64
65struct fattr3 {
ee872606
RRS
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;
dabf4152
AM
79};
80
81union post_op_attr switch (bool attributes_follow) {
82 case TRUE:
83 fattr3 attributes;
84 case FALSE:
85 void;
86};
87
88
89enum 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
121enum stable_how {
122 UNSTABLE = 0,
123 DATA_SYNC = 1,
124 FILE_SYNC = 2
125};
126
127typedef uint64 offset3;
128
ee872606 129typedef unsigned int count3;
dabf4152
AM
130
131struct wcc_attr {
132 size3 size;
133 nfstime3 mtime;
134 nfstime3 ctime;
135};
136
137union pre_op_attr switch (bool attributes_follow) {
138 case TRUE:
139 wcc_attr attributes;
140 case FALSE:
141 void;
142};
143
144struct wcc_data {
145 pre_op_attr before;
146 post_op_attr after;
147};
148
149struct WRITE3args {
150 nfs_fh3 file;
151 offset3 offset;
152 count3 count;
153 stable_how stable;
154 opaque data<>;
155};
156
157typedef opaque writeverf3[NFS3_WRITEVERFSIZE];
158
159struct WRITE3resok {
160 wcc_data file_wcc;
161 count3 count;
162 stable_how committed;
163 writeverf3 verf;
164};
165
166struct WRITE3resfail {
167 wcc_data file_wcc;
168};
169
170union WRITE3res switch (nfsstat3 status) {
171 case NFS3_OK:
172 WRITE3resok resok;
173 default:
174 WRITE3resfail resfail;
175};
176
177struct LOOKUP3args {
178 diropargs3 what;
179};
180
181struct LOOKUP3resok {
182 nfs_fh3 object;
183 post_op_attr obj_attributes;
184 post_op_attr dir_attributes;
185};
186
187struct LOOKUP3resfail {
188 post_op_attr dir_attributes;
189};
190
191
192
193union LOOKUP3res switch (nfsstat3 status) {
194 case NFS3_OK:
195 LOOKUP3resok resok;
196 default:
197 LOOKUP3resfail resfail;
198};
199
200struct COMMIT3args {
201 nfs_fh3 file;
202 offset3 offset;
203 count3 count;
204};
205
206struct COMMIT3resok {
207 wcc_data file_wcc;
208 writeverf3 verf;
209};
210
211struct COMMIT3resfail {
212 wcc_data file_wcc;
213};
214
215union COMMIT3res switch (nfsstat3 status) {
216 case NFS3_OK:
217 COMMIT3resok resok;
218 default:
219 COMMIT3resfail resfail;
220};
221
222const ACCESS3_READ = 0x0001;
223const ACCESS3_LOOKUP = 0x0002;
224const ACCESS3_MODIFY = 0x0004;
225const ACCESS3_EXTEND = 0x0008;
226const ACCESS3_DELETE = 0x0010;
227const ACCESS3_EXECUTE = 0x0020;
228
229struct ACCESS3args {
ee872606
RRS
230 nfs_fh3 object;
231 unsigned int access;
dabf4152
AM
232};
233
234struct ACCESS3resok {
ee872606
RRS
235 post_op_attr obj_attributes;
236 unsigned int access;
dabf4152
AM
237};
238
239struct ACCESS3resfail {
240 post_op_attr obj_attributes;
241};
242
243union ACCESS3res switch (nfsstat3 status) {
244case NFS3_OK:
245 ACCESS3resok resok;
246default:
247 ACCESS3resfail resfail;
248};
249
250struct GETATTR3args {
251 nfs_fh3 object;
252};
253
254struct GETATTR3resok {
255 fattr3 obj_attributes;
256};
257
258union GETATTR3res switch (nfsstat3 status) {
259 case NFS3_OK:
260 GETATTR3resok resok;
261 default:
262 void;
263};
264
265
266
267enum time_how {
268 DONT_CHANGE = 0,
269 SET_TO_SERVER_TIME = 1,
270 SET_TO_CLIENT_TIME = 2
271};
272
273union set_mode3 switch (bool set_it) {
274 case TRUE:
275 mode3 mode;
276 default:
277 void;
278};
279
280union set_uid3 switch (bool set_it) {
281 case TRUE:
282 uid3 uid;
283 default:
284 void;
285};
286
287union set_gid3 switch (bool set_it) {
288 case TRUE:
289 gid3 gid;
290 default:
291 void;
292};
293
294union set_size3 switch (bool set_it) {
295 case TRUE:
296 size3 size;
297 default:
298 void;
299};
300
301union set_atime switch (time_how set_it) {
302 case SET_TO_CLIENT_TIME:
303 nfstime3 atime;
304 default:
305 void;
306};
307
308union set_mtime switch (time_how set_it) {
309 case SET_TO_CLIENT_TIME:
310 nfstime3 mtime;
311 default:
312 void;
313};
314
315struct 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
324enum createmode3 {
325 UNCHECKED = 0,
326 GUARDED = 1,
327 EXCLUSIVE = 2
328};
329
330
331typedef opaque createverf3[NFS3_CREATEVERFSIZE];
332
333union createhow3 switch (createmode3 mode) {
334 case UNCHECKED:
dabf4152 335 sattr3 obj_attributes;
5670ec6e
AM
336 case GUARDED:
337 sattr3 g_obj_attributes;
dabf4152
AM
338 case EXCLUSIVE:
339 createverf3 verf;
340};
341
342struct CREATE3args {
343 diropargs3 where;
344 createhow3 how;
345};
346
347union post_op_fh3 switch (bool handle_follows) {
348 case TRUE:
349 nfs_fh3 handle;
350 case FALSE:
351 void;
352};
353
354struct CREATE3resok {
355 post_op_fh3 obj;
356 post_op_attr obj_attributes;
357 wcc_data dir_wcc;
358};
359
360struct CREATE3resfail {
361 wcc_data dir_wcc;
362 };
363
364union CREATE3res switch (nfsstat3 status) {
365 case NFS3_OK:
366 CREATE3resok resok;
367 default:
368 CREATE3resfail resfail;
369};
370
371struct REMOVE3args {
372 diropargs3 object;
373};
374
375struct REMOVE3resok {
376 wcc_data dir_wcc;
377};
378
379struct REMOVE3resfail {
380 wcc_data dir_wcc;
381};
382
383union REMOVE3res switch (nfsstat3 status) {
384 case NFS3_OK:
385 REMOVE3resok resok;
386 default:
387 REMOVE3resfail resfail;
388};
389
390struct READ3args {
391 nfs_fh3 file;
392 offset3 offset;
393 count3 count;
394};
395
396struct READ3resok {
397 post_op_attr file_attributes;
398 count3 count;
399 bool eof;
400 opaque data<>;
401};
402
403struct READ3resfail {
404 post_op_attr file_attributes;
405};
406
407union READ3res switch (nfsstat3 status) {
408 case NFS3_OK:
409 READ3resok resok;
410 default:
411 READ3resfail resfail;
412};
413
414
415const FSF3_LINK = 0x0001;
416const FSF3_SYMLINK = 0x0002;
417const FSF3_HOMOGENEOUS = 0x0008;
418const FSF3_CANSETTIME = 0x0010;
419
420struct FSINFO3args {
421 nfs_fh3 fsroot;
422};
423
424struct FSINFO3resok {
425 post_op_attr obj_attributes;
ee872606
RRS
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;
dabf4152
AM
433 size3 maxfilesize;
434 nfstime3 time_delta;
ee872606 435 unsigned int properties;
dabf4152
AM
436};
437
438struct FSINFO3resfail {
439 post_op_attr obj_attributes;
440};
441
442union FSINFO3res switch (nfsstat3 status) {
443 case NFS3_OK:
444 FSINFO3resok resok;
445 default:
446 FSINFO3resfail resfail;
447};
448
449
450struct FSSTAT3args {
451 nfs_fh3 fsroot;
452};
453
454struct 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;
ee872606 462 unsigned int invarsec;
dabf4152
AM
463};
464
465struct FSSTAT3resfail {
466 post_op_attr obj_attributes;
467};
468
469union FSSTAT3res switch (nfsstat3 status) {
470 case NFS3_OK:
471 FSSTAT3resok resok;
472 default:
473 FSSTAT3resfail resfail;
474};
475
476struct PATHCONF3args {
477 nfs_fh3 object;
478};
479
480struct PATHCONF3resok {
481 post_op_attr obj_attributes;
ee872606
RRS
482 unsigned int linkmax;
483 unsigned int name_max;
dabf4152
AM
484 bool no_trunc;
485 bool chown_restricted;
486 bool case_insensitive;
487 bool case_preserving;
488};
489
490struct PATHCONF3resfail {
491 post_op_attr obj_attributes;
492};
493
494union PATHCONF3res switch (nfsstat3 status) {
495 case NFS3_OK:
496 PATHCONF3resok resok;
497 default:
498 PATHCONF3resfail resfail;
499};
500
501typedef string nfspath3<>;
502
503struct symlinkdata3 {
504 sattr3 symlink_attributes;
505 nfspath3 symlink_data;
506};
507
508struct SYMLINK3args {
509 diropargs3 where;
510 symlinkdata3 symlink;
511};
512
513struct SYMLINK3resok {
514 post_op_fh3 obj;
515 post_op_attr obj_attributes;
516 wcc_data dir_wcc;
517};
518
519struct SYMLINK3resfail {
520 wcc_data dir_wcc;
521};
522
523union SYMLINK3res switch (nfsstat3 status) {
524 case NFS3_OK:
525 SYMLINK3resok resok;
526 default:
527 SYMLINK3resfail resfail;
528};
529
530
531struct READLINK3args {
532 nfs_fh3 symlink;
533};
534
535struct READLINK3resok {
536 post_op_attr symlink_attributes;
537 nfspath3 data;
538};
539
540struct READLINK3resfail {
541 post_op_attr symlink_attributes;
542};
543
544union READLINK3res switch (nfsstat3 status) {
545 case NFS3_OK:
546 READLINK3resok resok;
547 default:
548 READLINK3resfail resfail;
549};
550
551
552struct devicedata3 {
553 sattr3 dev_attributes;
554 specdata3 spec;
555};
556
557union mknoddata3 switch (ftype3 type) {
558 case NF3CHR:
5670ec6e 559 devicedata3 chr_device;
dabf4152 560 case NF3BLK:
5670ec6e 561 devicedata3 blk_device;
dabf4152 562 case NF3SOCK:
5670ec6e 563 sattr3 sock_attributes;
dabf4152
AM
564 case NF3FIFO:
565 sattr3 pipe_attributes;
566 default:
567 void;
568};
569
570struct MKNOD3args {
571 diropargs3 where;
572 mknoddata3 what;
573};
574
575struct MKNOD3resok {
576 post_op_fh3 obj;
577 post_op_attr obj_attributes;
578 wcc_data dir_wcc;
579};
580
581struct MKNOD3resfail {
582 wcc_data dir_wcc;
583};
584
585union MKNOD3res switch (nfsstat3 status) {
586 case NFS3_OK:
587 MKNOD3resok resok;
588 default:
589 MKNOD3resfail resfail;
590};
591
592
593struct MKDIR3args {
594 diropargs3 where;
595 sattr3 attributes;
596};
597
598struct MKDIR3resok {
599 post_op_fh3 obj;
600 post_op_attr obj_attributes;
601 wcc_data dir_wcc;
602};
603
604struct MKDIR3resfail {
605 wcc_data dir_wcc;
606};
607
608union MKDIR3res switch (nfsstat3 status) {
609 case NFS3_OK:
610 MKDIR3resok resok;
611 default:
612 MKDIR3resfail resfail;
613};
614
615struct RMDIR3args {
616 diropargs3 object;
617};
618
619struct RMDIR3resok {
620 wcc_data dir_wcc;
621};
622
623struct RMDIR3resfail {
624 wcc_data dir_wcc;
625};
626
627union RMDIR3res switch (nfsstat3 status) {
628 case NFS3_OK:
629 RMDIR3resok resok;
630 default:
631 RMDIR3resfail resfail;
632};
633
634struct RENAME3args {
635 diropargs3 from;
636 diropargs3 to;
637};
638
639struct RENAME3resok {
640 wcc_data fromdir_wcc;
641 wcc_data todir_wcc;
642};
643
644struct RENAME3resfail {
645 wcc_data fromdir_wcc;
646 wcc_data todir_wcc;
647};
648
649union RENAME3res switch (nfsstat3 status) {
650 case NFS3_OK:
651 RENAME3resok resok;
652 default:
653 RENAME3resfail resfail;
654};
655
656struct READDIRPLUS3args {
657 nfs_fh3 dir;
658 cookie3 cookie;
659 cookieverf3 cookieverf;
660 count3 dircount;
661 count3 maxcount;
662};
663
664struct 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
673struct dirlistplus3 {
674 entryplus3 *entries;
675 bool eof;
676};
677
678struct READDIRPLUS3resok {
679 post_op_attr dir_attributes;
680 cookieverf3 cookieverf;
681 dirlistplus3 reply;
682};
683
684
685struct READDIRPLUS3resfail {
686 post_op_attr dir_attributes;
687};
688
689union READDIRPLUS3res switch (nfsstat3 status) {
690 case NFS3_OK:
691 READDIRPLUS3resok resok;
692 default:
693 READDIRPLUS3resfail resfail;
694};
695
696struct READDIR3args {
697 nfs_fh3 dir;
698 cookie3 cookie;
699 cookieverf3 cookieverf;
700 count3 count;
701};
702
703
704struct entry3 {
705 fileid3 fileid;
706 filename3 name;
707 cookie3 cookie;
708 entry3 *nextentry;
709};
710
711struct dirlist3 {
712 entry3 *entries;
713 bool eof;
714};
715
716struct READDIR3resok {
717 post_op_attr dir_attributes;
718 cookieverf3 cookieverf;
719 dirlist3 reply;
720};
721
722struct READDIR3resfail {
723 post_op_attr dir_attributes;
724};
725
726union READDIR3res switch (nfsstat3 status) {
727 case NFS3_OK:
728 READDIR3resok resok;
729 default:
730 READDIR3resfail resfail;
731};
732
733struct LINK3args {
734 nfs_fh3 file;
735 diropargs3 link;
736};
737
738struct LINK3resok {
739 post_op_attr file_attributes;
740 wcc_data linkdir_wcc;
741};
742
743struct LINK3resfail {
744 post_op_attr file_attributes;
745 wcc_data linkdir_wcc;
746};
747
748union LINK3res switch (nfsstat3 status) {
749 case NFS3_OK:
750 LINK3resok resok;
751 default:
752 LINK3resfail resfail;
753};
754
755union sattrguard3 switch (bool check) {
756 case TRUE:
757 nfstime3 obj_ctime;
758 case FALSE:
759 void;
760};
761
762struct SETATTR3args {
763 nfs_fh3 object;
764 sattr3 new_attributes;
765 sattrguard3 guard;
766};
767
768struct SETATTR3resok {
769 wcc_data obj_wcc;
770};
771
772struct SETATTR3resfail {
773 wcc_data obj_wcc;
774};
775
776union SETATTR3res switch (nfsstat3 status) {
777 case NFS3_OK:
778 SETATTR3resok resok;
779 default:
780 SETATTR3resfail resfail;
781};
782
ee872606
RRS
783/*
784 * NFS v2 Definitions
785 * We share many definitions from v3
786 */
787const FHSIZE2 = 32;
788typedef opaque fhandle2[FHSIZE2];
789
790enum ftype2 {
791 NF2NON = 0,
792 NF2REG = 1,
793 NF2DIR = 2,
794 NF2BLK = 3,
795 NF2CHR = 4,
796 NF2LNK = 5
797};
798
799struct 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
816struct 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
825const MAXNAMLEN2 = 255;
826typedef string filename2<MAXNAMLEN2>;
827
828const MAXPATHLEN2 = 1024;
829typedef string path2<MAXPATHLEN2>;
830
831const NFSMAXDATA2 = 8192;
832typedef opaque nfsdata2<NFSMAXDATA2>;
833
834const NFSCOOKIESIZE2 = 4;
835typedef opaque nfscookie2[NFSCOOKIESIZE2];
836
837struct entry2 {
838 unsigned int fileid;
839 filename2 name;
840 nfscookie2 cookie;
841 entry2 *nextentry;
842};
843
844struct diropargs2 {
845 fhandle2 dir;
846 filename2 name;
847};
848
849struct GETATTR2args {
850 fhandle2 fhandle;
851};
852
853struct GETATTR2resok {
854 fattr2 attributes;
855};
856
857union GETATTR2res switch (nfsstat3 status) {
858 case NFS3_OK:
859 GETATTR2resok resok;
860 default:
861 void;
862};
863
864struct SETATTR2args {
865 fhandle2 fhandle;
866 sattr2 attributes;
867};
868
869struct SETATTR2resok {
870 fattr2 attributes;
871};
872
873union SETATTR2res switch (nfsstat3 status) {
874 case NFS3_OK:
875 SETATTR2resok resok;
876 default:
877 void;
878};
879
880struct LOOKUP2args {
881 diropargs2 what;
882};
883
884struct LOOKUP2resok {
885 fhandle2 file;
886 fattr2 attributes;
887};
888
889union LOOKUP2res switch (nfsstat3 status) {
890 case NFS3_OK:
891 LOOKUP2resok resok;
892 default:
893 void;
894};
895
896struct READLINK2args {
897 fhandle2 file;
898};
899
900struct READLINK2resok {
901 path2 data;
902};
903
904union READLINK2res switch (nfsstat3 status) {
905 case NFS3_OK:
906 READLINK2resok resok;
907 default:
908 void;
909};
910
911struct READ2args {
912 fhandle2 file;
913 unsigned int offset;
914 unsigned int count;
915 unsigned int totalcount;
916};
917
918struct READ2resok {
919 fattr2 attributes;
920 nfsdata2 data;
921};
922
923union READ2res switch (nfsstat3 status) {
924 case NFS3_OK:
925 READ2resok resok;
926 default:
927 void;
928};
929
930struct WRITE2args {
931 fhandle2 file;
932 unsigned int beginoffset;
933 unsigned int offset;
934 unsigned int totalcount;
935 nfsdata2 data;
936};
937
938struct WRITE2resok {
939 fattr2 attributes;
940};
941
942union WRITE2res switch (nfsstat3 status) {
943 case NFS3_OK:
944 WRITE2resok resok;
945 default:
946 void;
947};
948
949struct CREATE2args {
950 diropargs2 where;
951 sattr2 attributes;
952};
953
954struct CREATE2resok {
955 fhandle2 file;
956 fattr2 attributes;
957};
958
959union CREATE2res switch (nfsstat3 status) {
960 case NFS3_OK:
961 CREATE2resok resok;
962 default:
963 void;
964};
965
966struct REMOVE2args {
967 diropargs2 what;
968};
969
970struct REMOVE2res {
971 nfsstat3 status;
972};
973
974struct RENAME2args {
975 diropargs2 from;
976 diropargs2 to;
977};
978
979struct RENAME2res {
980 nfsstat3 status;
981};
982
983struct LINK2args {
984 fhandle2 from;
985 diropargs2 to;
986};
987
988struct LINK2res {
989 nfsstat3 status;
990};
991
992struct SYMLINK2args {
993 diropargs2 from;
994 path2 to;
995 sattr2 attributes;
996};
997
998struct SYMLINK2res {
999 nfsstat3 status;
1000};
1001
1002struct MKDIR2args {
1003 diropargs2 where;
1004 sattr2 attributes;
1005};
1006
1007struct MKDIR2resok {
1008 fhandle2 file;
1009 fattr2 attributes;
1010};
1011
1012union MKDIR2res switch (nfsstat3 status) {
1013 case NFS3_OK:
1014 MKDIR2resok resok;
1015 default:
1016 void;
1017};
1018
1019struct RMDIR2args {
1020 diropargs2 what;
1021};
1022
1023struct RMDIR2res {
1024 nfsstat3 status;
1025};
1026
1027struct READDIR2args {
1028 fhandle2 dir;
1029 nfscookie2 cookie;
1030 unsigned int count;
1031};
1032
1033struct READDIR2resok {
1034 entry2 *entries;
1035 bool eof;
1036};
1037
1038union READDIR2res switch (nfsstat3 status) {
1039 case NFS3_OK:
1040 READDIR2resok resok;
1041 default:
1042 void;
1043};
1044
1045struct STATFS2args {
1046 fhandle2 dir;
1047};
1048
1049struct STATFS2resok {
1050 unsigned int tsize;
1051 unsigned int bsize;
1052 unsigned int blocks;
1053 unsigned int bfree;
1054 unsigned int bavail;
1055};
1056
1057union STATFS2res switch (nfsstat3 status) {
1058 case NFS3_OK:
1059 STATFS2resok resok;
1060 default:
1061 void;
1062};
1063
dabf4152 1064program NFS_PROGRAM {
ee872606
RRS
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
dabf4152
AM
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
5670ec6e
AM
1149 MKNOD3res
1150 NFS3_MKNOD(MKNOD3args) = 11;
dabf4152
AM
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
1189enum 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
1205const NFSACL_PERM_READ = 0x04;
1206const NFSACL_PERM_WRITE = 0x02;
1207const NFSACL_PERM_EXEC = 0x01;
1208
1209struct nfsacl_ace {
1210 enum nfsacl_type type;
ee872606
RRS
1211 unsigned int id;
1212 unsigned int perm;
dabf4152
AM
1213};
1214
1215const NFSACL_MASK_ACL_ENTRY = 0x0001;
1216const NFSACL_MASK_ACL_COUNT = 0x0002;
1217const NFSACL_MASK_ACL_DEFAULT_ENTRY = 0x0004;
1218const NFSACL_MASK_ACL_DEFAULT_COUNT = 0x0008;
1219
1220struct GETACL3args {
ee872606
RRS
1221 nfs_fh3 dir;
1222 unsigned int mask;
dabf4152
AM
1223};
1224
1225struct GETACL3resok {
ee872606
RRS
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<>;
dabf4152
AM
1232};
1233
1234union GETACL3res switch (nfsstat3 status) {
1235case NFS3_OK:
1236 GETACL3resok resok;
1237default:
1238 void;
1239};
1240
ee872606
RRS
1241struct 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
1250struct SETACL3resok {
1251 post_op_attr attr;
1252};
1253
1254union SETACL3res switch (nfsstat3 status) {
1255case NFS3_OK:
1256 SETACL3resok resok;
1257default:
1258 void;
1259};
1260
dabf4152
AM
1261program NFSACL_PROGRAM {
1262 version NFSACL_V3 {
1263 void
1264 NFSACL3_NULL(void) = 0;
1265
1266 GETACL3res
1267 NFSACL3_GETACL(GETACL3args) = 1;
ee872606
RRS
1268
1269 SETACL3res
1270 NFSACL3_SETACL(SETACL3args) = 2;
dabf4152
AM
1271 } = 3;
1272} = 100227;