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