require '_h2ph_pre.ph';

unless(defined(&_xfs_vnodeops_h)) {
    eval 'sub _xfs_vnodeops_h () {1;}' unless defined(&_xfs_vnodeops_h);
    if(defined(&__osf__)) {
	eval 'sub xfs_vfs_readlock {
	    local($vp, $proc) = @_;
    	    eval q( &VREF(($vp)));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    local($vp, $proc) = @_;
    	    eval q( &VREF(($vp)));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    local($vp, $proc) = @_;
    	    eval q( &vrele(($vp)));
	}' unless defined(&xfs_vfs_unlock);
    }
 elsif(defined( &HAVE_TWO_ARGUMENT_VOP_LOCK)) {
	eval 'sub xfs_vfs_readlock {
	    local($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_SHARED |  &LK_RETRY));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    local($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_EXCLUSIVE |  &LK_RETRY));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    local($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp), 0));
	}' unless defined(&xfs_vfs_unlock);
    }
 elsif(defined( &HAVE_THREE_ARGUMENT_VOP_LOCK)) {
	eval 'sub xfs_vfs_readlock {
	    local($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_SHARED |  &LK_RETRY, ($proc)));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    local($vp, $proc) = @_;
    	    eval q( &vn_lock(($vp),  &LK_EXCLUSIVE |  &LK_RETRY, ($proc)));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    local($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp), 0, ($proc)));
	}' unless defined(&xfs_vfs_unlock);
    } else {
	eval 'sub xfs_vfs_readlock {
	    local($vp, $proc) = @_;
    	    eval q( &VOP_LOCK(($vp)));
	}' unless defined(&xfs_vfs_readlock);
	eval 'sub xfs_vfs_writelock {
	    local($vp, $proc) = @_;
    	    eval q( &VOP_LOCK(($vp)));
	}' unless defined(&xfs_vfs_writelock);
	eval 'sub xfs_vfs_unlock {
	    local($vp, $proc) = @_;
    	    eval q( &VOP_UNLOCK(($vp)));
	}' unless defined(&xfs_vfs_unlock);
    }
}
1;
