Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_intr.c
Show First 20 Lines • Show All 191 Lines • ▼ Show 20 Lines | intr_event_update(struct intr_event *ie) | ||||
mtx_assert(&ie->ie_lock, MA_OWNED); | mtx_assert(&ie->ie_lock, MA_OWNED); | ||||
strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname)); | strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname)); | ||||
ie->ie_flags &= ~IE_ENTROPY; | ie->ie_flags &= ~IE_ENTROPY; | ||||
missed = 0; | missed = 0; | ||||
space = 1; | space = 1; | ||||
/* Run through all the handlers updating values. */ | /* Run through all the handlers updating values. */ | ||||
CK_SLIST_FOREACH(ih, &ie->ie_handlers, ih_next) { | CK_SLIST_FOREACH(ih, &ie->ie_handlers, ih_next) { | ||||
if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 1 < | if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 < | ||||
sizeof(ie->ie_fullname)) { | sizeof(ie->ie_fullname)) { | ||||
strcat(ie->ie_fullname, " "); | strcat(ie->ie_fullname, " "); | ||||
strcat(ie->ie_fullname, ih->ih_name); | strcat(ie->ie_fullname, ih->ih_name); | ||||
space = 0; | space = 0; | ||||
} else | } else | ||||
missed++; | missed++; | ||||
if (ih->ih_flags & IH_ENTROPY) | if (ih->ih_flags & IH_ENTROPY) | ||||
ie->ie_flags |= IE_ENTROPY; | ie->ie_flags |= IE_ENTROPY; | ||||
} | } | ||||
/* | /* | ||||
* If the handler names were too long, add +'s to indicate missing | * If there is only one handler and its name is too long, just copy in | ||||
* names. If we run out of room and still have +'s to add, change | * as much of the end of the name (includes the unit number) as will | ||||
* the last character from a + to a *. | * fit. Otherwise, we have multiple handlers and not all of the names | ||||
* will fit. Add +'s to indicate missing names. If we run out of room | |||||
* and still have +'s to add, change the last character from a + to a *. | |||||
*/ | */ | ||||
if (missed == 1 && space == 1) { | |||||
ih = CK_SLIST_FIRST(&ie->ie_handlers); | |||||
missed = strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 - | |||||
sizeof(ie->ie_fullname); | |||||
strcat(ie->ie_fullname, (missed == 0) ? " " : "-"); | |||||
strcat(ie->ie_fullname, &ih->ih_name[missed]); | |||||
missed = 0; | |||||
} | |||||
last = &ie->ie_fullname[sizeof(ie->ie_fullname) - 2]; | last = &ie->ie_fullname[sizeof(ie->ie_fullname) - 2]; | ||||
while (missed-- > 0) { | while (missed-- > 0) { | ||||
if (strlen(ie->ie_fullname) + 1 == sizeof(ie->ie_fullname)) { | if (strlen(ie->ie_fullname) + 1 == sizeof(ie->ie_fullname)) { | ||||
if (*last == '+') { | if (*last == '+') { | ||||
*last = '*'; | *last = '*'; | ||||
break; | break; | ||||
} else | } else | ||||
*last = '+'; | *last = '+'; | ||||
▲ Show 20 Lines • Show All 1,376 Lines • Show Last 20 Lines |