coda.h revision 1.18 1 /* $NetBSD: coda.h,v 1.18 2014/12/13 15:58:39 hannken Exp $ */
2
3 /*
4
5 Coda: an Experimental Distributed File System
6 Release 4.0
7
8 Copyright (c) 1987-1999 Carnegie Mellon University
9 All Rights Reserved
10
11 Permission to use, copy, modify and distribute this software and its
12 documentation is hereby granted, provided that both the copyright
13 notice and this permission notice appear in all copies of the
14 software, derivative works or modified versions, and any portions
15 thereof, and that both notices appear in supporting documentation, and
16 that credit is given to Carnegie Mellon University in all documents
17 and publicity pertaining to direct or indirect use of this code or its
18 derivatives.
19
20 CODA IS AN EXPERIMENTAL SOFTWARE SYSTEM AND IS KNOWN TO HAVE BUGS,
21 SOME OF WHICH MAY HAVE SERIOUS CONSEQUENCES. CARNEGIE MELLON ALLOWS
22 FREE USE OF THIS SOFTWARE IN ITS "AS IS" CONDITION. CARNEGIE MELLON
23 DISCLAIMS ANY LIABILITY OF ANY KIND FOR ANY DAMAGES WHATSOEVER
24 RESULTING DIRECTLY OR INDIRECTLY FROM THE USE OF THIS SOFTWARE OR OF
25 ANY DERIVATIVE WORK.
26
27 Carnegie Mellon encourages users of this software to return any
28 improvements or extensions that they make, and to grant Carnegie
29 Mellon the rights to redistribute these changes without encumbrance.
30 */
31
32 /*
33 *
34 * Based on cfs.h from Mach, but revamped for increased simplicity.
35 * Linux modifications by
36 * Peter Braam, Aug 1996
37 */
38
39 #ifndef _CODA_HEADER_
40 #define _CODA_HEADER_
41
42 #if defined(__NetBSD__)
43 #if defined(_KERNEL_OPT)
44 /* pull in optional CODA_COMPAT_5 flag and NVCODA. */
45 #include "opt_coda_compat.h"
46 #include <vcoda.h>
47 #else
48 #define NVCODA 4
49 #endif
50 #endif
51
52 /* Catch new _KERNEL defn for NetBSD and DJGPP/__CYGWIN32__ */
53 #if defined(__NetBSD__) || \
54 ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
55 #include <sys/types.h>
56 #include <sys/systm.h>
57 #endif
58
59 #ifndef CODA_MAXSYMLINKS
60 #define CODA_MAXSYMLINKS 10
61 #endif
62
63 #if defined(DJGPP) || defined(__CYGWIN32__)
64 #ifdef KERNEL
65 typedef unsigned long u_long;
66 typedef unsigned int u_int;
67 typedef unsigned short u_short;
68 typedef u_long ino_t;
69 typedef u_long dev_t;
70 typedef void *void *;
71 #ifdef DOS
72 typedef unsigned __int64 u_quad_t;
73 #else
74 typedef unsigned long long u_quad_t;
75 #endif
76
77 #define inline
78
79 struct timespec {
80 long ts_sec;
81 long ts_nsec;
82 };
83 #else /* DJGPP but not KERNEL */
84 #include <sys/time.h>
85 typedef unsigned long long u_quad_t;
86 #endif /* !KERNEL */
87 #endif /* !DJGPP */
88
89
90 #if defined(__linux__)
91 #define cdev_t u_quad_t
92 #ifndef __KERNEL__
93 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
94 #define _UQUAD_T_ 1
95 typedef unsigned long long u_quad_t;
96 #endif
97 #else /*__KERNEL__ */
98 typedef unsigned long long u_quad_t;
99 #endif /* __KERNEL__ */
100 #else
101 #define cdev_t dev_t
102 #endif
103
104 /* Solaris Definitions */
105 #if defined(sun)
106 #include <sys/types.h>
107 #include <sys/time.h>
108 typedef unsigned long long u_quad_t;
109 #undef __BIT_TYPES_DEFINED__
110 #endif
111
112 /* Mac OS X / Darwin */
113 #if defined(__APPLE__) && defined(__MACH__)
114 #define __BIT_TYPES_DEFINED__
115 #endif
116
117 #ifndef __BIT_TYPES_DEFINED__
118 #define __BIT_TYPES_DEFINED__
119 typedef signed char int8_t;
120 typedef unsigned char u_int8_t;
121 typedef short int16_t;
122 typedef unsigned short u_int16_t;
123 typedef int int32_t;
124 typedef unsigned int u_int32_t;
125 #endif
126
127
128 /*
129 * Cfs constants
130 */
131 #define CODA_MAXNAMLEN 255
132 #define CODA_MAXPATHLEN 1024
133 #define CODA_MAXSYMLINK 10
134
135 /* these are Coda's version of O_RDONLY etc combinations
136 * to deal with VFS open modes
137 */
138 #define C_O_READ 0x001
139 #define C_O_WRITE 0x002
140 #define C_O_TRUNC 0x010
141 #define C_O_EXCL 0x100
142 #define C_O_CREAT 0x200
143
144 /* these are to find mode bits in Venus */
145 #define C_M_READ 00400
146 #define C_M_WRITE 00200
147
148 /* for access Venus will use */
149 #define C_A_C_OK 8 /* Test for writing upon create. */
150 #define C_A_R_OK 4 /* Test for read permission. */
151 #define C_A_W_OK 2 /* Test for write permission. */
152 #define C_A_X_OK 1 /* Test for execute permission. */
153 #define C_A_F_OK 0 /* Test for existence. */
154
155 #if defined(sun)
156 #define _VENUS_DIRENT_T_ 1
157 struct venus_dirent {
158 unsigned long d_fileno; /* file number of entry */
159 unsigned short d_reclen; /* length of this record */
160 unsigned short d_namlen; /* length of string in d_name */
161 char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
162 };
163 #undef DIRSIZ
164 #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
165 (((dp)->d_namlen+1 + 3) &~ 3))
166 #endif
167
168 #ifndef _VENUS_DIRENT_T_
169 #define _VENUS_DIRENT_T_ 1
170 struct venus_dirent {
171 unsigned long d_fileno; /* file number of entry */
172 unsigned short d_reclen; /* length of this record */
173 unsigned char d_type; /* file type, see below */
174 unsigned char d_namlen; /* length of string in d_name */
175 char d_name[CODA_MAXNAMLEN + 1];/* name must be no longer than this */
176 };
177 #undef DIRSIZ
178 #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
179 (((dp)->d_namlen+1 + 3) &~ 3))
180
181 /*
182 * File types
183 */
184 #define CDT_UNKNOWN 0
185 #define CDT_FIFO 1
186 #define CDT_CHR 2
187 #define CDT_DIR 4
188 #define CDT_BLK 6
189 #define CDT_REG 8
190 #define CDT_LNK 10
191 #define CDT_SOCK 12
192 #define CDT_WHT 14
193
194 /*
195 * Convert between stat structure types and directory types.
196 */
197 #define IFTOCDT(mode) (((mode) & 0170000) >> 12)
198 #define CDTTOIF(dirtype) ((dirtype) << 12)
199
200 #endif
201
202 #ifdef CODA_COMPAT_5
203
204 typedef struct {
205 u_long Volume;
206 u_long Vnode;
207 u_long Unique;
208 } CodaFid;
209
210 static inline ino_t coda_f2i(CodaFid *fid)
211 {
212 if (!fid) return 0;
213 return (fid->Unique + (fid->Vnode<<10) + (fid->Volume<<20));
214 }
215
216 static inline char * coda_f2s(CodaFid *fid)
217 {
218 static char fid_str [35];
219 snprintf (fid_str, 35, "[%lx.%lx.%lx]", fid->Volume,
220 fid->Vnode, fid->Unique);
221 return fid_str;
222 }
223
224 static inline int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
225 {
226 return (fid1->Volume == fid2->Volume &&
227 fid1->Vnode == fid2->Vnode &&
228 fid1->Unique == fid2->Unique);
229 }
230
231 struct coda_cred {
232 u_int32_t cr_uid, cr_euid, cr_suid, cr_fsuid; /* Real, efftve, set, fs uid*/
233 u_int32_t cr_groupid, cr_egid, cr_sgid, cr_fsgid; /* same for groups */
234 };
235
236 #else
237
238 typedef struct {
239 u_int32_t opaque[4];
240 } CodaFid;
241
242
243 static inline ino_t coda_f2i(CodaFid *fid)
244 {
245 if (!fid) return 0;
246 return (fid->opaque[1] + (fid->opaque[2]<<10) + (fid->opaque[3]<<20));
247 }
248
249 static inline char * coda_f2s(CodaFid *fid)
250 {
251 static char fid_str [35];
252 snprintf (fid_str, 35, "[%x.%x.%x.%x]", fid->opaque[0],
253 fid->opaque[1], fid->opaque[2], fid->opaque[3]);
254 return fid_str;
255 }
256
257 static inline int coda_fid_eq (CodaFid *fid1, CodaFid *fid2)
258 {
259 return (fid1->opaque[0] == fid2->opaque[0] &&
260 fid1->opaque[1] == fid2->opaque[1] &&
261 fid1->opaque[2] == fid2->opaque[2] &&
262 fid1->opaque[3] == fid2->opaque[3]);
263 }
264
265 #endif
266
267 #ifndef _VENUS_VATTR_T_
268 #define _VENUS_VATTR_T_
269 /*
270 * Vnode types. VNON means no type.
271 */
272 enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
273
274 struct coda_vattr {
275 long va_type; /* vnode type (for create) */
276 u_short va_mode; /* files access mode and type */
277 short va_nlink; /* number of references to file */
278 uid_t va_uid; /* owner user id */
279 gid_t va_gid; /* owner group id */
280 u_long va_fileid; /* file id */
281 u_quad_t va_size; /* file size in bytes */
282 long va_blocksize; /* blocksize preferred for i/o */
283 struct timespec va_atime; /* time of last access */
284 struct timespec va_mtime; /* time of last modification */
285 struct timespec va_ctime; /* time file changed */
286 u_long va_gen; /* generation number of file */
287 u_long va_flags; /* flags defined for file */
288 cdev_t va_rdev; /* device special file represents */
289 u_quad_t va_bytes; /* bytes of disk space held by file */
290 u_quad_t va_filerev; /* file modification number */
291 };
292
293 #endif
294
295 /* structure used by CODA_STATFS for getting cache information from venus */
296 struct coda_statfs {
297 int32_t f_blocks;
298 int32_t f_bfree;
299 int32_t f_bavail;
300 int32_t f_files;
301 int32_t f_ffree;
302 };
303
304 /*
305 * Kernel <--> Venus communications.
306 */
307
308 #define CODA_ROOT 2
309 #define CODA_OPEN_BY_FD 3
310 #define CODA_OPEN 4
311 #define CODA_CLOSE 5
312 #define CODA_IOCTL 6
313 #define CODA_GETATTR 7
314 #define CODA_SETATTR 8
315 #define CODA_ACCESS 9
316 #define CODA_LOOKUP 10
317 #define CODA_CREATE 11
318 #define CODA_REMOVE 12
319 #define CODA_LINK 13
320 #define CODA_RENAME 14
321 #define CODA_MKDIR 15
322 #define CODA_RMDIR 16
323 #define CODA_READDIR 17
324 #define CODA_SYMLINK 18
325 #define CODA_READLINK 19
326 #define CODA_FSYNC 20
327 #define CODA_INACTIVE 21
328 #define CODA_VGET 22
329 #define CODA_SIGNAL 23
330 #define CODA_REPLACE 24 /* DOWNCALL */
331 #define CODA_FLUSH 25 /* DOWNCALL */
332 #define CODA_PURGEUSER 26 /* DOWNCALL */
333 #define CODA_ZAPFILE 27 /* DOWNCALL */
334 #define CODA_ZAPDIR 28 /* DOWNCALL */
335 #define CODA_PURGEFID 30 /* DOWNCALL */
336 #define CODA_OPEN_BY_PATH 31
337 #define CODA_RESOLVE 32
338 #define CODA_REINTEGRATE 33
339 #define CODA_STATFS 34
340 #define CODA_NCALLS 35
341
342 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
343
344 #define VC_MAXDATASIZE 8192
345 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
346 VC_MAXDATASIZE
347
348 #define CIOC_KERNEL_VERSION _IOWR('c', 10, sizeof (int))
349
350 #if 0
351 #define CODA_KERNEL_VERSION 0 /* don't care about kernel version number */
352 #define CODA_KERNEL_VERSION 1 /* The old venus 4.6 compatible interface */
353 #endif
354 #ifdef CODA_COMPAT_5
355 #define CODA_KERNEL_VERSION 2 /* venus_lookup gets an extra parameter */
356 #else
357 #define CODA_KERNEL_VERSION 3 /* 128-bit fids for realms */
358 #endif
359
360 /*
361 * Venus <-> Coda RPC arguments
362 */
363 #ifdef CODA_COMPAT_5
364 struct coda_in_hdr {
365 unsigned long opcode;
366 unsigned long unique; /* Keep multiple outstanding msgs distinct */
367 u_short pid; /* Common to all */
368 u_short pgid; /* Common to all */
369 u_short sid; /* Common to all */
370 struct coda_cred cred; /* Common to all */
371 };
372 #else
373 struct coda_in_hdr {
374 u_int32_t opcode;
375 u_int32_t unique; /* Keep multiple outstanding msgs distinct */
376 pid_t pid; /* Common to all */
377 pid_t pgid; /* Common to all */
378 uid_t uid; /* Common to all */
379 };
380 #endif
381
382 /* Really important that opcode and unique are 1st two fields! */
383 struct coda_out_hdr {
384 u_int32_t opcode;
385 u_int32_t unique;
386 u_int32_t result;
387 };
388
389 /* coda_root: NO_IN */
390 struct coda_root_out {
391 struct coda_out_hdr oh;
392 CodaFid Fid;
393 };
394
395 struct coda_root_in {
396 struct coda_in_hdr in;
397 };
398
399 /* coda_open: */
400 struct coda_open_in {
401 struct coda_in_hdr ih;
402 CodaFid Fid;
403 int flags;
404 };
405
406 struct coda_open_out {
407 struct coda_out_hdr oh;
408 cdev_t dev;
409 ino_t inode; /* host inode of container file */
410 };
411
412
413 /* coda_close: */
414 struct coda_close_in {
415 struct coda_in_hdr ih;
416 CodaFid Fid;
417 int flags;
418 };
419
420 struct coda_close_out {
421 struct coda_out_hdr out;
422 };
423
424 /* coda_ioctl: */
425 struct coda_ioctl_in {
426 struct coda_in_hdr ih;
427 CodaFid Fid;
428 int cmd;
429 int len;
430 int rwflag;
431 char *data; /* Place holder for data. */
432 };
433
434 struct coda_ioctl_out {
435 struct coda_out_hdr oh;
436 int len;
437 void * data; /* Place holder for data. */
438 };
439
440
441 /* coda_getattr: */
442 struct coda_getattr_in {
443 struct coda_in_hdr ih;
444 CodaFid Fid;
445 };
446
447 struct coda_getattr_out {
448 struct coda_out_hdr oh;
449 struct coda_vattr attr;
450 };
451
452
453 /* coda_setattr: NO_OUT */
454 struct coda_setattr_in {
455 struct coda_in_hdr ih;
456 CodaFid Fid;
457 struct coda_vattr attr;
458 };
459
460 struct coda_setattr_out {
461 struct coda_out_hdr out;
462 };
463
464 /* coda_access: NO_OUT */
465 struct coda_access_in {
466 struct coda_in_hdr ih;
467 CodaFid Fid;
468 int flags;
469 };
470
471 struct coda_access_out {
472 struct coda_out_hdr out;
473 };
474
475
476 /* lookup flags */
477 #define CLU_CASE_SENSITIVE 0x01
478 #define CLU_CASE_INSENSITIVE 0x02
479
480 /* coda_lookup: */
481 struct coda_lookup_in {
482 struct coda_in_hdr ih;
483 CodaFid Fid;
484 int name; /* Place holder for data. */
485 int flags;
486 };
487
488 struct coda_lookup_out {
489 struct coda_out_hdr oh;
490 CodaFid Fid;
491 int vtype;
492 };
493
494
495 /* coda_create: */
496 struct coda_create_in {
497 struct coda_in_hdr ih;
498 CodaFid Fid;
499 struct coda_vattr attr;
500 int excl;
501 int mode;
502 int name; /* Place holder for data. */
503 };
504
505 struct coda_create_out {
506 struct coda_out_hdr oh;
507 CodaFid Fid;
508 struct coda_vattr attr;
509 };
510
511
512 /* coda_remove: NO_OUT */
513 struct coda_remove_in {
514 struct coda_in_hdr ih;
515 CodaFid Fid;
516 int name; /* Place holder for data. */
517 };
518
519 struct coda_remove_out {
520 struct coda_out_hdr out;
521 };
522
523 /* coda_link: NO_OUT */
524 struct coda_link_in {
525 struct coda_in_hdr ih;
526 CodaFid sourceFid; /* cnode to link *to* */
527 CodaFid destFid; /* Directory in which to place link */
528 int tname; /* Place holder for data. */
529 };
530
531 struct coda_link_out {
532 struct coda_out_hdr out;
533 };
534
535
536 /* coda_rename: NO_OUT */
537 struct coda_rename_in {
538 struct coda_in_hdr ih;
539 CodaFid sourceFid;
540 int srcname;
541 CodaFid destFid;
542 int destname;
543 };
544
545 struct coda_rename_out {
546 struct coda_out_hdr out;
547 };
548
549 /* coda_mkdir: */
550 struct coda_mkdir_in {
551 struct coda_in_hdr ih;
552 CodaFid Fid;
553 struct coda_vattr attr;
554 int name; /* Place holder for data. */
555 };
556
557 struct coda_mkdir_out {
558 struct coda_out_hdr oh;
559 CodaFid Fid;
560 struct coda_vattr attr;
561 };
562
563
564 /* coda_rmdir: NO_OUT */
565 struct coda_rmdir_in {
566 struct coda_in_hdr ih;
567 CodaFid Fid;
568 int name; /* Place holder for data. */
569 };
570
571 struct coda_rmdir_out {
572 struct coda_out_hdr out;
573 };
574
575 /* coda_readdir: */
576 struct coda_readdir_in {
577 struct coda_in_hdr ih;
578 CodaFid Fid;
579 int count;
580 int offset;
581 };
582
583 struct coda_readdir_out {
584 struct coda_out_hdr oh;
585 int size;
586 void * data; /* Place holder for data. */
587 };
588
589 /* coda_symlink: NO_OUT */
590 struct coda_symlink_in {
591 struct coda_in_hdr ih;
592 CodaFid Fid; /* Directory to put symlink in */
593 int srcname;
594 struct coda_vattr attr;
595 int tname;
596 };
597
598 struct coda_symlink_out {
599 struct coda_out_hdr out;
600 };
601
602 /* coda_readlink: */
603 struct coda_readlink_in {
604 struct coda_in_hdr ih;
605 CodaFid Fid;
606 };
607
608 struct coda_readlink_out {
609 struct coda_out_hdr oh;
610 int count;
611 void * data; /* Place holder for data. */
612 };
613
614
615 /* coda_fsync: NO_OUT */
616 struct coda_fsync_in {
617 struct coda_in_hdr ih;
618 CodaFid Fid;
619 };
620
621 struct coda_fsync_out {
622 struct coda_out_hdr out;
623 };
624
625 /* coda_vget: */
626 struct coda_vget_in {
627 struct coda_in_hdr ih;
628 CodaFid Fid;
629 };
630
631 struct coda_vget_out {
632 struct coda_out_hdr oh;
633 CodaFid Fid;
634 int vtype;
635 };
636
637
638 /* CODA_SIGNAL is out-of-band, doesn't need data. */
639 /* CODA_INVALIDATE is a venus->kernel call */
640 /* CODA_FLUSH is a venus->kernel call */
641
642 /* coda_purgeuser: */
643 /* CODA_PURGEUSER is a venus->kernel call */
644 struct coda_purgeuser_out {
645 struct coda_out_hdr oh;
646 #ifdef CODA_COMPAT_5
647 struct coda_cred cred;
648 #else
649 uid_t uid;
650 #endif
651 };
652
653 /* coda_zapfile: */
654 /* CODA_ZAPFILE is a venus->kernel call */
655 struct coda_zapfile_out {
656 struct coda_out_hdr oh;
657 CodaFid Fid;
658 };
659
660 /* coda_zapdir: */
661 /* CODA_ZAPDIR is a venus->kernel call */
662 struct coda_zapdir_out {
663 struct coda_out_hdr oh;
664 CodaFid Fid;
665 };
666
667 /* coda_zapnode: */
668 /* CODA_ZAPVNODE is a venus->kernel call */
669 struct coda_zapvnode_out {
670 struct coda_out_hdr oh;
671 #ifdef CODA_COMPAT_5
672 struct coda_cred cred;
673 #endif
674 CodaFid Fid;
675 };
676
677 /* coda_purgefid: */
678 /* CODA_PURGEFID is a venus->kernel call */
679 struct coda_purgefid_out {
680 struct coda_out_hdr oh;
681 CodaFid Fid;
682 };
683
684 /* coda_replace: */
685 /* CODA_REPLACE is a venus->kernel call */
686 struct coda_replace_out { /* coda_replace is a venus->kernel call */
687 struct coda_out_hdr oh;
688 CodaFid NewFid;
689 CodaFid OldFid;
690 };
691
692 /* coda_open_by_fd: */
693 struct coda_open_by_fd_in {
694 struct coda_in_hdr ih;
695 CodaFid Fid;
696 int flags;
697 };
698
699 struct coda_open_by_fd_out {
700 struct coda_out_hdr oh;
701 int fd;
702 struct file *fh;
703 };
704
705 /* coda_open_by_path: */
706 struct coda_open_by_path_in {
707 struct coda_in_hdr ih;
708 CodaFid Fid;
709 int flags;
710 };
711
712 struct coda_open_by_path_out {
713 struct coda_out_hdr oh;
714 int path;
715 };
716
717 /* coda_statfs: NO_IN */
718 struct coda_statfs_in {
719 struct coda_in_hdr ih;
720 };
721
722 struct coda_statfs_out {
723 struct coda_out_hdr oh;
724 struct coda_statfs stat;
725 };
726
727 /*
728 * Occasionally, we don't cache the fid returned by CODA_LOOKUP.
729 * For instance, if the fid is inconsistent.
730 * This case is handled by setting the top bit of the type result parameter.
731 */
732 #define CODA_NOCACHE 0x80000000
733
734 union inputArgs {
735 struct coda_in_hdr ih; /* NB: every struct below begins with an ih */
736 struct coda_open_in coda_open;
737 struct coda_close_in coda_close;
738 struct coda_ioctl_in coda_ioctl;
739 struct coda_getattr_in coda_getattr;
740 struct coda_setattr_in coda_setattr;
741 struct coda_access_in coda_access;
742 struct coda_lookup_in coda_lookup;
743 struct coda_create_in coda_create;
744 struct coda_remove_in coda_remove;
745 struct coda_link_in coda_link;
746 struct coda_rename_in coda_rename;
747 struct coda_mkdir_in coda_mkdir;
748 struct coda_rmdir_in coda_rmdir;
749 struct coda_readdir_in coda_readdir;
750 struct coda_symlink_in coda_symlink;
751 struct coda_readlink_in coda_readlink;
752 struct coda_fsync_in coda_fsync;
753 struct coda_vget_in coda_vget;
754 struct coda_open_by_fd_in coda_open_by_fd;
755 struct coda_open_by_path_in coda_open_by_path;
756 struct coda_statfs_in coda_statfs;
757 };
758
759 union outputArgs {
760 struct coda_out_hdr oh; /* NB: every struct below begins with an oh */
761 struct coda_root_out coda_root;
762 struct coda_open_out coda_open;
763 struct coda_ioctl_out coda_ioctl;
764 struct coda_getattr_out coda_getattr;
765 struct coda_lookup_out coda_lookup;
766 struct coda_create_out coda_create;
767 struct coda_mkdir_out coda_mkdir;
768 struct coda_readdir_out coda_readdir;
769 struct coda_readlink_out coda_readlink;
770 struct coda_vget_out coda_vget;
771 struct coda_purgeuser_out coda_purgeuser;
772 struct coda_zapfile_out coda_zapfile;
773 struct coda_zapdir_out coda_zapdir;
774 struct coda_zapvnode_out coda_zapvnode;
775 struct coda_purgefid_out coda_purgefid;
776 struct coda_replace_out coda_replace;
777 struct coda_open_by_fd_out coda_open_by_fd;
778 struct coda_open_by_path_out coda_open_by_path;
779 struct coda_statfs_out coda_statfs;
780 };
781
782 union coda_downcalls {
783 /* CODA_INVALIDATE is a venus->kernel call */
784 /* CODA_FLUSH is a venus->kernel call */
785 struct coda_purgeuser_out purgeuser;
786 struct coda_zapfile_out zapfile;
787 struct coda_zapdir_out zapdir;
788 struct coda_zapvnode_out zapvnode;
789 struct coda_purgefid_out purgefid;
790 struct coda_replace_out replace;
791 };
792
793
794 /*
795 * Used for identifying usage of "Control" and pioctls
796 */
797
798 #define PIOCPARM_MASK 0x0000ffff
799 struct ViceIoctl {
800 void *in, *out; /* Data to be transferred in, or out */
801 unsigned short in_size; /* Size of input buffer <= 8K */
802 unsigned short out_size;/* Maximum size of output buffer, <= 8K */
803 };
804
805 struct PioctlData {
806 const char *path;
807 int follow;
808 #if defined(__CYGWIN32__) || defined(__NT_CODA__)
809 int cmd;
810 #endif
811 struct ViceIoctl vi;
812 };
813
814 #define CODA_CONTROL ".CONTROL"
815 #define CODA_CONTROLLEN 8
816 #define CTL_INO -1
817 #define CTL_FILE "/coda/.CONTROL"
818
819
820 #ifdef CODA_COMPAT_5
821 #define CTL_FID { -1, -1, -1 }
822 #define IS_CTL_FID(fidp) ((fidp)->Volume == -1 &&\
823 (fidp)->Vnode == -1 &&\
824 (fidp)->Unique == -1)
825 #define INVAL_FID { 0, 0, 0 }
826 #else
827 #define CTL_FID { { -1, -1, -1, -1 } }
828 #define IS_CTL_FID(fidp) ((fidp)->opaque[0] == -1 &&\
829 (fidp)->opaque[1] == -1 &&\
830 (fidp)->opaque[2] == -1 &&\
831 (fidp)->opaque[3] == -1)
832 #define INVAL_FID { { 0, 0, 0, 0 } }
833 #endif
834
835 /* Data passed to mount */
836
837 #define CODA_MOUNT_VERSION 1
838
839 struct coda_mount_data {
840 int version;
841 int fd; /* Opened device */
842 };
843
844 #endif
845
846