initial libnfs checkin
[deb_libnfs.git] / nfs / nfs.x
CommitLineData
84004dbf
RS
1/* copied from rfc 1813 */
2
3const NFS3_FHSIZE = 64; /* Maximum bytes in a V3 file handle */
4const NFS3_WRITEVERFSIZE = 8;
5const NFS3_CREATEVERFSIZE = 8;
6const NFS3_COOKIEVERFSIZE = 8;
7
8typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
9
10typedef unsigned hyper uint64;
11typedef uint64 cookie3;
12
13struct nfs_fh3 {
14 opaque data<NFS3_FHSIZE>;
15};
16
17typedef string filename3<>;
18
19struct diropargs3 {
20 nfs_fh3 dir;
21 filename3 name;
22};
23
24enum ftype3 {
25 NF3REG = 1,
26 NF3DIR = 2,
27 NF3BLK = 3,
28 NF3CHR = 4,
29 NF3LNK = 5,
30 NF3SOCK = 6,
31 NF3FIFO = 7
32};
33
34typedef unsigned long uint32;
35
36typedef long int32;
37
38typedef uint32 mode3;
39
40typedef uint32 uid3;
41
42typedef uint32 gid3;
43
44typedef uint64 size3;
45
46typedef uint64 fileid3;
47
48struct specdata3 {
49 uint32 specdata1;
50 uint32 specdata2;
51};
52
53struct nfstime3 {
54 uint32 seconds;
55 uint32 nseconds;
56};
57
58struct fattr3 {
59 ftype3 type;
60 mode3 mode;
61 uint32 nlink;
62 uid3 uid;
63 gid3 gid;
64 size3 size;
65 size3 used;
66 specdata3 rdev;
67 uint64 fsid;
68 fileid3 fileid;
69 nfstime3 atime;
70 nfstime3 mtime;
71 nfstime3 ctime;
72};
73
74union post_op_attr switch (bool attributes_follow) {
75 case TRUE:
76 fattr3 attributes;
77 case FALSE:
78 void;
79};
80
81
82enum nfsstat3 {
83 NFS3_OK = 0,
84 NFS3ERR_PERM = 1,
85 NFS3ERR_NOENT = 2,
86 NFS3ERR_IO = 5,
87 NFS3ERR_NXIO = 6,
88 NFS3ERR_ACCES = 13,
89 NFS3ERR_EXIST = 17,
90 NFS3ERR_XDEV = 18,
91 NFS3ERR_NODEV = 19,
92 NFS3ERR_NOTDIR = 20,
93 NFS3ERR_ISDIR = 21,
94 NFS3ERR_INVAL = 22,
95 NFS3ERR_FBIG = 27,
96 NFS3ERR_NOSPC = 28,
97 NFS3ERR_ROFS = 30,
98 NFS3ERR_MLINK = 31,
99 NFS3ERR_NAMETOOLONG = 63,
100 NFS3ERR_NOTEMPTY = 66,
101 NFS3ERR_DQUOT = 69,
102 NFS3ERR_STALE = 70,
103 NFS3ERR_REMOTE = 71,
104 NFS3ERR_BADHANDLE = 10001,
105 NFS3ERR_NOT_SYNC = 10002,
106 NFS3ERR_BAD_COOKIE = 10003,
107 NFS3ERR_NOTSUPP = 10004,
108 NFS3ERR_TOOSMALL = 10005,
109 NFS3ERR_SERVERFAULT = 10006,
110 NFS3ERR_BADTYPE = 10007,
111 NFS3ERR_JUKEBOX = 10008
112};
113
114enum stable_how {
115 UNSTABLE = 0,
116 DATA_SYNC = 1,
117 FILE_SYNC = 2
118};
119
120typedef uint64 offset3;
121
122typedef uint32 count3;
123
124struct wcc_attr {
125 size3 size;
126 nfstime3 mtime;
127 nfstime3 ctime;
128};
129
130union pre_op_attr switch (bool attributes_follow) {
131 case TRUE:
132 wcc_attr attributes;
133 case FALSE:
134 void;
135};
136
137struct wcc_data {
138 pre_op_attr before;
139 post_op_attr after;
140};
141
142struct WRITE3args {
143 nfs_fh3 file;
144 offset3 offset;
145 count3 count;
146 stable_how stable;
147 opaque data<>;
148};
149
150typedef opaque writeverf3[NFS3_WRITEVERFSIZE];
151
152struct WRITE3resok {
153 wcc_data file_wcc;
154 count3 count;
155 stable_how committed;
156 writeverf3 verf;
157};
158
159struct WRITE3resfail {
160 wcc_data file_wcc;
161};
162
163union WRITE3res switch (nfsstat3 status) {
164 case NFS3_OK:
165 WRITE3resok resok;
166 default:
167 WRITE3resfail resfail;
168};
169
170struct LOOKUP3args {
171 diropargs3 what;
172};
173
174struct LOOKUP3resok {
175 nfs_fh3 object;
176 post_op_attr obj_attributes;
177 post_op_attr dir_attributes;
178};
179
180struct LOOKUP3resfail {
181 post_op_attr dir_attributes;
182};
183
184
185
186union LOOKUP3res switch (nfsstat3 status) {
187 case NFS3_OK:
188 LOOKUP3resok resok;
189 default:
190 LOOKUP3resfail resfail;
191};
192
193struct COMMIT3args {
194 nfs_fh3 file;
195 offset3 offset;
196 count3 count;
197};
198
199struct COMMIT3resok {
200 wcc_data file_wcc;
201 writeverf3 verf;
202};
203
204struct COMMIT3resfail {
205 wcc_data file_wcc;
206};
207
208union COMMIT3res switch (nfsstat3 status) {
209 case NFS3_OK:
210 COMMIT3resok resok;
211 default:
212 COMMIT3resfail resfail;
213};
214
215const ACCESS3_READ = 0x0001;
216const ACCESS3_LOOKUP = 0x0002;
217const ACCESS3_MODIFY = 0x0004;
218const ACCESS3_EXTEND = 0x0008;
219const ACCESS3_DELETE = 0x0010;
220const ACCESS3_EXECUTE = 0x0020;
221
222struct ACCESS3args {
223 nfs_fh3 object;
224 uint32 access;
225};
226
227struct ACCESS3resok {
228 post_op_attr obj_attributes;
229 uint32 access;
230};
231
232struct ACCESS3resfail {
233 post_op_attr obj_attributes;
234};
235
236union ACCESS3res switch (nfsstat3 status) {
237case NFS3_OK:
238 ACCESS3resok resok;
239default:
240 ACCESS3resfail resfail;
241};
242
243struct GETATTR3args {
244 nfs_fh3 object;
245};
246
247struct GETATTR3resok {
248 fattr3 obj_attributes;
249};
250
251union GETATTR3res switch (nfsstat3 status) {
252 case NFS3_OK:
253 GETATTR3resok resok;
254 default:
255 void;
256};
257
258
259
260enum time_how {
261 DONT_CHANGE = 0,
262 SET_TO_SERVER_TIME = 1,
263 SET_TO_CLIENT_TIME = 2
264};
265
266union set_mode3 switch (bool set_it) {
267 case TRUE:
268 mode3 mode;
269 default:
270 void;
271};
272
273union set_uid3 switch (bool set_it) {
274 case TRUE:
275 uid3 uid;
276 default:
277 void;
278};
279
280union set_gid3 switch (bool set_it) {
281 case TRUE:
282 gid3 gid;
283 default:
284 void;
285};
286
287union set_size3 switch (bool set_it) {
288 case TRUE:
289 size3 size;
290 default:
291 void;
292};
293
294union set_atime switch (time_how set_it) {
295 case SET_TO_CLIENT_TIME:
296 nfstime3 atime;
297 default:
298 void;
299};
300
301union set_mtime switch (time_how set_it) {
302 case SET_TO_CLIENT_TIME:
303 nfstime3 mtime;
304 default:
305 void;
306};
307
308struct sattr3 {
309 set_mode3 mode;
310 set_uid3 uid;
311 set_gid3 gid;
312 set_size3 size;
313 set_atime atime;
314 set_mtime mtime;
315};
316
317enum createmode3 {
318 UNCHECKED = 0,
319 GUARDED = 1,
320 EXCLUSIVE = 2
321};
322
323
324typedef opaque createverf3[NFS3_CREATEVERFSIZE];
325
326union createhow3 switch (createmode3 mode) {
327 case UNCHECKED:
328 case GUARDED:
329 sattr3 obj_attributes;
330 case EXCLUSIVE:
331 createverf3 verf;
332};
333
334struct CREATE3args {
335 diropargs3 where;
336 createhow3 how;
337};
338
339union post_op_fh3 switch (bool handle_follows) {
340 case TRUE:
341 nfs_fh3 handle;
342 case FALSE:
343 void;
344};
345
346struct CREATE3resok {
347 post_op_fh3 obj;
348 post_op_attr obj_attributes;
349 wcc_data dir_wcc;
350};
351
352struct CREATE3resfail {
353 wcc_data dir_wcc;
354 };
355
356union CREATE3res switch (nfsstat3 status) {
357 case NFS3_OK:
358 CREATE3resok resok;
359 default:
360 CREATE3resfail resfail;
361};
362
363struct REMOVE3args {
364 diropargs3 object;
365};
366
367struct REMOVE3resok {
368 wcc_data dir_wcc;
369};
370
371struct REMOVE3resfail {
372 wcc_data dir_wcc;
373};
374
375union REMOVE3res switch (nfsstat3 status) {
376 case NFS3_OK:
377 REMOVE3resok resok;
378 default:
379 REMOVE3resfail resfail;
380};
381
382struct READ3args {
383 nfs_fh3 file;
384 offset3 offset;
385 count3 count;
386};
387
388struct READ3resok {
389 post_op_attr file_attributes;
390 count3 count;
391 bool eof;
392 opaque data<>;
393};
394
395struct READ3resfail {
396 post_op_attr file_attributes;
397};
398
399union READ3res switch (nfsstat3 status) {
400 case NFS3_OK:
401 READ3resok resok;
402 default:
403 READ3resfail resfail;
404};
405
406
407const FSF3_LINK = 0x0001;
408const FSF3_SYMLINK = 0x0002;
409const FSF3_HOMOGENEOUS = 0x0008;
410const FSF3_CANSETTIME = 0x0010;
411
412struct FSINFO3args {
413 nfs_fh3 fsroot;
414};
415
416struct FSINFO3resok {
417 post_op_attr obj_attributes;
418 uint32 rtmax;
419 uint32 rtpref;
420 uint32 rtmult;
421 uint32 wtmax;
422 uint32 wtpref;
423 uint32 wtmult;
424 uint32 dtpref;
425 size3 maxfilesize;
426 nfstime3 time_delta;
427 uint32 properties;
428};
429
430struct FSINFO3resfail {
431 post_op_attr obj_attributes;
432};
433
434union FSINFO3res switch (nfsstat3 status) {
435 case NFS3_OK:
436 FSINFO3resok resok;
437 default:
438 FSINFO3resfail resfail;
439};
440
441
442struct FSSTAT3args {
443 nfs_fh3 fsroot;
444};
445
446struct FSSTAT3resok {
447 post_op_attr obj_attributes;
448 size3 tbytes;
449 size3 fbytes;
450 size3 abytes;
451 size3 tfiles;
452 size3 ffiles;
453 size3 afiles;
454 uint32 invarsec;
455};
456
457struct FSSTAT3resfail {
458 post_op_attr obj_attributes;
459};
460
461union FSSTAT3res switch (nfsstat3 status) {
462 case NFS3_OK:
463 FSSTAT3resok resok;
464 default:
465 FSSTAT3resfail resfail;
466};
467
468struct PATHCONF3args {
469 nfs_fh3 object;
470};
471
472struct PATHCONF3resok {
473 post_op_attr obj_attributes;
474 uint32 linkmax;
475 uint32 name_max;
476 bool no_trunc;
477 bool chown_restricted;
478 bool case_insensitive;
479 bool case_preserving;
480};
481
482struct PATHCONF3resfail {
483 post_op_attr obj_attributes;
484};
485
486union PATHCONF3res switch (nfsstat3 status) {
487 case NFS3_OK:
488 PATHCONF3resok resok;
489 default:
490 PATHCONF3resfail resfail;
491};
492
493typedef string nfspath3<>;
494
495struct symlinkdata3 {
496 sattr3 symlink_attributes;
497 nfspath3 symlink_data;
498};
499
500struct SYMLINK3args {
501 diropargs3 where;
502 symlinkdata3 symlink;
503};
504
505struct SYMLINK3resok {
506 post_op_fh3 obj;
507 post_op_attr obj_attributes;
508 wcc_data dir_wcc;
509};
510
511struct SYMLINK3resfail {
512 wcc_data dir_wcc;
513};
514
515union SYMLINK3res switch (nfsstat3 status) {
516 case NFS3_OK:
517 SYMLINK3resok resok;
518 default:
519 SYMLINK3resfail resfail;
520};
521
522
523struct READLINK3args {
524 nfs_fh3 symlink;
525};
526
527struct READLINK3resok {
528 post_op_attr symlink_attributes;
529 nfspath3 data;
530};
531
532struct READLINK3resfail {
533 post_op_attr symlink_attributes;
534};
535
536union READLINK3res switch (nfsstat3 status) {
537 case NFS3_OK:
538 READLINK3resok resok;
539 default:
540 READLINK3resfail resfail;
541};
542
543
544struct devicedata3 {
545 sattr3 dev_attributes;
546 specdata3 spec;
547};
548
549union mknoddata3 switch (ftype3 type) {
550 case NF3CHR:
551 case NF3BLK:
552 devicedata3 device;
553 case NF3SOCK:
554 case NF3FIFO:
555 sattr3 pipe_attributes;
556 default:
557 void;
558};
559
560struct MKNOD3args {
561 diropargs3 where;
562 mknoddata3 what;
563};
564
565struct MKNOD3resok {
566 post_op_fh3 obj;
567 post_op_attr obj_attributes;
568 wcc_data dir_wcc;
569};
570
571struct MKNOD3resfail {
572 wcc_data dir_wcc;
573};
574
575union MKNOD3res switch (nfsstat3 status) {
576 case NFS3_OK:
577 MKNOD3resok resok;
578 default:
579 MKNOD3resfail resfail;
580};
581
582
583struct MKDIR3args {
584 diropargs3 where;
585 sattr3 attributes;
586};
587
588struct MKDIR3resok {
589 post_op_fh3 obj;
590 post_op_attr obj_attributes;
591 wcc_data dir_wcc;
592};
593
594struct MKDIR3resfail {
595 wcc_data dir_wcc;
596};
597
598union MKDIR3res switch (nfsstat3 status) {
599 case NFS3_OK:
600 MKDIR3resok resok;
601 default:
602 MKDIR3resfail resfail;
603};
604
605struct RMDIR3args {
606 diropargs3 object;
607};
608
609struct RMDIR3resok {
610 wcc_data dir_wcc;
611};
612
613struct RMDIR3resfail {
614 wcc_data dir_wcc;
615};
616
617union RMDIR3res switch (nfsstat3 status) {
618 case NFS3_OK:
619 RMDIR3resok resok;
620 default:
621 RMDIR3resfail resfail;
622};
623
624struct RENAME3args {
625 diropargs3 from;
626 diropargs3 to;
627};
628
629struct RENAME3resok {
630 wcc_data fromdir_wcc;
631 wcc_data todir_wcc;
632};
633
634struct RENAME3resfail {
635 wcc_data fromdir_wcc;
636 wcc_data todir_wcc;
637};
638
639union RENAME3res switch (nfsstat3 status) {
640 case NFS3_OK:
641 RENAME3resok resok;
642 default:
643 RENAME3resfail resfail;
644};
645
646struct READDIRPLUS3args {
647 nfs_fh3 dir;
648 cookie3 cookie;
649 cookieverf3 cookieverf;
650 count3 dircount;
651 count3 maxcount;
652};
653
654struct entryplus3 {
655 fileid3 fileid;
656 filename3 name;
657 cookie3 cookie;
658 post_op_attr name_attributes;
659 post_op_fh3 name_handle;
660 entryplus3 *nextentry;
661};
662
663struct dirlistplus3 {
664 entryplus3 *entries;
665 bool eof;
666};
667
668struct READDIRPLUS3resok {
669 post_op_attr dir_attributes;
670 cookieverf3 cookieverf;
671 dirlistplus3 reply;
672};
673
674
675struct READDIRPLUS3resfail {
676 post_op_attr dir_attributes;
677};
678
679union READDIRPLUS3res switch (nfsstat3 status) {
680 case NFS3_OK:
681 READDIRPLUS3resok resok;
682 default:
683 READDIRPLUS3resfail resfail;
684};
685
686struct READDIR3args {
687 nfs_fh3 dir;
688 cookie3 cookie;
689 cookieverf3 cookieverf;
690 count3 count;
691};
692
693
694struct entry3 {
695 fileid3 fileid;
696 filename3 name;
697 cookie3 cookie;
698 entry3 *nextentry;
699};
700
701struct dirlist3 {
702 entry3 *entries;
703 bool eof;
704};
705
706struct READDIR3resok {
707 post_op_attr dir_attributes;
708 cookieverf3 cookieverf;
709 dirlist3 reply;
710};
711
712struct READDIR3resfail {
713 post_op_attr dir_attributes;
714};
715
716union READDIR3res switch (nfsstat3 status) {
717 case NFS3_OK:
718 READDIR3resok resok;
719 default:
720 READDIR3resfail resfail;
721};
722
723struct LINK3args {
724 nfs_fh3 file;
725 diropargs3 link;
726};
727
728struct LINK3resok {
729 post_op_attr file_attributes;
730 wcc_data linkdir_wcc;
731};
732
733struct LINK3resfail {
734 post_op_attr file_attributes;
735 wcc_data linkdir_wcc;
736};
737
738union LINK3res switch (nfsstat3 status) {
739 case NFS3_OK:
740 LINK3resok resok;
741 default:
742 LINK3resfail resfail;
743};
744
745union sattrguard3 switch (bool check) {
746 case TRUE:
747 nfstime3 obj_ctime;
748 case FALSE:
749 void;
750};
751
752struct SETATTR3args {
753 nfs_fh3 object;
754 sattr3 new_attributes;
755 sattrguard3 guard;
756};
757
758struct SETATTR3resok {
759 wcc_data obj_wcc;
760};
761
762struct SETATTR3resfail {
763 wcc_data obj_wcc;
764};
765
766union SETATTR3res switch (nfsstat3 status) {
767 case NFS3_OK:
768 SETATTR3resok resok;
769 default:
770 SETATTR3resfail resfail;
771};
772
773program NFS_PROGRAM {
774 version NFS_V3 {
775 void
776 NFS3_NULL(void) = 0;
777
778 GETATTR3res
779 NFS3_GETATTR(GETATTR3args) = 1;
780
781 SETATTR3res
782 NFS3_SETATTR(SETATTR3args) = 2;
783
784 LOOKUP3res
785 NFS3_LOOKUP(LOOKUP3args) = 3;
786
787 ACCESS3res
788 NFS3_ACCESS(ACCESS3args) = 4;
789
790 READLINK3res
791 NFS3_READLINK(READLINK3args) = 5;
792
793 READ3res
794 NFS3_READ(READ3args) = 6;
795
796 WRITE3res
797 NFS3_WRITE(WRITE3args) = 7;
798
799 CREATE3res
800 NFS3_CREATE(CREATE3args) = 8;
801
802 MKDIR3res
803 NFS3_MKDIR(MKDIR3args) = 9;
804
805 SYMLINK3res
806 NFS3_SYMLINK(SYMLINK3args) = 10;
807
808/* MKNOD3res NFSPROC3_MKNOD(MKNOD3args) = 11;*/
809
810 REMOVE3res
811 NFS3_REMOVE(REMOVE3args) = 12;
812
813 RMDIR3res
814 NFS3_RMDIR(RMDIR3args) = 13;
815
816 RENAME3res
817 NFS3_RENAME(RENAME3args) = 14;
818
819 LINK3res
820 NFS3_LINK(LINK3args) = 15;
821
822 READDIR3res
823 NFS3_READDIR(READDIR3args) = 16;
824
825 READDIRPLUS3res
826 NFS3_READDIRPLUS(READDIRPLUS3args) = 17;
827
828 FSSTAT3res
829 NFS3_FSSTAT(FSSTAT3args) = 18;
830
831 FSINFO3res
832 NFS3_FSINFO(FSINFO3args) = 19;
833
834 PATHCONF3res
835 NFS3_PATHCONF(PATHCONF3args) = 20;
836
837 COMMIT3res
838 NFS3_COMMIT(COMMIT3args) = 21;
839 } = 3;
840} = 100003;