FreeBSD/sys/kern/kern_intr.c
/*
 * Append a description preceded by a ':' to the name of the specified
 * interrupt handler.
 */
Append a description preceded by a ':' to the name of the specified
interrupt handler.
Append a description preceded by a ' : ' to the name of the specified interrupt handler .
int
intr_event_describe_handler(struct intr_event *ie, void *cookie,
    const char *descr)
{
	struct intr_handler *ih;
	size_t space;
	char *start;
	mtx_lock(&ie->ie_lock);
#ifdef INVARIANTS
	TAILQ_FOREACH(ih, &ie->ie_handlers, ih_next) {
		if (ih == cookie)
			break;
	}
	if (ih == NULL) {
		mtx_unlock(&ie->ie_lock);
		panic("handler %p not found in interrupt event %p", cookie, ie);
	}
#endif
	ih = cookie;
	start = strchr(ih->ih_name, ':');
	if (start == NULL)
		start = strchr(ih->ih_name, 0);
	space = sizeof(ih->ih_name) - (start - ih->ih_name) - 1;
	if (strlen(descr) + 1 > space) {
		mtx_unlock(&ie->ie_lock);
		return (ENOSPC);
	}
	*start = ':';
	strcpy(start + 1, descr);
	intr_event_update(ie);
	mtx_unlock(&ie->ie_lock);
	return (0);
}
int intr_event_describe_handler ( struct intr_event * ie , void * cookie , const char * descr ) { struct intr_handler * ih ; size_t space ; char * start ; mtx_lock ( & ie -> ie_lock ) ; #ifdef INVARIANTS TAILQ_FOREACH ( ih , & ie -> ie_handlers , ih_next ) { if ( ih == cookie ) break ; } if ( ih == NULL ) { mtx_unlock ( & ie -> ie_lock ) ; panic ( " " , cookie , ie ) ; } #endif ih = cookie ; start = strchr ( ih -> ih_name , ' ' ) ; if ( start == NULL ) start = strchr ( ih -> ih_name , 0 ) ; space = sizeof ( ih -> ih_name ) - ( start - ih -> ih_name ) - 1 ; if ( strlen ( descr ) + 1 > space ) { mtx_unlock ( & ie -> ie_lock ) ; return ( ENOSPC ) ; } * start = ' ' ; strcpy ( start + 1 , descr ) ; intr_event_update ( ie ) ; mtx_unlock ( & ie -> ie_lock ) ; return ( 0 ) ; }
Append a description preceded by a ':' to the name of the specified
 interrupt handler.
Append a description preceded by a ' : ' to the name of the specified interrupt handler .
/*
	 * Look for an existing description by checking for an
	 * existing ":".  This assumes device names do not include
	 * colons.  If one is found, prepare to insert the new
	 * description at that point.  If one is not found, find the
	 * end of the name to use as the insertion point.
	 */ /*
	 * See if there is enough remaining room in the string for the
	 * description + ":".  The "- 1" leaves room for the trailing
	 * '\0'.  The "+ 1" accounts for the colon.
	 */ /* Append a colon followed by the description. */