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