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