* Regenerate the full name of an interrupt event and update its priority. */
| 187 | * Regenerate the full name of an interrupt event and update its priority. |
| 188 | */ |
| 189 | static void |
| 190 | intr_event_update(struct intr_event *ie) |
| 191 | { |
| 192 | struct intr_handler *ih; |
| 193 | char *last; |
| 194 | int missed, space, flags; |
| 195 | |
| 196 | /* Start off with no entropy and just the name of the event. */ |
| 197 | mtx_assert(&ie->ie_lock, MA_OWNED); |
| 198 | strlcpy(ie->ie_fullname, ie->ie_name, sizeof(ie->ie_fullname)); |
| 199 | flags = 0; |
| 200 | missed = 0; |
| 201 | space = 1; |
| 202 | |
| 203 | /* Run through all the handlers updating values. */ |
| 204 | CK_SLIST_FOREACH(ih, &ie->ie_handlers, ih_next) { |
| 205 | if (strlen(ie->ie_fullname) + strlen(ih->ih_name) + 1 < |
| 206 | sizeof(ie->ie_fullname)) { |
| 207 | strcat(ie->ie_fullname, " "); |
| 208 | strcat(ie->ie_fullname, ih->ih_name); |
| 209 | space = 0; |
| 210 | } else |
| 211 | missed++; |
| 212 | flags |= ih->ih_flags; |
| 213 | } |
| 214 | ie->ie_hflags = flags; |
| 215 | |
| 216 | /* |
| 217 | * If there is only one handler and its name is too long, just copy in |
| 218 | * as much of the end of the name (includes the unit number) as will |
| 219 | * fit. Otherwise, we have multiple handlers and not all of the names |
| 220 | * will fit. Add +'s to indicate missing names. If we run out of room |
| 221 | * and still have +'s to add, change the last character from a + to a *. |
| 222 | */ |
| 223 | if (missed == 1 && space == 1) { |
| 224 | ih = CK_SLIST_FIRST(&ie->ie_handlers); |
| 225 | missed = strlen(ie->ie_fullname) + strlen(ih->ih_name) + 2 - |
| 226 | sizeof(ie->ie_fullname); |
| 227 | strcat(ie->ie_fullname, (missed == 0) ? " " : "-"); |
| 228 | strcat(ie->ie_fullname, &ih->ih_name[missed]); |
| 229 | missed = 0; |
| 230 | } |
| 231 | last = &ie->ie_fullname[sizeof(ie->ie_fullname) - 2]; |
| 232 | while (missed-- > 0) { |
| 233 | if (strlen(ie->ie_fullname) + 1 == sizeof(ie->ie_fullname)) { |
| 234 | if (*last == '+') { |
| 235 | *last = '*'; |
| 236 | break; |
| 237 | } else |
| 238 | *last = '+'; |
| 239 | } else if (space) { |
| 240 | strcat(ie->ie_fullname, " +"); |
| 241 | space = 0; |
| 242 | } else |
| 243 | strcat(ie->ie_fullname, "+"); |
| 244 | } |
| 245 | |
| 246 | /* |
no test coverage detected