require '_h2ph_pre.ph';

unless(defined(&__LINUX_BRLOCK_H)) {
    eval 'sub __LINUX_BRLOCK_H () {1;}' unless defined(&__LINUX_BRLOCK_H);
    eval("sub BR_GLOBALIRQ_LOCK () { 0; }") unless defined(&BR_GLOBALIRQ_LOCK);
    eval("sub BR_NETPROTO_LOCK () { 1; }") unless defined(&BR_NETPROTO_LOCK);
    eval("sub __BR_END () { 2; }") unless defined(&__BR_END);
    require 'linux/config.ph';
    if(defined(&CONFIG_SMP)) {
	require 'linux/cache.ph';
	require 'linux/spinlock.ph';
	if(defined( &__i386__) || defined( &__ia64__)) {
	    eval 'sub __BRLOCK_USE_ATOMICS () {1;}' unless defined(&__BRLOCK_USE_ATOMICS);
	} else {
	    undef(&__BRLOCK_USE_ATOMICS) if defined(&__BRLOCK_USE_ATOMICS);
	}
	if(defined(&__BRLOCK_USE_ATOMICS)) {
	} else {
	}
	eval 'sub __BR_IDX_MAX () {((($sizeof{ &brlock_read_lock_t}* &__BR_END +  &SMP_CACHE_BYTES-1) & ~( &SMP_CACHE_BYTES-1)) / $sizeof{ &brlock_read_lock_t});}' unless defined(&__BR_IDX_MAX);
	unless(defined(&__BRLOCK_USE_ATOMICS)) {
	}
	if(defined(&__BRLOCK_USE_ATOMICS)) {
	} else {
	}
    } else {
	eval 'sub br_read_lock {
	    local($idx) = @_;
    	    eval q((($idx)));
	}' unless defined(&br_read_lock);
	eval 'sub br_read_unlock {
	    local($idx) = @_;
    	    eval q((($idx)));
	}' unless defined(&br_read_unlock);
	eval 'sub br_write_lock {
	    local($idx) = @_;
    	    eval q((($idx)));
	}' unless defined(&br_write_lock);
	eval 'sub br_write_unlock {
	    local($idx) = @_;
    	    eval q((($idx)));
	}' unless defined(&br_write_unlock);
    }
    eval 'sub br_read_lock_irqsave {
        local($idx, $flags) = @_;
	    eval q( &do {  &local_irq_save($flags);  &br_read_lock($idx); }  &while (0));
    }' unless defined(&br_read_lock_irqsave);
    eval 'sub br_read_lock_irq {
        local($idx) = @_;
	    eval q( &do {  &local_irq_disable();  &br_read_lock($idx); }  &while (0));
    }' unless defined(&br_read_lock_irq);
    eval 'sub br_read_lock_bh {
        local($idx) = @_;
	    eval q( &do {  &local_bh_disable();  &br_read_lock($idx); }  &while (0));
    }' unless defined(&br_read_lock_bh);
    eval 'sub br_write_lock_irqsave {
        local($idx, $flags) = @_;
	    eval q( &do {  &local_irq_save($flags);  &br_write_lock($idx); }  &while (0));
    }' unless defined(&br_write_lock_irqsave);
    eval 'sub br_write_lock_irq {
        local($idx) = @_;
	    eval q( &do {  &local_irq_disable();  &br_write_lock($idx); }  &while (0));
    }' unless defined(&br_write_lock_irq);
    eval 'sub br_write_lock_bh {
        local($idx) = @_;
	    eval q( &do {  &local_bh_disable();  &br_write_lock($idx); }  &while (0));
    }' unless defined(&br_write_lock_bh);
    eval 'sub br_read_unlock_irqrestore {
        local($idx, $flags) = @_;
	    eval q( &do {  &br_read_unlock( &irx);  &local_irq_restore($flags); }  &while (0));
    }' unless defined(&br_read_unlock_irqrestore);
    eval 'sub br_read_unlock_irq {
        local($idx) = @_;
	    eval q( &do {  &br_read_unlock($idx);  &local_irq_enable(); }  &while (0));
    }' unless defined(&br_read_unlock_irq);
    eval 'sub br_read_unlock_bh {
        local($idx) = @_;
	    eval q( &do {  &br_read_unlock($idx);  &local_bh_enable(); }  &while (0));
    }' unless defined(&br_read_unlock_bh);
    eval 'sub br_write_unlock_irqrestore {
        local($idx, $flags) = @_;
	    eval q( &do {  &br_write_unlock( &irx);  &local_irq_restore($flags); }  &while (0));
    }' unless defined(&br_write_unlock_irqrestore);
    eval 'sub br_write_unlock_irq {
        local($idx) = @_;
	    eval q( &do {  &br_write_unlock($idx);  &local_irq_enable(); }  &while (0));
    }' unless defined(&br_write_unlock_irq);
    eval 'sub br_write_unlock_bh {
        local($idx) = @_;
	    eval q( &do {  &br_write_unlock($idx);  &local_bh_enable(); }  &while (0));
    }' unless defined(&br_write_unlock_bh);
}
1;
