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