require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_NTFS_NTFS_H_)) {
    eval 'sub _NTFS_NTFS_H_ () {1;}' unless defined(&_NTFS_NTFS_H_);
    if(defined(&_KERNEL_OPT)) {
	require './ntfs/opt_ntfs.ph';
    }
    eval 'sub BBSIZE () {1024;}' unless defined(&BBSIZE);
    eval 'sub BBOFF () {(( &off_t)(0));}' unless defined(&BBOFF);
    eval 'sub BBLOCK () {(( &daddr_t)(0));}' unless defined(&BBLOCK);
    eval 'sub NTFS_MFTINO () {0;}' unless defined(&NTFS_MFTINO);
    eval 'sub NTFS_VOLUMEINO () {3;}' unless defined(&NTFS_VOLUMEINO);
    eval 'sub NTFS_ATTRDEFINO () {4;}' unless defined(&NTFS_ATTRDEFINO);
    eval 'sub NTFS_ROOTINO () {5;}' unless defined(&NTFS_ROOTINO);
    eval 'sub NTFS_BITMAPINO () {6;}' unless defined(&NTFS_BITMAPINO);
    eval 'sub NTFS_BOOTINO () {7;}' unless defined(&NTFS_BOOTINO);
    eval 'sub NTFS_BADCLUSINO () {8;}' unless defined(&NTFS_BADCLUSINO);
    eval 'sub NTFS_UPCASEINO () {10;}' unless defined(&NTFS_UPCASEINO);
    eval 'sub NTFS_MAXFILENAME () {255;}' unless defined(&NTFS_MAXFILENAME);
    eval 'sub NTFS_AF_INRUN () {0x1;}' unless defined(&NTFS_AF_INRUN);
    eval 'sub NTFS_A_STD () {0x10;}' unless defined(&NTFS_A_STD);
    eval 'sub NTFS_A_ATTRLIST () {0x20;}' unless defined(&NTFS_A_ATTRLIST);
    eval 'sub NTFS_A_NAME () {0x30;}' unless defined(&NTFS_A_NAME);
    eval 'sub NTFS_A_VOLUMENAME () {0x60;}' unless defined(&NTFS_A_VOLUMENAME);
    eval 'sub NTFS_A_DATA () {0x80;}' unless defined(&NTFS_A_DATA);
    eval 'sub NTFS_A_INDXROOT () {0x90;}' unless defined(&NTFS_A_INDXROOT);
    eval 'sub NTFS_A_INDX () {0xa0;}' unless defined(&NTFS_A_INDX);
    eval 'sub NTFS_A_INDXBITMAP () {0xb0;}' unless defined(&NTFS_A_INDXBITMAP);
    eval 'sub NTFS_MAXATTRNAME () {255;}' unless defined(&NTFS_MAXATTRNAME);
    eval 'sub a_r () { ($a_S->{a_S_r});}' unless defined(&a_r);
    eval 'sub a_nr () { ($a_S->{a_S_nr});}' unless defined(&a_nr);
    eval 'sub NTFS_FFLAG_RDONLY () {0x1;}' unless defined(&NTFS_FFLAG_RDONLY);
    eval 'sub NTFS_FFLAG_HIDDEN () {0x2;}' unless defined(&NTFS_FFLAG_HIDDEN);
    eval 'sub NTFS_FFLAG_SYSTEM () {0x4;}' unless defined(&NTFS_FFLAG_SYSTEM);
    eval 'sub NTFS_FFLAG_ARCHIVE () {0x20;}' unless defined(&NTFS_FFLAG_ARCHIVE);
    eval 'sub NTFS_FFLAG_COMPRESSED () {0x800;}' unless defined(&NTFS_FFLAG_COMPRESSED);
    eval 'sub NTFS_FFLAG_DIR () {0x10000000;}' unless defined(&NTFS_FFLAG_DIR);
    eval 'sub NTFS_IRFLAG_INDXALLOC () {0x1;}' unless defined(&NTFS_IRFLAG_INDXALLOC);
    eval 'sub NTFS_INDXMAGIC () {( &u_int32_t)(0x58444e49);}' unless defined(&NTFS_INDXMAGIC);
    eval 'sub NTFS_IEFLAG_SUBNODE () {0x1;}' unless defined(&NTFS_IEFLAG_SUBNODE);
    eval 'sub NTFS_IEFLAG_LAST () {0x2;}' unless defined(&NTFS_IEFLAG_LAST);
    eval 'sub NTFS_FILEMAGIC () {( &u_int32_t)(0x454c4946);}' unless defined(&NTFS_FILEMAGIC);
    eval 'sub NTFS_FRFLAG_DIR () {0x2;}' unless defined(&NTFS_FRFLAG_DIR);
    eval 'sub NTFS_ATTRNAME_MAXLEN () {0x40;}' unless defined(&NTFS_ATTRNAME_MAXLEN);
    eval 'sub NTFS_ADFLAG_NONRES () {0x80;}' unless defined(&NTFS_ADFLAG_NONRES);
    eval 'sub NTFS_ADFLAG_INDEX () {0x2;}' unless defined(&NTFS_ADFLAG_INDEX);
    eval 'sub NTFS_BBID () {"NTFS    ";}' unless defined(&NTFS_BBID);
    eval 'sub NTFS_BBIDLEN () {8;}' unless defined(&NTFS_BBIDLEN);
    eval 'sub NTFS_SYSNODESNUM () {0xb;}' unless defined(&NTFS_SYSNODESNUM);
    eval 'sub ntm_mftcn () { ($ntm_bootfile->{bf_mftcn});}' unless defined(&ntm_mftcn);
    eval 'sub ntm_mftmirrcn () { ($ntm_bootfile->{bf_mftmirrcn});}' unless defined(&ntm_mftmirrcn);
    eval 'sub ntm_mftrecsz () { ($ntm_bootfile->{bf_mftrecsz});}' unless defined(&ntm_mftrecsz);
    eval 'sub ntm_spc () { ($ntm_bootfile->{bf_spc});}' unless defined(&ntm_spc);
    eval 'sub ntm_bps () { ($ntm_bootfile->{bf_bps});}' unless defined(&ntm_bps);
    eval 'sub NTFS_NEXTREC {
        my($s, $type) = @_;
	    eval q((($type)(( $s) + ($s)-> &reclen)));
    }' unless defined(&NTFS_NEXTREC);
    eval 'sub VFSTONTFS {
        my($mp) = @_;
	    eval q(((($mp)-> &mnt_data)));
    }' unless defined(&VFSTONTFS);
    eval 'sub VTONT {
        my($v) = @_;
	    eval q( &FTONT( &VTOF($v)));
    }' unless defined(&VTONT);
    eval 'sub VTOF {
        my($v) = @_;
	    eval q(((($v)-> &v_data)));
    }' unless defined(&VTOF);
    eval 'sub FTOV {
        my($f) = @_;
	    eval q((($f)-> &f_vp));
    }' unless defined(&FTOV);
    eval 'sub FTONT {
        my($f) = @_;
	    eval q((($f)-> &f_ip));
    }' unless defined(&FTONT);
    eval 'sub ntfs_cntobn {
        my($cn) = @_;
	    eval q(( &daddr_t)(($cn) * ( ($ntmp->{ntm_spc}))));
    }' unless defined(&ntfs_cntobn);
    eval 'sub ntfs_cntob {
        my($cn) = @_;
	    eval q(( &off_t)(($cn) * ( &ntmp)-> &ntm_spc * ( &ntmp)-> &ntm_bps));
    }' unless defined(&ntfs_cntob);
    eval 'sub ntfs_btocn {
        my($off) = @_;
	    eval q(( &cn_t)(($off) / (( &ntmp)-> &ntm_spc * ( &ntmp)-> &ntm_bps)));
    }' unless defined(&ntfs_btocn);
    eval 'sub ntfs_btocl {
        my($off) = @_;
	    eval q(( &cn_t)(($off +  &ntfs_cntob(1) - 1) / (( &ntmp)-> &ntm_spc * ( &ntmp)-> &ntm_bps)));
    }' unless defined(&ntfs_btocl);
    eval 'sub ntfs_btocnoff {
        my($off) = @_;
	    eval q(( &off_t)(($off) % (( &ntmp)-> &ntm_spc * ( &ntmp)-> &ntm_bps)));
    }' unless defined(&ntfs_btocnoff);
    eval 'sub ntfs_bntob {
        my($bn) = @_;
	    eval q(( &daddr_t)(($bn) * ( &ntmp)-> &ntm_bps));
    }' unless defined(&ntfs_bntob);
    eval 'sub ntfs_bpbl () {( &daddr_t)(( &ntmp)-> &ntm_bps);}' unless defined(&ntfs_bpbl);
    if(defined(&_KERNEL)) {
    }
    eval 'sub HASHINIT {
        my($a, $b, $c, $d) = @_;
	    eval q( &hashinit(($a),  &HASH_LIST, ($b), ($c), ($d)));
    }' unless defined(&HASHINIT);
    eval 'sub bqrelse {
        my($bp) = @_;
	    eval q( &brelse($bp, 0));
    }' unless defined(&bqrelse);
    if(defined(&NTFS_DEBUG)) {
	eval 'sub DPRINTF {
	    my($X, $Y) = @_;
    	    eval q( &do {  &if( &ntfs_debug >= ($X))  &printf $Y; }  &while(0));
	}' unless defined(&DPRINTF);
	eval 'sub dprintf {
	    my($a) = @_;
    	    eval q( &DPRINTF(1, $a));
	}' unless defined(&dprintf);
	eval 'sub ddprintf {
	    my($a) = @_;
    	    eval q( &DPRINTF(2, $a));
	}' unless defined(&ddprintf);
    } else {
	eval 'sub DPRINTF {
	    my($X, $Y) = @_;
    	    eval q();
	}' unless defined(&DPRINTF);
	eval 'sub dprintf {
	    my($a) = @_;
    	    eval q();
	}' unless defined(&dprintf);
	eval 'sub ddprintf {
	    my($a) = @_;
    	    eval q();
	}' unless defined(&ddprintf);
    }
}
1;
