require '_h2ph_pre.ph';

no warnings qw(redefine misc);

unless(defined(&_RF_RAIDFRAMEVAR_H_)) {
    eval 'sub _RF_RAIDFRAMEVAR_H_ () {1;}' unless defined(&_RF_RAIDFRAMEVAR_H_);
    unless(defined(&_STANDALONE)) {
	require 'sys/ioctl.ph';
	require 'sys/errno.ph';
	require 'sys/types.ph';
	require 'sys/uio.ph';
	require 'sys/param.ph';
	require 'sys/proc.ph';
	require 'sys/mallocvar.ph';
    }
    require 'sys/types.ph';
    require 'machine/endian.ph';
    require 'machine/limits.ph';
    if((defined(&BYTE_ORDER) ? &BYTE_ORDER : undef) == (defined(&BIG_ENDIAN) ? &BIG_ENDIAN : undef)) {
	eval 'sub RF_IS_BIG_ENDIAN () {1;}' unless defined(&RF_IS_BIG_ENDIAN);
    }
 elsif((defined(&BYTE_ORDER) ? &BYTE_ORDER : undef) == (defined(&LITTLE_ENDIAN) ? &LITTLE_ENDIAN : undef)) {
	eval 'sub RF_IS_BIG_ENDIAN () {0;}' unless defined(&RF_IS_BIG_ENDIAN);
    } else {
	die("byte\ order\ not\ defined");
    }
    if((defined(&LONG_BIT) ? &LONG_BIT : undef) == 32) {
	eval 'sub RF_LONGSHIFT () {2;}' unless defined(&RF_LONGSHIFT);
    }
 elsif((defined(&LONG_BIT) ? &LONG_BIT : undef) == 64) {
	eval 'sub RF_LONGSHIFT () {3;}' unless defined(&RF_LONGSHIFT);
    } else {
	die("word\ size\ not\ defined");
    }
    eval 'sub RF_TRUE () {1;}' unless defined(&RF_TRUE);
    eval 'sub RF_FALSE () {0;}' unless defined(&RF_FALSE);
    if(defined(&_KERNEL)) {
    }
    eval 'sub RF_DISK_QUEUE_TYPE_NONE () {"";}' unless defined(&RF_DISK_QUEUE_TYPE_NONE);
    eval 'sub RF_RBUF_TYPE_EXCLUSIVE () {0;}' unless defined(&RF_RBUF_TYPE_EXCLUSIVE);
    eval 'sub RF_RBUF_TYPE_FLOATING () {1;}' unless defined(&RF_RBUF_TYPE_FLOATING);
    eval 'sub RF_RBUF_TYPE_FORCED () {2;}' unless defined(&RF_RBUF_TYPE_FORCED);
    eval 'sub RF_IO_TYPE_READ () {ord(\'r\');}' unless defined(&RF_IO_TYPE_READ);
    eval 'sub RF_IO_TYPE_WRITE () {ord(\'w\');}' unless defined(&RF_IO_TYPE_WRITE);
    eval 'sub RF_IO_TYPE_NOP () {ord(\'n\');}' unless defined(&RF_IO_TYPE_NOP);
    eval 'sub RF_IO_IS_R_OR_W {
        my($_type_) = @_;
	    eval q(((($_type_) ==  &RF_IO_TYPE_READ) || (($_type_) ==  &RF_IO_TYPE_WRITE)));
    }' unless defined(&RF_IO_IS_R_OR_W);
    eval 'sub RF_DISKQUEUE_DATA_FLAGS_NONE () {(( &RF_DiskQueueDataFlags_t)0);}' unless defined(&RF_DISKQUEUE_DATA_FLAGS_NONE);
    eval("sub rf_QuiesceState () { 0; }") unless defined(&rf_QuiesceState);
    eval("sub rf_IncrAccessesCountState () { 1; }") unless defined(&rf_IncrAccessesCountState);
    eval("sub rf_MapState () { 2; }") unless defined(&rf_MapState);
    eval("sub rf_LockState () { 3; }") unless defined(&rf_LockState);
    eval("sub rf_CreateDAGState () { 4; }") unless defined(&rf_CreateDAGState);
    eval("sub rf_ExecuteDAGState () { 5; }") unless defined(&rf_ExecuteDAGState);
    eval("sub rf_ProcessDAGState () { 6; }") unless defined(&rf_ProcessDAGState);
    eval("sub rf_CleanupState () { 7; }") unless defined(&rf_CleanupState);
    eval("sub rf_DecrAccessesCountState () { 8; }") unless defined(&rf_DecrAccessesCountState);
    eval("sub rf_LastState () { 9; }") unless defined(&rf_LastState);
    eval 'sub RF_MAXROW () {10;}' unless defined(&RF_MAXROW);
    eval 'sub RF_MAXCOL () {40;}' unless defined(&RF_MAXCOL);
    eval 'sub RF_MAXSPARE () {10;}' unless defined(&RF_MAXSPARE);
    eval 'sub RF_MAXDBGV () {75;}' unless defined(&RF_MAXDBGV);
    eval 'sub RF_MAX_DISKS () {128;}' unless defined(&RF_MAX_DISKS);
    eval 'sub RF_SPAREMAP_NAME_LEN () {128;}' unless defined(&RF_SPAREMAP_NAME_LEN);
    eval 'sub RF_PROTECTED_SECTORS () {64;}' unless defined(&RF_PROTECTED_SECTORS);
    eval 'sub RF_FDFLAGS_NONE () {0x;}' unless defined(&RF_FDFLAGS_NONE);
    eval 'sub RF_FDFLAGS_RECON () {0x1;}' unless defined(&RF_FDFLAGS_RECON);
    eval 'sub RF_FDFLAGS_RECON_FORCE () {0x2;}' unless defined(&RF_FDFLAGS_RECON_FORCE);
    eval("sub rf_ds_optimal () { 0; }") unless defined(&rf_ds_optimal);
    eval("sub rf_ds_failed () { 1; }") unless defined(&rf_ds_failed);
    eval("sub rf_ds_reconstructing () { 2; }") unless defined(&rf_ds_reconstructing);
    eval("sub rf_ds_dist_spared () { 3; }") unless defined(&rf_ds_dist_spared);
    eval("sub rf_ds_spared () { 4; }") unless defined(&rf_ds_spared);
    eval("sub rf_ds_spare () { 5; }") unless defined(&rf_ds_spare);
    eval("sub rf_ds_used_spare () { 6; }") unless defined(&rf_ds_used_spare);
    eval("sub rf_ds_rebuilding_spare () { 7; }") unless defined(&rf_ds_rebuilding_spare);
    if(0) {
    }
    eval 'sub rf_component_label_set_numblocks {
        my($cl,$siz) = @_;
	    eval q({  ($cl->{numBlocksHi}) = $siz >> 32;  ($cl->{__numBlocks}) = $siz; });
    }' unless defined(&rf_component_label_set_numblocks);
    eval 'sub rf_component_label_partitionsize {
        my($cl) = @_;
	    eval q({ (( &RF_SectorCount_t) ($cl->{partitionSizeHi}) << 32) |  ($cl->{__partitionSize}); });
    }' unless defined(&rf_component_label_partitionsize);
    eval 'sub rf_component_label_set_partitionsize {
        my($cl,$siz) = @_;
	    eval q({  ($cl->{partitionSizeHi}) = $siz >> 32;  ($cl->{__partitionSize}) = $siz; });
    }' unless defined(&rf_component_label_set_partitionsize);
    unless(defined(&_STANDALONE)) {
	unless(defined(&_KERNEL)) {
	} else {
	}
    }
    eval 'sub RF_PARITYMAP_NREG () {4096;}' unless defined(&RF_PARITYMAP_NREG);
    eval 'sub RF_PARITYMAP_NBYTE () { &howmany( &RF_PARITYMAP_NREG,  &NBBY);}' unless defined(&RF_PARITYMAP_NBYTE);
}
1;
