require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_RF__RF_LAYOUT_H_)) {
    eval 'sub _RF__RF_LAYOUT_H_ () {1;}' unless defined(&_RF__RF_LAYOUT_H_);
    require 'rf_types.ph';
    require 'rf_archs.ph';
    require 'rf_alloclist.ph';
    unless(defined(&_KERNEL)) {
	require 'stdio.ph';
    }
    unless(defined(&_KERNEL)) {
    }
    if((defined(&RF_UTILITY) ? &RF_UTILITY : 0) == 0) {
	if(0) {
	}
    }
    eval 'sub RF_REMAP () {1;}' unless defined(&RF_REMAP);
    eval 'sub RF_DONT_REMAP () {0;}' unless defined(&RF_DONT_REMAP);
    eval 'sub RF_NO_STRIPE_LOCKS () {0x1;}' unless defined(&RF_NO_STRIPE_LOCKS);
    eval 'sub RF_DISTRIBUTE_SPARE () {0x2;}' unless defined(&RF_DISTRIBUTE_SPARE);
    eval 'sub RF_BD_DECLUSTERED () {0x4;}' unless defined(&RF_BD_DECLUSTERED);
    eval 'sub RF_PDA_TYPE_DATA () {0;}' unless defined(&RF_PDA_TYPE_DATA);
    eval 'sub RF_PDA_TYPE_PARITY () {1;}' unless defined(&RF_PDA_TYPE_PARITY);
    eval 'sub RF_PDA_TYPE_Q () {2;}' unless defined(&RF_PDA_TYPE_Q);
    eval 'sub RF_MAX_FAILED_PDA () { &RF_MAXCOL;}' unless defined(&RF_MAX_FAILED_PDA);
    if(0) {
    } else {
    }
    eval 'sub RF_ASM_REDIR_LARGE_WRITE () {0x1;}' unless defined(&RF_ASM_REDIR_LARGE_WRITE);
    eval 'sub RF_ASM_BAILOUT_DAG_USED () {0x2;}' unless defined(&RF_ASM_BAILOUT_DAG_USED);
    eval 'sub RF_ASM_FLAGS_LOCK_TRIED () {0x4;}' unless defined(&RF_ASM_FLAGS_LOCK_TRIED);
    eval 'sub RF_ASM_FLAGS_LOCK_TRIED2 () {0x8;}' unless defined(&RF_ASM_FLAGS_LOCK_TRIED2);
    eval 'sub RF_ASM_FLAGS_FORCE_TRIED () {0x10;}' unless defined(&RF_ASM_FLAGS_FORCE_TRIED);
    eval 'sub RF_ASM_FLAGS_RECON_BLOCKED () {0x20;}' unless defined(&RF_ASM_FLAGS_RECON_BLOCKED);
    eval 'sub rf_RaidAddressToStripeID {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q(((($_addr_) / ($_layoutPtr_)-> &sectorsPerStripeUnit) / ($_layoutPtr_)-> &numDataCol));
    }' unless defined(&rf_RaidAddressToStripeID);
    eval 'sub rf_StripeIDToRaidAddress {
        my($_layoutPtr_,$_sid_) = @_;
	    eval q(((($_sid_) * ($_layoutPtr_)-> &sectorsPerStripeUnit) * ($_layoutPtr_)-> &numDataCol));
    }' unless defined(&rf_StripeIDToRaidAddress);
    eval 'sub rf_StripeUnitIDToStripeID {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((($_addr_) / ($_layoutPtr_)-> &numDataCol));
    }' unless defined(&rf_StripeUnitIDToStripeID);
    eval 'sub rf_RaidAddressToStripeUnitID {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q(((($_addr_) / ($_layoutPtr_)-> &sectorsPerStripeUnit)));
    }' unless defined(&rf_RaidAddressToStripeUnitID);
    eval 'sub rf_RaidAddressOfNextStripeBoundary {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((((($_addr_) / ($_layoutPtr_)-> &dataSectorsPerStripe) + 1) * ($_layoutPtr_)-> &dataSectorsPerStripe));
    }' unless defined(&rf_RaidAddressOfNextStripeBoundary);
    eval 'sub rf_RaidAddressOfPrevStripeBoundary {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((((($_addr_) / ($_layoutPtr_)-> &dataSectorsPerStripe) + 0) * ($_layoutPtr_)-> &dataSectorsPerStripe));
    }' unless defined(&rf_RaidAddressOfPrevStripeBoundary);
    eval 'sub rf_RaidAddressOfNextStripeUnitBoundary {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((((($_addr_) / ($_layoutPtr_)-> &sectorsPerStripeUnit) + 1) * ($_layoutPtr_)-> &sectorsPerStripeUnit));
    }' unless defined(&rf_RaidAddressOfNextStripeUnitBoundary);
    eval 'sub rf_RaidAddressOfPrevStripeUnitBoundary {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((((($_addr_) / ($_layoutPtr_)-> &sectorsPerStripeUnit) + 0) * ($_layoutPtr_)-> &sectorsPerStripeUnit));
    }' unless defined(&rf_RaidAddressOfPrevStripeUnitBoundary);
    eval 'sub rf_RaidAddressStripeOffset {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((($_addr_) % ($_layoutPtr_)-> &dataSectorsPerStripe));
    }' unless defined(&rf_RaidAddressStripeOffset);
    eval 'sub rf_StripeUnitOffset {
        my($_layoutPtr_,$_addr_) = @_;
	    eval q((($_addr_) % ($_layoutPtr_)-> &sectorsPerStripeUnit));
    }' unless defined(&rf_StripeUnitOffset);
    eval 'sub rf_RaidAddressStripeAligned {
        my($__layoutPtr__,$__addr__) = @_;
	    eval q(( &rf_RaidAddressStripeOffset($__layoutPtr__, $__addr__) == 0));
    }' unless defined(&rf_RaidAddressStripeAligned);
    eval 'sub rf_StripeUnitAligned {
        my($__layoutPtr__,$__addr__) = @_;
	    eval q(( &rf_StripeUnitOffset($__layoutPtr__, $__addr__) == 0));
    }' unless defined(&rf_StripeUnitAligned);
    eval 'sub rf_RaidAddressToByte {
        my($_raidPtr_,$_addr_) = @_;
	    eval q((($_addr_) << ($_raidPtr_)-> &logBytesPerSector));
    }' unless defined(&rf_RaidAddressToByte);
    eval 'sub rf_ByteToRaidAddress {
        my($_raidPtr_,$_addr_) = @_;
	    eval q((($_addr_) >> ($_raidPtr_)-> &logBytesPerSector));
    }' unless defined(&rf_ByteToRaidAddress);
    eval 'sub rf_RaidAddressToParityStripeID {
        my($_layoutPtr_,$_addr_,$_ru_num_) = @_;
	    eval q( &rf_MapStripeIDToParityStripeID(($_layoutPtr_),  &rf_RaidAddressToStripeID(($_layoutPtr_), ($_addr_)), ($_ru_num_)));
    }' unless defined(&rf_RaidAddressToParityStripeID);
    eval 'sub rf_ParityStripeIDToRaidAddress {
        my($_layoutPtr_,$_psid_) = @_;
	    eval q((($_psid_) * ($_layoutPtr_)-> &SUsPerPU * ($_layoutPtr_)-> &numDataCol * ($_layoutPtr_)-> &sectorsPerStripeUnit));
    }' unless defined(&rf_ParityStripeIDToRaidAddress);
}
1;
