0001
0002
0003
0004
0005
0006
0007
0008
0009
0010
0011
0012
0013
0014
0015
0016
0017
0018
0019
0020
0021
0022
0023
0024
0025
0026
0027
0028
0029
0030
0031
0032
0033
0034
0035
0036
0037
0038
0039
0040
0041
0042
0043
0044
0045
0046
0047
0048
0049
0050
0051
0052
0053
0054
0055
0056
0057
0058
0059 #ifndef _UAPI_CODA_HEADER_
0060 #define _UAPI_CODA_HEADER_
0061
0062
0063
0064 #if defined(__NetBSD__) || \
0065 ((defined(DJGPP) || defined(__CYGWIN32__)) && !defined(KERNEL))
0066 #include <sys/types.h>
0067 #endif
0068
0069 #ifndef CODA_MAXSYMLINKS
0070 #define CODA_MAXSYMLINKS 10
0071 #endif
0072
0073 #if defined(DJGPP) || defined(__CYGWIN32__)
0074 #ifdef KERNEL
0075 typedef unsigned long u_long;
0076 typedef unsigned int u_int;
0077 typedef unsigned short u_short;
0078 typedef u_long ino_t;
0079 typedef u_long dev_t;
0080 typedef void * caddr_t;
0081 #ifdef DOS
0082 typedef unsigned __int64 u_quad_t;
0083 #else
0084 typedef unsigned long long u_quad_t;
0085 #endif
0086
0087 #define inline
0088
0089 #else
0090 #include <sys/time.h>
0091 typedef unsigned long long u_quad_t;
0092 #endif
0093 #endif
0094
0095
0096 #if defined(__linux__)
0097 #include <linux/time.h>
0098 #define cdev_t u_quad_t
0099 #ifndef __KERNEL__
0100 #if !defined(_UQUAD_T_) && (!defined(__GLIBC__) || __GLIBC__ < 2)
0101 #define _UQUAD_T_ 1
0102 typedef unsigned long long u_quad_t;
0103 #endif
0104 #endif
0105 #else
0106 #define cdev_t dev_t
0107 #endif
0108
0109 #ifndef __BIT_TYPES_DEFINED__
0110 #define __BIT_TYPES_DEFINED__
0111 typedef signed char int8_t;
0112 typedef unsigned char u_int8_t;
0113 typedef short int16_t;
0114 typedef unsigned short u_int16_t;
0115 typedef int int32_t;
0116 typedef unsigned int u_int32_t;
0117 #endif
0118
0119
0120
0121
0122
0123 #define CODA_MAXNAMLEN 255
0124 #define CODA_MAXPATHLEN 1024
0125 #define CODA_MAXSYMLINK 10
0126
0127
0128
0129
0130 #define C_O_READ 0x001
0131 #define C_O_WRITE 0x002
0132 #define C_O_TRUNC 0x010
0133 #define C_O_EXCL 0x100
0134 #define C_O_CREAT 0x200
0135
0136
0137 #define C_M_READ 00400
0138 #define C_M_WRITE 00200
0139
0140
0141 #define C_A_C_OK 8
0142 #define C_A_R_OK 4
0143 #define C_A_W_OK 2
0144 #define C_A_X_OK 1
0145 #define C_A_F_OK 0
0146
0147
0148
0149 #ifndef _VENUS_DIRENT_T_
0150 #define _VENUS_DIRENT_T_ 1
0151 struct venus_dirent {
0152 u_int32_t d_fileno;
0153 u_int16_t d_reclen;
0154 u_int8_t d_type;
0155 u_int8_t d_namlen;
0156 char d_name[CODA_MAXNAMLEN + 1];
0157 };
0158 #undef DIRSIZ
0159 #define DIRSIZ(dp) ((sizeof (struct venus_dirent) - (CODA_MAXNAMLEN+1)) + \
0160 (((dp)->d_namlen+1 + 3) &~ 3))
0161
0162
0163
0164
0165 #define CDT_UNKNOWN 0
0166 #define CDT_FIFO 1
0167 #define CDT_CHR 2
0168 #define CDT_DIR 4
0169 #define CDT_BLK 6
0170 #define CDT_REG 8
0171 #define CDT_LNK 10
0172 #define CDT_SOCK 12
0173 #define CDT_WHT 14
0174
0175
0176
0177
0178 #define IFTOCDT(mode) (((mode) & 0170000) >> 12)
0179 #define CDTTOIF(dirtype) ((dirtype) << 12)
0180
0181 #endif
0182
0183 #ifndef _VUID_T_
0184 #define _VUID_T_
0185 typedef u_int32_t vuid_t;
0186 typedef u_int32_t vgid_t;
0187 #endif
0188
0189 struct CodaFid {
0190 u_int32_t opaque[4];
0191 };
0192
0193 #define coda_f2i(fid)\
0194 (fid ? (fid->opaque[3] ^ (fid->opaque[2]<<10) ^ (fid->opaque[1]<<20) ^ fid->opaque[0]) : 0)
0195
0196 #ifndef _VENUS_VATTR_T_
0197 #define _VENUS_VATTR_T_
0198
0199
0200
0201 enum coda_vtype { C_VNON, C_VREG, C_VDIR, C_VBLK, C_VCHR, C_VLNK, C_VSOCK, C_VFIFO, C_VBAD };
0202
0203 struct coda_timespec {
0204 int64_t tv_sec;
0205 long tv_nsec;
0206 };
0207
0208 struct coda_vattr {
0209 long va_type;
0210 u_short va_mode;
0211 short va_nlink;
0212 vuid_t va_uid;
0213 vgid_t va_gid;
0214 long va_fileid;
0215 u_quad_t va_size;
0216 long va_blocksize;
0217 struct coda_timespec va_atime;
0218 struct coda_timespec va_mtime;
0219 struct coda_timespec va_ctime;
0220 u_long va_gen;
0221 u_long va_flags;
0222 cdev_t va_rdev;
0223 u_quad_t va_bytes;
0224 u_quad_t va_filerev;
0225 };
0226
0227 #endif
0228
0229
0230 struct coda_statfs {
0231 int32_t f_blocks;
0232 int32_t f_bfree;
0233 int32_t f_bavail;
0234 int32_t f_files;
0235 int32_t f_ffree;
0236 };
0237
0238
0239
0240
0241
0242 #define CODA_ROOT 2
0243 #define CODA_OPEN_BY_FD 3
0244 #define CODA_OPEN 4
0245 #define CODA_CLOSE 5
0246 #define CODA_IOCTL 6
0247 #define CODA_GETATTR 7
0248 #define CODA_SETATTR 8
0249 #define CODA_ACCESS 9
0250 #define CODA_LOOKUP 10
0251 #define CODA_CREATE 11
0252 #define CODA_REMOVE 12
0253 #define CODA_LINK 13
0254 #define CODA_RENAME 14
0255 #define CODA_MKDIR 15
0256 #define CODA_RMDIR 16
0257 #define CODA_SYMLINK 18
0258 #define CODA_READLINK 19
0259 #define CODA_FSYNC 20
0260 #define CODA_VGET 22
0261 #define CODA_SIGNAL 23
0262 #define CODA_REPLACE 24
0263 #define CODA_FLUSH 25
0264 #define CODA_PURGEUSER 26
0265 #define CODA_ZAPFILE 27
0266 #define CODA_ZAPDIR 28
0267 #define CODA_PURGEFID 30
0268 #define CODA_OPEN_BY_PATH 31
0269 #define CODA_RESOLVE 32
0270 #define CODA_REINTEGRATE 33
0271 #define CODA_STATFS 34
0272 #define CODA_STORE 35
0273 #define CODA_RELEASE 36
0274 #define CODA_ACCESS_INTENT 37
0275 #define CODA_NCALLS 38
0276
0277 #define DOWNCALL(opcode) (opcode >= CODA_REPLACE && opcode <= CODA_PURGEFID)
0278
0279 #define VC_MAXDATASIZE 8192
0280 #define VC_MAXMSGSIZE sizeof(union inputArgs)+sizeof(union outputArgs) +\
0281 VC_MAXDATASIZE
0282
0283 #define CIOC_KERNEL_VERSION _IOWR('c', 10, size_t)
0284
0285
0286
0287
0288
0289
0290 #define CODA_KERNEL_VERSION 5
0291
0292
0293
0294
0295 struct coda_in_hdr {
0296 u_int32_t opcode;
0297 u_int32_t unique;
0298 __kernel_pid_t pid;
0299 __kernel_pid_t pgid;
0300 vuid_t uid;
0301 };
0302
0303
0304 struct coda_out_hdr {
0305 u_int32_t opcode;
0306 u_int32_t unique;
0307 u_int32_t result;
0308 };
0309
0310
0311 struct coda_root_out {
0312 struct coda_out_hdr oh;
0313 struct CodaFid VFid;
0314 };
0315
0316 struct coda_root_in {
0317 struct coda_in_hdr in;
0318 };
0319
0320
0321 struct coda_open_in {
0322 struct coda_in_hdr ih;
0323 struct CodaFid VFid;
0324 int flags;
0325 };
0326
0327 struct coda_open_out {
0328 struct coda_out_hdr oh;
0329 cdev_t dev;
0330 ino_t inode;
0331 };
0332
0333
0334
0335 struct coda_store_in {
0336 struct coda_in_hdr ih;
0337 struct CodaFid VFid;
0338 int flags;
0339 };
0340
0341 struct coda_store_out {
0342 struct coda_out_hdr out;
0343 };
0344
0345
0346 struct coda_release_in {
0347 struct coda_in_hdr ih;
0348 struct CodaFid VFid;
0349 int flags;
0350 };
0351
0352 struct coda_release_out {
0353 struct coda_out_hdr out;
0354 };
0355
0356
0357 struct coda_close_in {
0358 struct coda_in_hdr ih;
0359 struct CodaFid VFid;
0360 int flags;
0361 };
0362
0363 struct coda_close_out {
0364 struct coda_out_hdr out;
0365 };
0366
0367
0368 struct coda_ioctl_in {
0369 struct coda_in_hdr ih;
0370 struct CodaFid VFid;
0371 int cmd;
0372 int len;
0373 int rwflag;
0374 char *data;
0375 };
0376
0377 struct coda_ioctl_out {
0378 struct coda_out_hdr oh;
0379 int len;
0380 caddr_t data;
0381 };
0382
0383
0384
0385 struct coda_getattr_in {
0386 struct coda_in_hdr ih;
0387 struct CodaFid VFid;
0388 };
0389
0390 struct coda_getattr_out {
0391 struct coda_out_hdr oh;
0392 struct coda_vattr attr;
0393 };
0394
0395
0396
0397 struct coda_setattr_in {
0398 struct coda_in_hdr ih;
0399 struct CodaFid VFid;
0400 struct coda_vattr attr;
0401 };
0402
0403 struct coda_setattr_out {
0404 struct coda_out_hdr out;
0405 };
0406
0407
0408 struct coda_access_in {
0409 struct coda_in_hdr ih;
0410 struct CodaFid VFid;
0411 int flags;
0412 };
0413
0414 struct coda_access_out {
0415 struct coda_out_hdr out;
0416 };
0417
0418
0419
0420 #define CLU_CASE_SENSITIVE 0x01
0421 #define CLU_CASE_INSENSITIVE 0x02
0422
0423
0424 struct coda_lookup_in {
0425 struct coda_in_hdr ih;
0426 struct CodaFid VFid;
0427 int name;
0428 int flags;
0429 };
0430
0431 struct coda_lookup_out {
0432 struct coda_out_hdr oh;
0433 struct CodaFid VFid;
0434 int vtype;
0435 };
0436
0437
0438
0439 struct coda_create_in {
0440 struct coda_in_hdr ih;
0441 struct CodaFid VFid;
0442 struct coda_vattr attr;
0443 int excl;
0444 int mode;
0445 int name;
0446 };
0447
0448 struct coda_create_out {
0449 struct coda_out_hdr oh;
0450 struct CodaFid VFid;
0451 struct coda_vattr attr;
0452 };
0453
0454
0455
0456 struct coda_remove_in {
0457 struct coda_in_hdr ih;
0458 struct CodaFid VFid;
0459 int name;
0460 };
0461
0462 struct coda_remove_out {
0463 struct coda_out_hdr out;
0464 };
0465
0466
0467 struct coda_link_in {
0468 struct coda_in_hdr ih;
0469 struct CodaFid sourceFid;
0470 struct CodaFid destFid;
0471 int tname;
0472 };
0473
0474 struct coda_link_out {
0475 struct coda_out_hdr out;
0476 };
0477
0478
0479
0480 struct coda_rename_in {
0481 struct coda_in_hdr ih;
0482 struct CodaFid sourceFid;
0483 int srcname;
0484 struct CodaFid destFid;
0485 int destname;
0486 };
0487
0488 struct coda_rename_out {
0489 struct coda_out_hdr out;
0490 };
0491
0492
0493 struct coda_mkdir_in {
0494 struct coda_in_hdr ih;
0495 struct CodaFid VFid;
0496 struct coda_vattr attr;
0497 int name;
0498 };
0499
0500 struct coda_mkdir_out {
0501 struct coda_out_hdr oh;
0502 struct CodaFid VFid;
0503 struct coda_vattr attr;
0504 };
0505
0506
0507
0508 struct coda_rmdir_in {
0509 struct coda_in_hdr ih;
0510 struct CodaFid VFid;
0511 int name;
0512 };
0513
0514 struct coda_rmdir_out {
0515 struct coda_out_hdr out;
0516 };
0517
0518
0519 struct coda_symlink_in {
0520 struct coda_in_hdr ih;
0521 struct CodaFid VFid;
0522 int srcname;
0523 struct coda_vattr attr;
0524 int tname;
0525 };
0526
0527 struct coda_symlink_out {
0528 struct coda_out_hdr out;
0529 };
0530
0531
0532 struct coda_readlink_in {
0533 struct coda_in_hdr ih;
0534 struct CodaFid VFid;
0535 };
0536
0537 struct coda_readlink_out {
0538 struct coda_out_hdr oh;
0539 int count;
0540 caddr_t data;
0541 };
0542
0543
0544
0545 struct coda_fsync_in {
0546 struct coda_in_hdr ih;
0547 struct CodaFid VFid;
0548 };
0549
0550 struct coda_fsync_out {
0551 struct coda_out_hdr out;
0552 };
0553
0554
0555 struct coda_vget_in {
0556 struct coda_in_hdr ih;
0557 struct CodaFid VFid;
0558 };
0559
0560 struct coda_vget_out {
0561 struct coda_out_hdr oh;
0562 struct CodaFid VFid;
0563 int vtype;
0564 };
0565
0566
0567
0568
0569
0570
0571
0572
0573 struct coda_purgeuser_out {
0574 struct coda_out_hdr oh;
0575 vuid_t uid;
0576 };
0577
0578
0579
0580 struct coda_zapfile_out {
0581 struct coda_out_hdr oh;
0582 struct CodaFid CodaFid;
0583 };
0584
0585
0586
0587 struct coda_zapdir_out {
0588 struct coda_out_hdr oh;
0589 struct CodaFid CodaFid;
0590 };
0591
0592
0593
0594 struct coda_purgefid_out {
0595 struct coda_out_hdr oh;
0596 struct CodaFid CodaFid;
0597 };
0598
0599
0600
0601 struct coda_replace_out {
0602 struct coda_out_hdr oh;
0603 struct CodaFid NewFid;
0604 struct CodaFid OldFid;
0605 };
0606
0607
0608 struct coda_open_by_fd_in {
0609 struct coda_in_hdr ih;
0610 struct CodaFid VFid;
0611 int flags;
0612 };
0613
0614 struct coda_open_by_fd_out {
0615 struct coda_out_hdr oh;
0616 int fd;
0617
0618 #ifdef __KERNEL__
0619 struct file *fh;
0620 #endif
0621 };
0622
0623
0624 struct coda_open_by_path_in {
0625 struct coda_in_hdr ih;
0626 struct CodaFid VFid;
0627 int flags;
0628 };
0629
0630 struct coda_open_by_path_out {
0631 struct coda_out_hdr oh;
0632 int path;
0633 };
0634
0635
0636 struct coda_statfs_in {
0637 struct coda_in_hdr in;
0638 };
0639
0640 struct coda_statfs_out {
0641 struct coda_out_hdr oh;
0642 struct coda_statfs stat;
0643 };
0644
0645 #define CODA_ACCESS_TYPE_READ 1
0646 #define CODA_ACCESS_TYPE_WRITE 2
0647 #define CODA_ACCESS_TYPE_MMAP 3
0648 #define CODA_ACCESS_TYPE_READ_FINISH 4
0649 #define CODA_ACCESS_TYPE_WRITE_FINISH 5
0650
0651
0652 struct coda_access_intent_in {
0653 struct coda_in_hdr ih;
0654 struct CodaFid VFid;
0655 int count;
0656 int pos;
0657 int type;
0658 };
0659
0660 struct coda_access_intent_out {
0661 struct coda_out_hdr out;
0662 };
0663
0664
0665
0666
0667
0668
0669 #define CODA_NOCACHE 0x80000000
0670
0671 union inputArgs {
0672 struct coda_in_hdr ih;
0673 struct coda_open_in coda_open;
0674 struct coda_store_in coda_store;
0675 struct coda_release_in coda_release;
0676 struct coda_close_in coda_close;
0677 struct coda_ioctl_in coda_ioctl;
0678 struct coda_getattr_in coda_getattr;
0679 struct coda_setattr_in coda_setattr;
0680 struct coda_access_in coda_access;
0681 struct coda_lookup_in coda_lookup;
0682 struct coda_create_in coda_create;
0683 struct coda_remove_in coda_remove;
0684 struct coda_link_in coda_link;
0685 struct coda_rename_in coda_rename;
0686 struct coda_mkdir_in coda_mkdir;
0687 struct coda_rmdir_in coda_rmdir;
0688 struct coda_symlink_in coda_symlink;
0689 struct coda_readlink_in coda_readlink;
0690 struct coda_fsync_in coda_fsync;
0691 struct coda_vget_in coda_vget;
0692 struct coda_open_by_fd_in coda_open_by_fd;
0693 struct coda_open_by_path_in coda_open_by_path;
0694 struct coda_statfs_in coda_statfs;
0695 struct coda_access_intent_in coda_access_intent;
0696 };
0697
0698 union outputArgs {
0699 struct coda_out_hdr oh;
0700 struct coda_root_out coda_root;
0701 struct coda_open_out coda_open;
0702 struct coda_ioctl_out coda_ioctl;
0703 struct coda_getattr_out coda_getattr;
0704 struct coda_lookup_out coda_lookup;
0705 struct coda_create_out coda_create;
0706 struct coda_mkdir_out coda_mkdir;
0707 struct coda_readlink_out coda_readlink;
0708 struct coda_vget_out coda_vget;
0709 struct coda_purgeuser_out coda_purgeuser;
0710 struct coda_zapfile_out coda_zapfile;
0711 struct coda_zapdir_out coda_zapdir;
0712 struct coda_purgefid_out coda_purgefid;
0713 struct coda_replace_out coda_replace;
0714 struct coda_open_by_fd_out coda_open_by_fd;
0715 struct coda_open_by_path_out coda_open_by_path;
0716 struct coda_statfs_out coda_statfs;
0717 };
0718
0719 union coda_downcalls {
0720
0721
0722 struct coda_purgeuser_out purgeuser;
0723 struct coda_zapfile_out zapfile;
0724 struct coda_zapdir_out zapdir;
0725 struct coda_purgefid_out purgefid;
0726 struct coda_replace_out replace;
0727 };
0728
0729
0730
0731
0732
0733
0734 #define PIOCPARM_MASK 0x0000ffff
0735 struct ViceIoctl {
0736 void __user *in;
0737 void __user *out;
0738 u_short in_size;
0739 u_short out_size;
0740 };
0741
0742 struct PioctlData {
0743 const char __user *path;
0744 int follow;
0745 struct ViceIoctl vi;
0746 };
0747
0748 #define CODA_CONTROL ".CONTROL"
0749 #define CODA_CONTROLLEN 8
0750 #define CTL_INO -1
0751
0752
0753
0754 #define CODA_MOUNT_VERSION 1
0755
0756 struct coda_mount_data {
0757 int version;
0758 int fd;
0759 };
0760
0761 #endif