Add an updated Azure run
[bluesky.git] / nfs3 / nfs3_prot.x
1 /* $Id: nfs3_prot.x,v 1.17 2002/10/11 19:13:00 kaminsky Exp $ */
2
3 typedef unsigned hyper uint64;
4 typedef hyper int64;
5 typedef unsigned int uint32;
6 typedef int int32;
7
8 const NFS3_FHSIZE = 64;
9 const NFS3_COOKIEVERFSIZE = 8;
10 const NFS3_CREATEVERFSIZE = 8;
11 const NFS3_WRITEVERFSIZE = 8;
12
13 typedef string filename3<>;
14 typedef string nfspath3<>;
15 typedef opaque cookieverf3[NFS3_COOKIEVERFSIZE];
16 typedef opaque createverf3[NFS3_CREATEVERFSIZE];
17 typedef opaque writeverf3[NFS3_WRITEVERFSIZE];
18
19 enum nfsstat3 {
20     NFS3_OK = 0,
21     NFS3ERR_PERM = 1,
22     NFS3ERR_NOENT = 2,
23     NFS3ERR_IO = 5,
24     NFS3ERR_NXIO = 6,
25     NFS3ERR_ACCES = 13,
26     NFS3ERR_EXIST = 17,
27     NFS3ERR_XDEV = 18,
28     NFS3ERR_NODEV = 19,
29     NFS3ERR_NOTDIR = 20,
30     NFS3ERR_ISDIR = 21,
31     NFS3ERR_INVAL = 22,
32     NFS3ERR_FBIG = 27,
33     NFS3ERR_NOSPC = 28,
34     NFS3ERR_ROFS = 30,
35     NFS3ERR_MLINK = 31,
36     NFS3ERR_NAMETOOLONG = 63,
37     NFS3ERR_NOTEMPTY = 66,
38     NFS3ERR_DQUOT = 69,
39     NFS3ERR_STALE = 70,
40     NFS3ERR_REMOTE = 71,
41     NFS3ERR_BADHANDLE = 10001,
42     NFS3ERR_NOT_SYNC = 10002,
43     NFS3ERR_BAD_COOKIE = 10003,
44     NFS3ERR_NOTSUPP = 10004,
45     NFS3ERR_TOOSMALL = 10005,
46     NFS3ERR_SERVERFAULT = 10006,
47     NFS3ERR_BADTYPE = 10007,
48     NFS3ERR_JUKEBOX = 10008,
49     NFS3ERR_FPRINTNOTFOUND = 10009,
50     NFS3ERR_ABORTED = 10010
51 };
52
53 enum ftype3 {
54     NF3REG = 1,
55     NF3DIR = 2,
56     NF3BLK = 3,
57     NF3CHR = 4,
58     NF3LNK = 5,
59     NF3SOCK = 6,
60     NF3FIFO = 7
61 };
62
63 struct specdata3 {
64     uint32 major;
65     uint32 minor;
66 };
67
68 struct nfs_fh3 {
69     opaque data<NFS3_FHSIZE>;
70 };
71
72 struct nfstime3 {
73     uint32 seconds;
74     uint32 nseconds;
75 };
76
77 struct fattr3 {
78     ftype3 type;
79     uint32 mode;
80     uint32 nlink;
81     uint32 uid;
82     uint32 gid;
83     uint64 size;
84     uint64 used;
85     specdata3 rdev;
86     uint64 fsid;
87     uint64 fileid;
88     nfstime3 atime;
89     nfstime3 mtime;
90     nfstime3 ctime;
91 };
92
93 union post_op_attr switch (bool present) {
94 case TRUE:
95     fattr3 attributes;
96 case FALSE:
97     void;
98 };
99
100 struct wcc_attr {
101     uint64 size;
102     nfstime3 mtime;
103     nfstime3 ctime;
104 };
105
106 union pre_op_attr switch (bool present) {
107 case TRUE:
108     wcc_attr attributes;
109 case FALSE:
110     void;
111 };
112
113 struct wcc_data {
114     pre_op_attr before;
115     post_op_attr after;
116 };
117
118 union post_op_fh3 switch (bool present) {
119 case TRUE:
120     nfs_fh3 handle;
121 case FALSE:
122     void;
123 };
124
125 union set_uint32 switch (bool set) {
126 case TRUE:
127     uint32 val;
128 default:
129     void;
130 };
131
132 union set_uint64 switch (bool set) {
133 case TRUE:
134     uint64 val;
135 default:
136     void;
137 };
138
139 enum time_how {
140     DONT_CHANGE = 0,
141     SET_TO_SERVER_TIME = 1,
142     SET_TO_CLIENT_TIME = 2
143 };
144
145 union set_time switch (time_how set) {
146 case SET_TO_CLIENT_TIME:
147     nfstime3 time;
148 default:
149     void;
150 };
151
152 struct sattr3 {
153     set_uint32 mode;
154     set_uint32 uid;
155     set_uint32 gid;
156     set_uint64 size;
157     set_time atime;
158     set_time mtime;
159 };
160
161 struct diropargs3 {
162     nfs_fh3 dir;
163     filename3 name;
164 };
165
166 struct diropres3ok {
167     post_op_fh3 obj;
168     post_op_attr obj_attributes;
169     wcc_data dir_wcc;
170 };
171
172 union diropres3 switch (nfsstat3 status) {
173 case NFS3_OK:
174     diropres3ok resok;
175 default:
176     wcc_data resfail;   /* Directory attributes  */
177 };
178
179 union wccstat3 switch (nfsstat3 status) {
180 #ifndef UNION_ONLY_DEFAULT
181 case -1:
182     void;
183 #endif /* !UNION_ONLY_DEFAULT */
184 default:
185     wcc_data wcc;
186 };
187
188 union getattr3res switch (nfsstat3 status) {
189 case NFS3_OK:
190     fattr3 attributes;
191 default:
192     void;
193 };
194
195 union sattrguard3 switch (bool check) {
196 case TRUE:
197     nfstime3 ctime;
198 case FALSE:
199     void;
200 };
201
202 struct setattr3args {
203     nfs_fh3 object;
204     sattr3 new_attributes;
205     sattrguard3 guard;
206 };
207
208 struct lookup3resok {
209     nfs_fh3 object;
210     post_op_attr obj_attributes;
211     post_op_attr dir_attributes;
212 };
213
214 union lookup3res switch (nfsstat3 status) {
215 case NFS3_OK:
216     lookup3resok resok;
217 default:
218     post_op_attr resfail;   /* Directory attributes */
219 };
220
221 const ACCESS3_READ    = 0x0001;
222 const ACCESS3_LOOKUP  = 0x0002;
223 const ACCESS3_MODIFY  = 0x0004;
224 const ACCESS3_EXTEND  = 0x0008;
225 const ACCESS3_DELETE  = 0x0010;
226 const ACCESS3_EXECUTE = 0x0020;
227
228 struct access3args {
229     nfs_fh3 object;
230     uint32 access;
231 };
232
233 struct access3resok {
234     post_op_attr obj_attributes;
235     uint32 access;
236 };
237
238 union access3res switch (nfsstat3 status) {
239 case NFS3_OK:
240     access3resok resok;
241 default:
242     post_op_attr resfail;
243 };
244
245 struct readlink3resok {
246     post_op_attr symlink_attributes;
247     nfspath3 data;
248 };
249
250 union readlink3res switch (nfsstat3 status) {
251 case NFS3_OK:
252     readlink3resok resok;
253 default:
254     post_op_attr resfail;
255 };
256
257 struct read3args {
258     nfs_fh3 file;
259     uint64 offset;
260     uint32 count;
261 };
262
263 struct read3resok {
264     post_op_attr file_attributes;
265     uint32 count;
266     bool eof;
267     opaque data<>;
268 };
269
270 union read3res switch (nfsstat3 status) {
271 case NFS3_OK:
272     read3resok resok;
273 default:
274     post_op_attr resfail;
275 };
276
277 enum stable_how {
278     UNSTABLE = 0,
279     DATA_SYNC = 1,
280     FILE_SYNC = 2
281 };
282
283 struct write3args {
284     nfs_fh3 file;
285     uint64 offset;
286     uint32 count;
287     stable_how stable;
288     opaque data<>;
289 };
290
291 struct write3resok {
292     wcc_data file_wcc;
293     uint32 count;
294     stable_how committed;
295     writeverf3 verf;
296 };
297
298 union write3res switch (nfsstat3 status) {
299 case NFS3_OK:
300     write3resok resok;
301 default:
302     wcc_data resfail;
303 };
304
305 enum createmode3 {
306     UNCHECKED = 0,
307     GUARDED = 1,
308     EXCLUSIVE = 2
309 };
310
311 union createhow3 switch (createmode3 mode) {
312 case UNCHECKED:
313 case GUARDED:
314     sattr3 obj_attributes;
315 case EXCLUSIVE:
316     createverf3 verf;
317 };
318
319 struct create3args {
320     diropargs3 where;
321     createhow3 how;
322 };
323
324 struct mkdir3args {
325     diropargs3 where;
326     sattr3 attributes;
327 };
328
329 struct symlinkdata3 {
330     sattr3 symlink_attributes;
331     nfspath3 symlink_data;
332 };
333
334 struct symlink3args {
335     diropargs3 where;
336     symlinkdata3 symlink;
337 };
338
339 struct devicedata3 {
340     sattr3 dev_attributes;
341     specdata3 spec;
342 };
343
344 union mknoddata3 switch (ftype3 type) {
345 case NF3CHR:
346 case NF3BLK:
347     devicedata3 device;
348 case NF3SOCK:
349 case NF3FIFO:
350     sattr3 pipe_attributes;
351 default:
352     void;
353 };
354
355 struct mknod3args {
356     diropargs3 where;
357     mknoddata3 what;
358 };
359
360 struct rename3args {
361     diropargs3 from;
362     diropargs3 to;
363 };
364
365 struct rename3wcc {
366     wcc_data fromdir_wcc;
367     wcc_data todir_wcc;
368 };
369
370 union rename3res switch (nfsstat3 status) {
371 #ifndef UNION_ONLY_DEFAULT
372 case -1:
373     void;
374 #endif /* !UNION_ONLY_DEFAULT */
375 default:
376     rename3wcc res;
377 };
378
379 struct link3args {
380     nfs_fh3 file;
381     diropargs3 link;
382 };
383
384 struct link3wcc {
385     post_op_attr file_attributes;
386     wcc_data linkdir_wcc;
387 };
388
389 union link3res switch (nfsstat3 status) {
390 #ifndef UNION_ONLY_DEFAULT
391 case -1:
392     void;
393 #endif /* !UNION_ONLY_DEFAULT */
394 default:
395     link3wcc res;
396 };
397
398 struct readdir3args {
399     nfs_fh3 dir;
400     uint64 cookie;
401     cookieverf3 cookieverf;
402     uint32 count;
403 };
404
405 struct entry3 {
406     uint64 fileid;
407     filename3 name;
408     uint64 cookie;
409     entry3 *nextentry;
410 };
411
412 struct dirlist3 {
413     entry3 *entries;
414     bool eof;
415 };
416
417 struct readdir3resok {
418     post_op_attr dir_attributes;
419     cookieverf3 cookieverf;
420     dirlist3 reply;
421 };
422
423 union readdir3res switch (nfsstat3 status) {
424 case NFS3_OK:
425     readdir3resok resok;
426 default:
427     post_op_attr resfail;
428 };
429
430 struct readdirplus3args {
431     nfs_fh3 dir;
432     uint64 cookie;
433     cookieverf3 cookieverf;
434     uint32 dircount;
435     uint32 maxcount;
436 };
437
438 struct entryplus3 {
439     uint64 fileid;
440     filename3 name;
441     uint64 cookie;
442     post_op_attr name_attributes;
443     post_op_fh3 name_handle;
444     entryplus3 *nextentry;
445 };
446
447 struct dirlistplus3 {
448     entryplus3 *entries;
449     bool eof;
450 };
451
452 struct readdirplus3resok {
453     post_op_attr dir_attributes;
454     cookieverf3 cookieverf;
455     dirlistplus3 reply;
456 };
457
458 union readdirplus3res switch (nfsstat3 status) {
459 case NFS3_OK:
460     readdirplus3resok resok;
461 default:
462     post_op_attr resfail;
463 };
464
465 struct fsstat3resok {
466     post_op_attr obj_attributes;
467     uint64 tbytes;
468     uint64 fbytes;
469     uint64 abytes;
470     uint64 tfiles;
471     uint64 ffiles;
472     uint64 afiles;
473     uint32 invarsec;
474 };
475
476 union fsstat3res switch (nfsstat3 status) {
477 case NFS3_OK:
478     fsstat3resok resok;
479 default:
480     post_op_attr resfail;
481 };
482
483 const FSF3_LINK        = 0x0001;
484 const FSF3_SYMLINK     = 0x0002;
485 const FSF3_HOMOGENEOUS = 0x0008;
486 const FSF3_CANSETTIME  = 0x0010;
487
488 struct fsinfo3resok {
489     post_op_attr obj_attributes;
490     uint32 rtmax;
491     uint32 rtpref;
492     uint32 rtmult;
493     uint32 wtmax;
494     uint32 wtpref;
495     uint32 wtmult;
496     uint32 dtpref;
497     uint64 maxfilesize;
498     nfstime3 time_delta;
499     uint32 properties;
500 };
501
502 union fsinfo3res switch (nfsstat3 status) {
503 case NFS3_OK:
504     fsinfo3resok resok;
505 default:
506     post_op_attr resfail;
507 };
508
509 struct pathconf3resok {
510     post_op_attr obj_attributes;
511     uint32 linkmax;
512     uint32 name_max;
513     bool no_trunc;
514     bool chown_restricted;
515     bool case_insensitive;
516     bool case_preserving;
517 };
518
519 union pathconf3res switch (nfsstat3 status) {
520 case NFS3_OK:
521     pathconf3resok resok;
522 default:
523     post_op_attr resfail;
524 };
525
526 struct commit3args {
527     nfs_fh3 file;
528     uint64 offset;
529     uint32 count;
530 };
531
532 struct commit3resok {
533     wcc_data file_wcc;
534     writeverf3 verf;
535 };
536
537 union commit3res switch (nfsstat3 status) {
538 case NFS3_OK:
539     commit3resok resok;
540 default:
541     wcc_data resfail;
542 };
543
544 program NFS_PROGRAM {
545     version NFS_V3 {
546         void
547         NFSPROC3_NULL (void) = 0;
548
549         getattr3res
550         NFSPROC3_GETATTR (nfs_fh3) = 1;
551
552         wccstat3
553         NFSPROC3_SETATTR (setattr3args) = 2;
554
555         lookup3res
556         NFSPROC3_LOOKUP (diropargs3) = 3;
557
558         access3res
559         NFSPROC3_ACCESS (access3args) = 4;
560
561         readlink3res
562         NFSPROC3_READLINK (nfs_fh3) = 5;
563
564         read3res
565         NFSPROC3_READ (read3args) = 6;
566
567         write3res
568         NFSPROC3_WRITE (write3args) = 7;
569
570         diropres3
571         NFSPROC3_CREATE (create3args) = 8;
572
573         diropres3
574         NFSPROC3_MKDIR (mkdir3args) = 9;
575
576         diropres3
577         NFSPROC3_SYMLINK (symlink3args) = 10;
578
579         diropres3
580         NFSPROC3_MKNOD (mknod3args) = 11;
581
582         wccstat3
583         NFSPROC3_REMOVE (diropargs3) = 12;
584
585         wccstat3
586         NFSPROC3_RMDIR (diropargs3) = 13;
587
588         rename3res
589         NFSPROC3_RENAME (rename3args) = 14;
590
591         link3res
592         NFSPROC3_LINK (link3args) = 15;
593
594         readdir3res
595         NFSPROC3_READDIR (readdir3args) = 16;
596
597         readdirplus3res
598         NFSPROC3_READDIRPLUS (readdirplus3args) = 17;
599
600         fsstat3res
601         NFSPROC3_FSSTAT (nfs_fh3) = 18;
602
603         fsinfo3res
604         NFSPROC3_FSINFO (nfs_fh3) = 19;
605
606         pathconf3res
607         NFSPROC3_PATHCONF (nfs_fh3) = 20;
608
609         commit3res
610         NFSPROC3_COMMIT (commit3args) = 21;
611     } = 3;
612 } = 100003;