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