FreeBSD/sys/x86/xen/xen_intr.c
/**
 * Search for an already allocated but currently unused Xen interrupt
 * source object.
 *
 * \param type  Restrict the search to interrupt sources of the given
 *              type.
 *
 * \return  A pointer to a free Xen interrupt source object or NULL.
 */
Search for an already allocated but currently unused Xen interrupt
source object.

\param type  Restrict the search to interrupt sources of the given
type.

\return  A pointer to a free Xen interrupt source object or NULL.
Search for an already allocated but currently unused Xen interrupt source object . \ param type Restrict the search to interrupt sources of the given type . \ return A pointer to a free Xen interrupt source object or NULL .
static struct xenisrc *
xen_intr_find_unused_isrc(enum evtchn_type type)
{
	int isrc_idx;
	KASSERT(mtx_owned(&xen_intr_isrc_lock), ("Evtchn isrc lock not held"));
	for (isrc_idx = 0; isrc_idx < xen_intr_auto_vector_count; isrc_idx ++) {
		struct xenisrc *isrc;
		u_int vector;
		vector = FIRST_EVTCHN_INT + isrc_idx;
		isrc = (struct xenisrc *)intr_lookup_source(vector);
		if (isrc != NULL
		 && isrc->xi_type == EVTCHN_TYPE_UNBOUND) {
			KASSERT(isrc->xi_intsrc.is_handlers == 0,
			    ("Free evtchn still has handlers"));
			isrc->xi_type = type;
			return (isrc);
		}
	}
	return (NULL);
}
static struct xenisrc * xen_intr_find_unused_isrc ( enum evtchn_type type ) { int isrc_idx ; KASSERT ( mtx_owned ( & xen_intr_isrc_lock ) , ( " " ) ) ; for ( isrc_idx = 0 ; isrc_idx < xen_intr_auto_vector_count ; isrc_idx ++ ) { struct xenisrc * isrc ; u_int vector ; vector = FIRST_EVTCHN_INT + isrc_idx ; isrc = ( struct xenisrc * ) intr_lookup_source ( vector ) ; if ( isrc != NULL && isrc -> xi_type == EVTCHN_TYPE_UNBOUND ) { KASSERT ( isrc -> xi_intsrc . is_handlers == 0 , ( " " ) ) ; isrc -> xi_type = type ; return ( isrc ) ; } } return ( NULL ) ; }
Search for an already allocated but currently unused Xen interrupt
 source object.
Search for an already allocated but currently unused Xen interrupt source object .