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