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