require '_h2ph_pre.ph';

unless(defined(&_CODA_HEADER_)) {
    eval 'sub _CODA_HEADER_ () {1;}' unless defined(&_CODA_HEADER_);
    if(defined( &__NetBSD__) || ((defined( &DJGPP) || defined( &__CYGWIN32__))  && !defined( &KERNEL))) {
	require 'sys/types.ph';
    }
    unless(defined(&CODA_MAXSYMLINKS)) {
	eval 'sub CODA_MAXSYMLINKS () {10;}' unless defined(&CODA_MAXSYMLINKS);
    }
    if(defined( &DJGPP) || defined( &__CYGWIN32__)) {
	if(defined(&KERNEL)) {
	    if(defined(&DOS)) {
	    } else {
	    }
	    eval 'sub inline () {1;}' unless defined(&inline);
	} else {
	    require 'sys/time.ph';
	}
    }
    if(defined( &__linux__)) {
	eval 'sub cdev_t () { &u_quad_t;}' unless defined(&cdev_t);
	if(!defined( &_UQUAD_T_)  && (!defined( &__GLIBC__) || (defined(&__GLIBC__) ? &__GLIBC__ : 0) < 2)) {
	    eval 'sub _UQUAD_T_ () {1;}' unless defined(&_UQUAD_T_);
	}
    } else {
	eval 'sub cdev_t () { &dev_t;}' unless defined(&cdev_t);
    }
    if(defined(&__CYGWIN32__)) {
    }
    unless(defined(&__BIT_TYPES_DEFINED__)) {
	eval 'sub __BIT_TYPES_DEFINED__ () {1;}' unless defined(&__BIT_TYPES_DEFINED__);
    }
    eval 'sub CODA_MAXNAMLEN () {255;}' unless defined(&CODA_MAXNAMLEN);
    eval 'sub CODA_MAXPATHLEN () {1024;}' unless defined(&CODA_MAXPATHLEN);
    eval 'sub CODA_MAXSYMLINK () {10;}' unless defined(&CODA_MAXSYMLINK);
    eval 'sub C_O_READ () {0x1;}' unless defined(&C_O_READ);
    eval 'sub C_O_WRITE () {0x2;}' unless defined(&C_O_WRITE);
    eval 'sub C_O_TRUNC () {0x10;}' unless defined(&C_O_TRUNC);
    eval 'sub C_O_EXCL () {0x100;}' unless defined(&C_O_EXCL);
    eval 'sub C_O_CREAT () {0x200;}' unless defined(&C_O_CREAT);
    eval 'sub C_M_READ () {00400;}' unless defined(&C_M_READ);
    eval 'sub C_M_WRITE () {00200;}' unless defined(&C_M_WRITE);
    eval 'sub C_A_C_OK () {8;}' unless defined(&C_A_C_OK);
    eval 'sub C_A_R_OK () {4;}' unless defined(&C_A_R_OK);
    eval 'sub C_A_W_OK () {2;}' unless defined(&C_A_W_OK);
    eval 'sub C_A_X_OK () {1;}' unless defined(&C_A_X_OK);
    eval 'sub C_A_F_OK () {0;}' unless defined(&C_A_F_OK);
    unless(defined(&_VENUS_DIRENT_T_)) {
	eval 'sub _VENUS_DIRENT_T_ () {1;}' unless defined(&_VENUS_DIRENT_T_);
	undef(&DIRSIZ) if defined(&DIRSIZ);
	eval 'sub DIRSIZ {
	    local($dp) = @_;
    	    eval q((($sizeof{\'struct venus_dirent\'} - ( &CODA_MAXNAMLEN+1)) + ((($dp)-> &d_namlen+1+ 3) &~ 3)));
	}' unless defined(&DIRSIZ);
	eval 'sub CDT_UNKNOWN () {0;}' unless defined(&CDT_UNKNOWN);
	eval 'sub CDT_FIFO () {1;}' unless defined(&CDT_FIFO);
	eval 'sub CDT_CHR () {2;}' unless defined(&CDT_CHR);
	eval 'sub CDT_DIR () {4;}' unless defined(&CDT_DIR);
	eval 'sub CDT_BLK () {6;}' unless defined(&CDT_BLK);
	eval 'sub CDT_REG () {8;}' unless defined(&CDT_REG);
	eval 'sub CDT_LNK () {10;}' unless defined(&CDT_LNK);
	eval 'sub CDT_SOCK () {12;}' unless defined(&CDT_SOCK);
	eval 'sub CDT_WHT () {14;}' unless defined(&CDT_WHT);
	eval 'sub IFTOCDT {
	    local($mode) = @_;
    	    eval q(((($mode) & 0170000) >> 12));
	}' unless defined(&IFTOCDT);
	eval 'sub CDTTOIF {
	    local($dirtype) = @_;
    	    eval q((($dirtype) << 12));
	}' unless defined(&CDTTOIF);
    }
    unless(defined(&_FID_T_)) {
	eval 'sub _FID_T_ () {1;}' unless defined(&_FID_T_);
    }
    unless(defined(&_VICEFID_T_)) {
	eval 'sub _VICEFID_T_ () {1;}' unless defined(&_VICEFID_T_);
    }
    if(defined(&__linux__)) {
    } else {
	eval 'sub coda_f2i {
	    local($fid) = @_;
    	    eval q((($fid) ? (($fid)-> &Unique + (($fid)-> &Vnode<<10) + (($fid)-> &Volume<<20)) : 0));
	}' unless defined(&coda_f2i);
    }
    unless(defined(&_VUID_T_)) {
	eval 'sub _VUID_T_ () {1;}' unless defined(&_VUID_T_);
    }
    unless(defined(&_CODACRED_T_)) {
	eval 'sub _CODACRED_T_ () {1;}' unless defined(&_CODACRED_T_);
    }
    unless(defined(&_VENUS_VATTR_T_)) {
	eval 'sub _VENUS_VATTR_T_ () {1;}' unless defined(&_VENUS_VATTR_T_);
	eval("sub C_VNON () { 0; }") unless defined(&C_VNON);
	eval("sub C_VREG () { 1; }") unless defined(&C_VREG);
	eval("sub C_VDIR () { 2; }") unless defined(&C_VDIR);
	eval("sub C_VBLK () { 3; }") unless defined(&C_VBLK);
	eval("sub C_VCHR () { 4; }") unless defined(&C_VCHR);
	eval("sub C_VLNK () { 5; }") unless defined(&C_VLNK);
	eval("sub C_VSOCK () { 6; }") unless defined(&C_VSOCK);
	eval("sub C_VFIFO () { 7; }") unless defined(&C_VFIFO);
	eval("sub C_VBAD () { 8; }") unless defined(&C_VBAD);
    }
    eval 'sub CODA_ROOT () {2;}' unless defined(&CODA_ROOT);
    eval 'sub CODA_OPEN_BY_FD () {3;}' unless defined(&CODA_OPEN_BY_FD);
    eval 'sub CODA_OPEN () {4;}' unless defined(&CODA_OPEN);
    eval 'sub CODA_CLOSE () {5;}' unless defined(&CODA_CLOSE);
    eval 'sub CODA_IOCTL () {6;}' unless defined(&CODA_IOCTL);
    eval 'sub CODA_GETATTR () {7;}' unless defined(&CODA_GETATTR);
    eval 'sub CODA_SETATTR () {8;}' unless defined(&CODA_SETATTR);
    eval 'sub CODA_ACCESS () {9;}' unless defined(&CODA_ACCESS);
    eval 'sub CODA_LOOKUP () {10;}' unless defined(&CODA_LOOKUP);
    eval 'sub CODA_CREATE () {11;}' unless defined(&CODA_CREATE);
    eval 'sub CODA_REMOVE () {12;}' unless defined(&CODA_REMOVE);
    eval 'sub CODA_LINK () {13;}' unless defined(&CODA_LINK);
    eval 'sub CODA_RENAME () {14;}' unless defined(&CODA_RENAME);
    eval 'sub CODA_MKDIR () {15;}' unless defined(&CODA_MKDIR);
    eval 'sub CODA_RMDIR () {16;}' unless defined(&CODA_RMDIR);
    eval 'sub CODA_SYMLINK () {18;}' unless defined(&CODA_SYMLINK);
    eval 'sub CODA_READLINK () {19;}' unless defined(&CODA_READLINK);
    eval 'sub CODA_FSYNC () {20;}' unless defined(&CODA_FSYNC);
    eval 'sub CODA_VGET () {22;}' unless defined(&CODA_VGET);
    eval 'sub CODA_SIGNAL () {23;}' unless defined(&CODA_SIGNAL);
    eval 'sub CODA_REPLACE () {24;}' unless defined(&CODA_REPLACE);
    eval 'sub CODA_FLUSH () {25;}' unless defined(&CODA_FLUSH);
    eval 'sub CODA_PURGEUSER () {26;}' unless defined(&CODA_PURGEUSER);
    eval 'sub CODA_ZAPFILE () {27;}' unless defined(&CODA_ZAPFILE);
    eval 'sub CODA_ZAPDIR () {28;}' unless defined(&CODA_ZAPDIR);
    eval 'sub CODA_PURGEFID () {30;}' unless defined(&CODA_PURGEFID);
    eval 'sub CODA_OPEN_BY_PATH () {31;}' unless defined(&CODA_OPEN_BY_PATH);
    eval 'sub CODA_RESOLVE () {32;}' unless defined(&CODA_RESOLVE);
    eval 'sub CODA_REINTEGRATE () {33;}' unless defined(&CODA_REINTEGRATE);
    eval 'sub CODA_STATFS () {34;}' unless defined(&CODA_STATFS);
    eval 'sub CODA_STORE () {35;}' unless defined(&CODA_STORE);
    eval 'sub CODA_RELEASE () {36;}' unless defined(&CODA_RELEASE);
    eval 'sub CODA_NCALLS () {37;}' unless defined(&CODA_NCALLS);
    eval 'sub DOWNCALL {
        local($opcode) = @_;
	    eval q(($opcode >=  &CODA_REPLACE  && $opcode <=  &CODA_PURGEFID));
    }' unless defined(&DOWNCALL);
    eval 'sub VC_MAXDATASIZE () {8192;}' unless defined(&VC_MAXDATASIZE);
    eval 'sub VC_MAXMSGSIZE () {$sizeof{\'union inputArgs\'}+$sizeof{\'union outputArgs\'} +  &VC_MAXDATASIZE;}' unless defined(&VC_MAXMSGSIZE);
    eval 'sub CIOC_KERNEL_VERSION () { &_IOWR(ord(\'c\'), 10, $sizeof{\'int\'});}' unless defined(&CIOC_KERNEL_VERSION);
    if(0) {
	eval 'sub CODA_KERNEL_VERSION () {0;}' unless defined(&CODA_KERNEL_VERSION);
	eval 'sub CODA_KERNEL_VERSION () {1;}' unless defined(&CODA_KERNEL_VERSION);
    }
    eval 'sub CODA_KERNEL_VERSION () {2;}' unless defined(&CODA_KERNEL_VERSION);
    eval 'sub CLU_CASE_SENSITIVE () {0x1;}' unless defined(&CLU_CASE_SENSITIVE);
    eval 'sub CLU_CASE_INSENSITIVE () {0x2;}' unless defined(&CLU_CASE_INSENSITIVE);
    eval 'sub CODA_NOCACHE () {0x80000000;}' unless defined(&CODA_NOCACHE);
    eval 'sub PIOCPARM_MASK () {0xffff;}' unless defined(&PIOCPARM_MASK);
    eval 'sub CODA_CONTROL () {".CONTROL";}' unless defined(&CODA_CONTROL);
    eval 'sub CODA_CONTROLLEN () {8;}' unless defined(&CODA_CONTROLLEN);
    eval 'sub CTL_VOL () {-1;}' unless defined(&CTL_VOL);
    eval 'sub CTL_VNO () {-1;}' unless defined(&CTL_VNO);
    eval 'sub CTL_UNI () {-1;}' unless defined(&CTL_UNI);
    eval 'sub CTL_INO () {-1;}' unless defined(&CTL_INO);
    eval 'sub CTL_FILE () {"/coda/.CONTROL";}' unless defined(&CTL_FILE);
    eval 'sub IS_CTL_FID {
        local($fidp) = @_;
	    eval q((($fidp)-> &Volume ==  &CTL_VOL  && ($fidp)-> &Vnode ==  &CTL_VNO  && ($fidp)-> &Unique ==  &CTL_UNI));
    }' unless defined(&IS_CTL_FID);
    eval 'sub CODA_MOUNT_VERSION () {1;}' unless defined(&CODA_MOUNT_VERSION);
}
1;
