require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_RF__RF_GENERAL_H_)) {
    eval 'sub _RF__RF_GENERAL_H_ () {1;}' unless defined(&_RF__RF_GENERAL_H_);
    if(defined(&_KERNEL)) {
	require 'sys/systm.ph';
    }
    eval 'sub RF_ERRORMSG {
        my($s) = @_;
	    eval q( &printf(($s)));
    }' unless defined(&RF_ERRORMSG);
    eval 'sub RF_ERRORMSG1 {
        my($s,$a) = @_;
	    eval q( &printf(($s), ($a)));
    }' unless defined(&RF_ERRORMSG1);
    eval 'sub RF_ERRORMSG2 {
        my($s,$a,$b) = @_;
	    eval q( &printf(($s), ($a), ($b)));
    }' unless defined(&RF_ERRORMSG2);
    eval 'sub RF_ERRORMSG3 {
        my($s,$a,$b,$c) = @_;
	    eval q( &printf(($s), ($a), ($b), ($c)));
    }' unless defined(&RF_ERRORMSG3);
    eval 'sub RF_PANIC () {
        eval q( &do {  &snprintf( &rf_panicbuf,  &sizeof  &rf_panicbuf, \\"RAIDframe error at line %d file %s\\",  &__LINE__,  &__FILE__);  &panic( &rf_panicbuf); }  &while (0));
    }' unless defined(&RF_PANIC);
    if(defined(&_KERNEL)) {
	if(defined(&RF_ASSERT)) {
	    undef(&RF_ASSERT) if defined(&RF_ASSERT);
	}
	unless(defined(&NOASSERT)) {
	    eval 'sub RF_ASSERT {
	        my($_x_) = @_;
    		eval q( &do {  &if (!($_x_)) {  &snprintf( &rf_panicbuf,  &sizeof  &rf_panicbuf, \\"RAIDframe error at line %d\\" \\" file %s (failed asserting %s)\\\\n\\",  &__LINE__,  &__FILE__, $_x_);  &panic( &rf_panicbuf); } }  &while (0));
	    }' unless defined(&RF_ASSERT);
	} else {
	    eval 'sub RF_ASSERT {
	        my($x) = @_;
    		eval q({ });
	    }' unless defined(&RF_ASSERT);
	}
    } else {
	eval 'sub RF_ASSERT {
	    my($x) = @_;
    	    eval q({ });
	}' unless defined(&RF_ASSERT);
    }
    eval 'sub RF_MAX {
        my($a,$b) = @_;
	    eval q(((($a) > ($b)) ? ($a) : ($b)));
    }' unless defined(&RF_MAX);
    eval 'sub RF_MIN {
        my($a,$b) = @_;
	    eval q(((($a) < ($b)) ? ($a) : ($b)));
    }' unless defined(&RF_MIN);
    eval 'sub RF_DB0_CHECK {
        my($a,$b) = @_;
	    eval q(((($b)==0) ? 0: ($a)/($b)));
    }' unless defined(&RF_DB0_CHECK);
    eval 'sub RF_GETTIME {
        my($_t) = @_;
	    eval q( &microtime(($_t)));
    }' unless defined(&RF_GETTIME);
    eval 'sub RF_BZERO {
        my($_bp,$_b,$_l) = @_;
	    eval q( &bzero($_b, $_l));
    }' unless defined(&RF_BZERO);
    eval 'sub RF_UL {
        my($x) = @_;
	    eval q((($x)));
    }' unless defined(&RF_UL);
    eval 'sub RF_PGMASK () { &RF_UL( &NBPG-1);}' unless defined(&RF_PGMASK);
    eval 'sub RF_BLIP {
        my($x) = @_;
	    eval q(( &NBPG - ( &RF_UL($x) &  &RF_PGMASK)));
    }' unless defined(&RF_BLIP);
    eval 'sub RF_PAGE_ALIGNED {
        my($x) = @_;
	    eval q((( &RF_UL($x) &  &RF_PGMASK) == 0));
    }' unless defined(&RF_PAGE_ALIGNED);
    if(defined(&__STDC__)) {
	eval 'sub RF_STRING {
	    my($_str_) = @_;
    	    eval q($_str_);
	}' unless defined(&RF_STRING);
    } else {
	eval 'sub RF_STRING {
	    my($_str_) = @_;
    	    eval q(\\"_str_\\");
	}' unless defined(&RF_STRING);
    }
}
1;
