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