require '_h2ph_pre.ph';

no warnings 'redefine';

unless(defined(&_xfs_vnodeops_h)) {
    eval 'sub _xfs_vnodeops_h () {1;}' unless defined(&_xfs_vnodeops_h);
    if(defined(&__osf__)) {
	eval 'sub xfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &VREF(($vp)));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &VREF(($vp)));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &vrele(($vp)));
	}' unless defined(&xfs_vfs_unlock);
	eval 'sub xfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q((0));
	}' unless defined(&xfs_vfs_vn_lock);
    }
 elsif(defined( &HAVE_TWO_ARGUMENT_VOP_LOCK)) {
	eval 'sub xfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_SHARED |  &LK_RETRY));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_EXCLUSIVE |  &LK_RETRY));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp), 0));
	}' unless defined(&xfs_vfs_unlock);
	eval 'sub xfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q( &vn_lock(($vp), ($flags)));
	}' unless defined(&xfs_vfs_vn_lock);
    }
 elsif(defined( &HAVE_THREE_ARGUMENT_VOP_LOCK)) {
	eval 'sub xfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_SHARED |  &LK_RETRY, ($proc)));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_EXCLUSIVE |  &LK_RETRY, ($proc)));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp), 0, ($proc)));
	}' unless defined(&xfs_vfs_unlock);
	eval 'sub xfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q( &vn_lock(($vp), ($flags), ($proc)));
	}' unless defined(&xfs_vfs_vn_lock);
    }
 elsif(defined( &HAVE_ONE_ARGUMENT_VOP_LOCK)) {
	eval 'sub xfs_vfs_readlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_LOCK(($vp)));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_LOCK(($vp)));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    my($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp)));
	}' unless defined(&xfs_vfs_unlock);
	eval 'sub xfs_vfs_vn_lock {
	    my($vp, $flags, $proc) = @_;
    	    eval q((0));
	}' unless defined(&xfs_vfs_vn_lock);
    } else {
	die("what\ kind\ of\ VOP_LOCK\?");
    }
}
1;
