1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59#ifndef _UAPI_CODA_HEADER_
60#define _UAPI_CODA_HEADER_
61
62
63
64#if defined(__NetBSD__) || \
65 ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
66#include <sys/types.h>
67#endif
68
69#ifndef CODA_MAXSYMLINKS
70#define CODA_MAXSYMLINKS 10
71#endif
72
73#if defined(DJGPP) || defined(__CYGWIN32__)
74#ifdef KERNEL
75typedef unsigned long u_long;
76typedef unsigned int u_int;
77typedef unsigned short u_short;
78typedef u_long ino_t;
79typedef u_long dev_t;
80typedef void * caddr_t;
81#ifdef DOS
82typedef unsigned __int64 u_quad_t;
83#else
84typedef unsigned long long u_quad_t;
85#endif
86
87#define inline
88
89struct timespec {
90 long ts_sec;
91 long ts_nsec;
92};
93#else
94#include <sys/time.h>
95typedef unsigned long long u_quad_t;
96#endif
97#endif
98
99
100#if defined(__linux__)
101#include <linux/time.h>
102#define cdev_t u_quad_t
103#ifndef __KERNEL__
104#if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
105#define _UQUAD_T_ 1
106typedef unsigned long long u_quad_t;
107#endif
108#endif
109#else
110#define cdev_t dev_t
111#endif
112
113#ifdef __CYGWIN32__
114struct timespec {
115 time_t tv_sec;
116 long tv_nsec;
117};
118#endif
119
120#ifndef __BIT_TYPES_DEFINED__
121#define __BIT_TYPES_DEFINED__
122typedef signed char int8_t;
123typedef unsigned char u_int8_t;
124typedef short int16_t;
125typedef unsigned short u_int16_t;
126typedef int int32_t;
127typedef unsigned int u_int32_t;
128#endif
129
130
131
132
133
134#define CODA_MAXNAMLEN 255
135#define CODA_MAXPATHLEN 1024
136#define CODA_MAXSYMLINK 10
137
138
139
140
141#define C_O_READ 0x001
142#define C_O_WRITE 0x002
143#define C_O_TRUNC 0x010
144#define C_O_EXCL 0x100
145#define C_O_CREAT 0x200
146
147
148#define C_M_READ 00400
149#define C_M_WRITE 00200
150
151
152#define C_A_C_OK 8
153#define C_A_R_OK 4
154#define C_A_W_OK 2
155#define C_A_X_OK 1
156#define C_A_F_OK 0
157
158
159
160#ifndef _VENUS_DIRENT_T_
161#define _VENUS_DIRENT_T_ 1
162struct venus_dirent {
163 u_int32_t d_fileno;
164 u_int16_t d_reclen;
165 u_int8_t d_type;
166 u_int8_t d_namlen;
167 char d_name[CODA_MAXNAMLEN + 1];
168};
169#undef DIRSIZ
170#define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
171 (((dp)->d_namlen+1 + 3) &~ 3))
172
173
174
175
176#define CDT_UNKNOWN 0
177#define CDT_FIFO 1
178#define CDT_CHR 2
179#define CDT_DIR 4
180#define CDT_BLK 6
181#define CDT_REG 8
182#define CDT_LNK 10
183#define CDT_SOCK 12
184#define CDT_WHT 14
185
186
187
188
189#define IFTOCDT(mode) (((mode) & 0170000) >> 12)
190#define CDTTOIF(dirtype) ((dirtype) << 12)
191
192#endif
193
194#ifndef _VUID_T_
195#define _VUID_T_
196typedef u_int32_t vuid_t;
197typedef u_int32_t vgid_t;
198#endif
199
200struct CodaFid {
201 u_int32_t opaque[4];
202};
203
204#define coda_f2i(fid)\
205 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
206
207#ifndef _VENUS_VATTR_T_
208#define _VENUS_VATTR_T_
209
210
211
212enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
213
214struct coda_vattr {
215 long va_type;
216 u_short va_mode;
217 short va_nlink;
218 vuid_t va_uid;
219 vgid_t va_gid;
220 long va_fileid;
221 u_quad_t va_size;
222 long va_blocksize;
223 struct timespec va_atime;
224 struct timespec va_mtime;
225 struct timespec va_ctime;
226 u_long va_gen;
227 u_long va_flags;
228 cdev_t va_rdev;
229 u_quad_t va_bytes;
230 u_quad_t va_filerev;
231};
232
233#endif
234
235
236struct coda_statfs {
237 int32_t f_blocks;
238 int32_t f_bfree;
239 int32_t f_bavail;
240 int32_t f_files;
241 int32_t f_ffree;
242};
243
244
245
246
247
248#define CODA_ROOT 2
249#define CODA_OPEN_BY_FD 3
250#define CODA_OPEN 4
251#define CODA_CLOSE 5
252#define CODA_IOCTL 6
253#define CODA_GETATTR 7
254#define CODA_SETATTR 8
255#define CODA_ACCESS 9
256#define CODA_LOOKUP 10
257#define CODA_CREATE 11
258#define CODA_REMOVE 12
259#define CODA_LINK 13
260#define CODA_RENAME 14
261#define CODA_MKDIR 15
262#define CODA_RMDIR 16
263#define CODA_SYMLINK 18
264#define CODA_READLINK 19
265#define CODA_FSYNC 20
266#define CODA_VGET 22
267#define CODA_SIGNAL 23
268#define CODA_REPLACE 24
269#define CODA_FLUSH 25
270#define CODA_PURGEUSER 26
271#define CODA_ZAPFILE 27
272#define CODA_ZAPDIR 28
273#define CODA_PURGEFID 30
274#define CODA_OPEN_BY_PATH 31
275#define CODA_RESOLVE 32
276#define CODA_REINTEGRATE 33
277#define CODA_STATFS 34
278#define CODA_STORE 35
279#define CODA_RELEASE 36
280#define CODA_NCALLS 37
281
282#define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
283
284#define VC_MAXDATASIZE 8192
285#define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
286 VC_MAXDATASIZE
287
288#define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
289
290#define CODA_KERNEL_VERSION 3
291
292
293
294
295struct coda_in_hdr {
296 u_int32_t opcode;
297 u_int32_t unique;
298 pid_t pid;
299 pid_t pgid;
300 vuid_t uid;
301};
302
303
304struct coda_out_hdr {
305 u_int32_t opcode;
306 u_int32_t unique;
307 u_int32_t result;
308};
309
310
311struct coda_root_out {
312 struct coda_out_hdr oh;
313 struct CodaFid VFid;
314};
315
316struct coda_root_in {
317 struct coda_in_hdr in;
318};
319
320
321struct coda_open_in {
322 struct coda_in_hdr ih;
323 struct CodaFid VFid;
324 int flags;
325};
326
327struct coda_open_out {
328 struct coda_out_hdr oh;
329 cdev_t dev;
330 ino_t inode;
331};
332
333
334
335struct coda_store_in {
336 struct coda_in_hdr ih;
337 struct CodaFid VFid;
338 int flags;
339};
340
341struct coda_store_out {
342 struct coda_out_hdr out;
343};
344
345
346struct coda_release_in {
347 struct coda_in_hdr ih;
348 struct CodaFid VFid;
349 int flags;
350};
351
352struct coda_release_out {
353 struct coda_out_hdr out;
354};
355
356
357struct coda_close_in {
358 struct coda_in_hdr ih;
359 struct CodaFid VFid;
360 int flags;
361};
362
363struct coda_close_out {
364 struct coda_out_hdr out;
365};
366
367
368struct coda_ioctl_in {
369 struct coda_in_hdr ih;
370 struct CodaFid VFid;
371 int cmd;
372 int len;
373 int rwflag;
374 char *data;
375};
376
377struct coda_ioctl_out {
378 struct coda_out_hdr oh;
379 int len;
380 caddr_t data;
381};
382
383
384
385struct coda_getattr_in {
386 struct coda_in_hdr ih;
387 struct CodaFid VFid;
388};
389
390struct coda_getattr_out {
391 struct coda_out_hdr oh;
392 struct coda_vattr attr;
393};
394
395
396
397struct coda_setattr_in {
398 struct coda_in_hdr ih;
399 struct CodaFid VFid;
400 struct coda_vattr attr;
401};
402
403struct coda_setattr_out {
404 struct coda_out_hdr out;
405};
406
407
408struct coda_access_in {
409 struct coda_in_hdr ih;
410 struct CodaFid VFid;
411 int flags;
412};
413
414struct coda_access_out {
415 struct coda_out_hdr out;
416};
417
418
419
420#define CLU_CASE_SENSITIVE 0x01
421#define CLU_CASE_INSENSITIVE 0x02
422
423
424struct coda_lookup_in {
425 struct coda_in_hdr ih;
426 struct CodaFid VFid;
427 int name;
428 int flags;
429};
430
431struct coda_lookup_out {
432 struct coda_out_hdr oh;
433 struct CodaFid VFid;
434 int vtype;
435};
436
437
438
439struct coda_create_in {
440 struct coda_in_hdr ih;
441 struct CodaFid VFid;
442 struct coda_vattr attr;
443 int excl;
444 int mode;
445 int name;
446};
447
448struct coda_create_out {
449 struct coda_out_hdr oh;
450 struct CodaFid VFid;
451 struct coda_vattr attr;
452};
453
454
455
456struct coda_remove_in {
457 struct coda_in_hdr ih;
458 struct CodaFid VFid;
459 int name;
460};
461
462struct coda_remove_out {
463 struct coda_out_hdr out;
464};
465
466
467struct coda_link_in {
468 struct coda_in_hdr ih;
469 struct CodaFid sourceFid;
470 struct CodaFid destFid;
471 int tname;
472};
473
474struct coda_link_out {
475 struct coda_out_hdr out;
476};
477
478
479
480struct coda_rename_in {
481 struct coda_in_hdr ih;
482 struct CodaFid sourceFid;
483 int srcname;
484 struct CodaFid destFid;
485 int destname;
486};
487
488struct coda_rename_out {
489 struct coda_out_hdr out;
490};
491
492
493struct coda_mkdir_in {
494 struct coda_in_hdr ih;
495 struct CodaFid VFid;
496 struct coda_vattr attr;
497 int name;
498};
499
500struct coda_mkdir_out {
501 struct coda_out_hdr oh;
502 struct CodaFid VFid;
503 struct coda_vattr attr;
504};
505
506
507
508struct coda_rmdir_in {
509 struct coda_in_hdr ih;
510 struct CodaFid VFid;
511 int name;
512};
513
514struct coda_rmdir_out {
515 struct coda_out_hdr out;
516};
517
518
519struct coda_symlink_in {
520 struct coda_in_hdr ih;
521 struct CodaFid VFid;
522 int srcname;
523 struct coda_vattr attr;
524 int tname;
525};
526
527struct coda_symlink_out {
528 struct coda_out_hdr out;
529};
530
531
532struct coda_readlink_in {
533 struct coda_in_hdr ih;
534 struct CodaFid VFid;
535};
536
537struct coda_readlink_out {
538 struct coda_out_hdr oh;
539 int count;
540 caddr_t data;
541};
542
543
544
545struct coda_fsync_in {
546 struct coda_in_hdr ih;
547 struct CodaFid VFid;
548};
549
550struct coda_fsync_out {
551 struct coda_out_hdr out;
552};
553
554
555struct coda_vget_in {
556 struct coda_in_hdr ih;
557 struct CodaFid VFid;
558};
559
560struct coda_vget_out {
561 struct coda_out_hdr oh;
562 struct CodaFid VFid;
563 int vtype;
564};
565
566
567
568
569
570
571
572
573struct coda_purgeuser_out {
574 struct coda_out_hdr oh;
575 vuid_t uid;
576};
577
578
579
580struct coda_zapfile_out {
581 struct coda_out_hdr oh;
582 struct CodaFid CodaFid;
583};
584
585
586
587struct coda_zapdir_out {
588 struct coda_out_hdr oh;
589 struct CodaFid CodaFid;
590};
591
592
593
594struct coda_purgefid_out {
595 struct coda_out_hdr oh;
596 struct CodaFid CodaFid;
597};
598
599
600
601struct coda_replace_out {
602 struct coda_out_hdr oh;
603 struct CodaFid NewFid;
604 struct CodaFid OldFid;
605};
606
607
608struct coda_open_by_fd_in {
609 struct coda_in_hdr ih;
610 struct CodaFid VFid;
611 int flags;
612};
613
614struct coda_open_by_fd_out {
615 struct coda_out_hdr oh;
616 int fd;
617
618#ifdef __KERNEL__
619 struct file *fh;
620#endif
621};
622
623
624struct coda_open_by_path_in {
625 struct coda_in_hdr ih;
626 struct CodaFid VFid;
627 int flags;
628};
629
630struct coda_open_by_path_out {
631 struct coda_out_hdr oh;
632 int path;
633};
634
635
636struct coda_statfs_in {
637 struct coda_in_hdr in;
638};
639
640struct coda_statfs_out {
641 struct coda_out_hdr oh;
642 struct coda_statfs stat;
643};
644
645
646
647
648
649
650#define CODA_NOCACHE 0x80000000
651
652union inputArgs {
653 struct coda_in_hdr ih;
654 struct coda_open_in coda_open;
655 struct coda_store_in coda_store;
656 struct coda_release_in coda_release;
657 struct coda_close_in coda_close;
658 struct coda_ioctl_in coda_ioctl;
659 struct coda_getattr_in coda_getattr;
660 struct coda_setattr_in coda_setattr;
661 struct coda_access_in coda_access;
662 struct coda_lookup_in coda_lookup;
663 struct coda_create_in coda_create;
664 struct coda_remove_in coda_remove;
665 struct coda_link_in coda_link;
666 struct coda_rename_in coda_rename;
667 struct coda_mkdir_in coda_mkdir;
668 struct coda_rmdir_in coda_rmdir;
669 struct coda_symlink_in coda_symlink;
670 struct coda_readlink_in coda_readlink;
671 struct coda_fsync_in coda_fsync;
672 struct coda_vget_in coda_vget;
673 struct coda_open_by_fd_in coda_open_by_fd;
674 struct coda_open_by_path_in coda_open_by_path;
675 struct coda_statfs_in coda_statfs;
676};
677
678union outputArgs {
679 struct coda_out_hdr oh;
680 struct coda_root_out coda_root;
681 struct coda_open_out coda_open;
682 struct coda_ioctl_out coda_ioctl;
683 struct coda_getattr_out coda_getattr;
684 struct coda_lookup_out coda_lookup;
685 struct coda_create_out coda_create;
686 struct coda_mkdir_out coda_mkdir;
687 struct coda_readlink_out coda_readlink;
688 struct coda_vget_out coda_vget;
689 struct coda_purgeuser_out coda_purgeuser;
690 struct coda_zapfile_out coda_zapfile;
691 struct coda_zapdir_out coda_zapdir;
692 struct coda_purgefid_out coda_purgefid;
693 struct coda_replace_out coda_replace;
694 struct coda_open_by_fd_out coda_open_by_fd;
695 struct coda_open_by_path_out coda_open_by_path;
696 struct coda_statfs_out coda_statfs;
697};
698
699union coda_downcalls {
700
701
702 struct coda_purgeuser_out purgeuser;
703 struct coda_zapfile_out zapfile;
704 struct coda_zapdir_out zapdir;
705 struct coda_purgefid_out purgefid;
706 struct coda_replace_out replace;
707};
708
709
710
711
712
713
714#define PIOCPARM_MASK 0x0000ffff
715struct ViceIoctl {
716 void __user *in;
717 void __user *out;
718 u_short in_size;
719 u_short out_size;
720};
721
722struct PioctlData {
723 const char __user *path;
724 int follow;
725 struct ViceIoctl vi;
726};
727
728#define CODA_CONTROL ".CONTROL"
729#define CODA_CONTROLLEN 8
730#define CTL_INO -1
731
732
733
734#define CODA_MOUNT_VERSION 1
735
736struct coda_mount_data {
737 int version;
738 int fd;
739};
740
741#endif
742