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