Lines Matching refs:cip
222 fmd_case_code_hash_insert(fmd_case_hash_t *chp, fmd_case_impl_t *cip) in fmd_case_code_hash_insert() argument
224 uint_t h = fmd_strhash(cip->ci_code) % chp->ch_hashlen; in fmd_case_code_hash_insert()
226 cip->ci_code_next = chp->ch_code_hash[h]; in fmd_case_code_hash_insert()
227 chp->ch_code_hash[h] = cip; in fmd_case_code_hash_insert()
231 fmd_case_code_hash_delete(fmd_case_hash_t *chp, fmd_case_impl_t *cip) in fmd_case_code_hash_delete() argument
235 if (cip->ci_code) { in fmd_case_code_hash_delete()
236 uint_t h = fmd_strhash(cip->ci_code) % chp->ch_hashlen; in fmd_case_code_hash_delete()
240 if (cp != cip) in fmd_case_code_hash_delete()
260 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_mkcode() local
267 ASSERT(MUTEX_HELD(&cip->ci_lock)); in fmd_case_mkcode()
268 ASSERT(cip->ci_state >= FMD_CASE_SOLVED); in fmd_case_mkcode()
273 fmd_case_code_hash_delete(chp, cip); in fmd_case_mkcode()
275 fmd_free(cip->ci_code, cip->ci_codelen); in fmd_case_mkcode()
276 cip->ci_codelen = cip->ci_mod->mod_codelen; in fmd_case_mkcode()
277 cip->ci_code = fmd_zalloc(cip->ci_codelen, FMD_SLEEP); in fmd_case_mkcode()
278 keys = keyp = alloca(sizeof (char *) * (cip->ci_nsuspects + 1)); in fmd_case_mkcode()
280 for (cis = cip->ci_suspects; cis != NULL; cis = cis->cis_next) { in fmd_case_mkcode()
287 if (cip->ci_nsuspects == 0 || fmd_module_dc_key2code( in fmd_case_mkcode()
288 cip->ci_mod, keys, cip->ci_code, cip->ci_codelen) != 0) { in fmd_case_mkcode()
290 fmd_free(cip->ci_code, cip->ci_codelen); in fmd_case_mkcode()
291 cip->ci_codelen = strlen(s) + 1; in fmd_case_mkcode()
292 cip->ci_code = fmd_zalloc(cip->ci_codelen, FMD_SLEEP); in fmd_case_mkcode()
293 (void) strcpy(cip->ci_code, s); in fmd_case_mkcode()
299 fmd_case_code_hash_insert(chp, cip); in fmd_case_mkcode()
301 return (cip->ci_code); in fmd_case_mkcode()
397 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_mkevent() local
405 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_mkevent()
406 ASSERT(cip->ci_state >= FMD_CASE_SOLVED); in fmd_case_mkevent()
408 nva = alloca(sizeof (nvlist_t *) * cip->ci_nsuspects); in fmd_case_mkevent()
409 ba = alloca(sizeof (uint8_t) * cip->ci_nsuspects); in fmd_case_mkevent()
419 fcl.fcl_maxcount = cip->ci_nsuspects; in fmd_case_mkevent()
425 if (cip->ci_code == NULL) in fmd_case_mkevent()
438 code = cip->ci_code; in fmd_case_mkevent()
441 cip->ci_flags |= FMD_CF_INVISIBLE; in fmd_case_mkevent()
447 nvl = fmd_protocol_list(class, cip->ci_diag_de == NULL ? in fmd_case_mkevent()
448 cip->ci_mod->mod_fmri : cip->ci_diag_de, cip->ci_uuid, code, count, in fmd_case_mkevent()
449 nva, ba, msg, &cip->ci_tv, cip->ci_injected); in fmd_case_mkevent()
451 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_mkevent()
547 fmd_case_impl_t *cip = fcmsp->fcms_cip; in fmd_case_match_suspects() local
575 for (cis = cip->ci_suspects; cis != NULL; cis = cis->cis_next, i++) in fmd_case_match_suspects()
599 fmd_case_impl_t *cip = fcap->fca_cip; in fmd_case_fault_acquitted_matching() local
605 for (cis = cip->ci_suspects; cis != NULL; cis = cis->cis_next) in fmd_case_fault_acquitted_matching()
623 fmd_case_impl_t *cip = fcap->fca_cip; in fmd_case_fault_all_matching() local
628 for (cis = cip->ci_suspects; cis != NULL; cis = cis->cis_next) in fmd_case_fault_all_matching()
646 fmd_case_impl_t *cip = fcap->fca_cip; in fmd_case_acquit_no_match() local
651 for (cis = cip->ci_suspects; cis != NULL; cis = cis->cis_next) in fmd_case_acquit_no_match()
911 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_convict() local
927 new_susp_state = alloca(cip->ci_nsuspects * sizeof (uint8_t)); in fmd_case_convict()
928 for (i = 0; i < cip->ci_nsuspects; i++) in fmd_case_convict()
930 new_match_state = alloca(cip->ci_nsuspects * sizeof (uint8_t)); in fmd_case_convict()
931 for (i = 0; i < cip->ci_nsuspects; i++) in fmd_case_convict()
933 fccd.fccd_cip = cip; in fmd_case_convict()
965 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_convict()
966 if (cip->ci_code == NULL) in fmd_case_convict()
968 else if (cip->ci_precanned) in fmd_case_convict()
969 fmd_case_code_hash_insert(fmd.d_cases, cip); in fmd_case_convict()
977 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_convict()
984 for (cis = cip->ci_suspects; cis != NULL; cis = cis->cis_next) { in fmd_case_convict()
988 "%s: %s\n", cip->ci_uuid, fmd_strerror(errno)); in fmd_case_convict()
1010 for (i = 0; i < cip->ci_nsuspects; i++) { in fmd_case_convict()
1020 for (cis = cip->ci_suspects, i = 0; cis != NULL; in fmd_case_convict()
1036 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_convict()
1043 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_publish() local
1049 state = cip->ci_state; /* use current state */ in fmd_case_publish()
1053 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_publish()
1058 if (cip->ci_precanned == 0 && cip->ci_xprt == NULL && in fmd_case_publish()
1059 cip->ci_code != NULL) { in fmd_case_publish()
1060 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_publish()
1064 if (cip->ci_tv_valid == 0) { in fmd_case_publish()
1065 fmd_time_gettimeofday(&cip->ci_tv); in fmd_case_publish()
1066 cip->ci_tv_valid = 1; in fmd_case_publish()
1068 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_publish()
1071 cip->ci_flags &= ~FMD_CF_SOLVED; in fmd_case_publish()
1075 if (cip->ci_xprt != NULL) { in fmd_case_publish()
1082 fmd_xprt_impl_t *xip = (fmd_xprt_impl_t *)cip->ci_xprt; in fmd_case_publish()
1085 fasp.fasp_maxcount = cip->ci_nsuspects; in fmd_case_publish()
1086 fasp.fasp_proxy_asru = cip->ci_proxy_asru; in fmd_case_publish()
1103 (void) pthread_mutex_lock(&cip->ci_mod->mod_stats_lock); in fmd_case_publish()
1104 cip->ci_mod->mod_stats->ms_casesolved.fmds_value.ui64++; in fmd_case_publish()
1105 (void) pthread_mutex_unlock(&cip->ci_mod->mod_stats_lock); in fmd_case_publish()
1112 fmd_eventq_insert_at_head(cip->ci_mod->mod_queue, e); in fmd_case_publish()
1114 (void) pthread_mutex_lock(&cip->ci_mod->mod_stats_lock); in fmd_case_publish()
1115 cip->ci_mod->mod_stats->ms_caseclosed.fmds_value.ui64++; in fmd_case_publish()
1116 (void) pthread_mutex_unlock(&cip->ci_mod->mod_stats_lock); in fmd_case_publish()
1152 fmd_case_impl_t *cip; in fmd_case_hash_lookup() local
1158 for (cip = chp->ch_hash[h]; cip != NULL; cip = cip->ci_next) { in fmd_case_hash_lookup()
1159 if (strcmp(cip->ci_uuid, uuid) == 0) in fmd_case_hash_lookup()
1166 if (cip != NULL) in fmd_case_hash_lookup()
1167 cip = fmd_case_tryhold(cip); in fmd_case_hash_lookup()
1169 if (cip == NULL) in fmd_case_hash_lookup()
1173 return ((fmd_case_t *)cip); in fmd_case_hash_lookup()
1177 fmd_case_hash_insert(fmd_case_hash_t *chp, fmd_case_impl_t *cip) in fmd_case_hash_insert() argument
1183 h = fmd_strhash(cip->ci_uuid) % chp->ch_hashlen; in fmd_case_hash_insert()
1186 if (strcmp(cip->ci_uuid, eip->ci_uuid) == 0 && in fmd_case_hash_insert()
1193 cip->ci_next = chp->ch_hash[h]; in fmd_case_hash_insert()
1194 chp->ch_hash[h] = cip; in fmd_case_hash_insert()
1200 return (cip); in fmd_case_hash_insert()
1204 fmd_case_hash_delete(fmd_case_hash_t *chp, fmd_case_impl_t *cip) in fmd_case_hash_delete() argument
1209 ASSERT(MUTEX_HELD(&cip->ci_lock)); in fmd_case_hash_delete()
1211 cip->ci_flags |= FMD_CF_DELETING; in fmd_case_hash_delete()
1212 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_hash_delete()
1216 h = fmd_strhash(cip->ci_uuid) % chp->ch_hashlen; in fmd_case_hash_delete()
1220 if (cp != cip) in fmd_case_hash_delete()
1228 (void *)cip, cip->ci_uuid, h); in fmd_case_hash_delete()
1237 fmd_case_code_hash_delete(chp, cip); in fmd_case_hash_delete()
1244 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_hash_delete()
1245 ASSERT(cip->ci_flags & FMD_CF_DELETING); in fmd_case_hash_delete()
1251 fmd_case_impl_t *cip = fmd_zalloc(sizeof (fmd_case_impl_t), FMD_SLEEP); in fmd_case_create() local
1255 (void) pthread_mutex_init(&cip->ci_lock, NULL); in fmd_case_create()
1256 fmd_buf_hash_create(&cip->ci_bufs); in fmd_case_create()
1259 cip->ci_mod = mp; in fmd_case_create()
1260 cip->ci_refs = 1; in fmd_case_create()
1261 cip->ci_state = FMD_CASE_UNSOLVED; in fmd_case_create()
1262 cip->ci_flags = FMD_CF_DIRTY; in fmd_case_create()
1263 cip->ci_data = data; in fmd_case_create()
1271 (void) fmd_conf_getprop(fmd.d_conf, "uuidlen", &cip->ci_uuidlen); in fmd_case_create()
1272 cip->ci_uuid = fmd_zalloc(cip->ci_uuidlen + 1, FMD_SLEEP); in fmd_case_create()
1285 uuid_unparse(uuid, cip->ci_uuid); in fmd_case_create()
1286 } while ((eip = fmd_case_hash_insert(fmd.d_cases, cip)) != cip); in fmd_case_create()
1293 (void) strncpy(cip->ci_uuid, uuidstr, cip->ci_uuidlen + 1); in fmd_case_create()
1294 if (fmd_case_hash_insert(fmd.d_cases, cip) != cip) { in fmd_case_create()
1295 fmd_free(cip->ci_uuid, cip->ci_uuidlen + 1); in fmd_case_create()
1296 (void) fmd_buf_hash_destroy(&cip->ci_bufs); in fmd_case_create()
1298 pthread_mutex_destroy(&cip->ci_lock); in fmd_case_create()
1299 fmd_free(cip, sizeof (*cip)); in fmd_case_create()
1305 fmd_list_append(&mp->mod_cases, cip); in fmd_case_create()
1308 (void) pthread_mutex_lock(&cip->ci_mod->mod_stats_lock); in fmd_case_create()
1309 cip->ci_mod->mod_stats->ms_caseopen.fmds_value.ui64++; in fmd_case_create()
1310 (void) pthread_mutex_unlock(&cip->ci_mod->mod_stats_lock); in fmd_case_create()
1312 return ((fmd_case_t *)cip); in fmd_case_create()
1316 fmd_case_destroy_suspects(fmd_case_impl_t *cip) in fmd_case_destroy_suspects() argument
1320 ASSERT(MUTEX_HELD(&cip->ci_lock)); in fmd_case_destroy_suspects()
1322 if (cip->ci_proxy_asru) in fmd_case_destroy_suspects()
1323 fmd_free(cip->ci_proxy_asru, sizeof (uint8_t) * in fmd_case_destroy_suspects()
1324 cip->ci_nsuspects); in fmd_case_destroy_suspects()
1325 nvlist_free(cip->ci_diag_de); in fmd_case_destroy_suspects()
1326 if (cip->ci_diag_asru) in fmd_case_destroy_suspects()
1327 fmd_free(cip->ci_diag_asru, sizeof (uint8_t) * in fmd_case_destroy_suspects()
1328 cip->ci_nsuspects); in fmd_case_destroy_suspects()
1330 for (cis = cip->ci_suspects; cis != NULL; cis = ncis) { in fmd_case_destroy_suspects()
1336 cip->ci_suspects = NULL; in fmd_case_destroy_suspects()
1337 cip->ci_nsuspects = 0; in fmd_case_destroy_suspects()
1344 fmd_case_impl_t *cip = fmd_zalloc(sizeof (fmd_case_impl_t), FMD_SLEEP); in fmd_case_recreate() local
1347 (void) pthread_mutex_init(&cip->ci_lock, NULL); in fmd_case_recreate()
1348 fmd_buf_hash_create(&cip->ci_bufs); in fmd_case_recreate()
1351 cip->ci_mod = mp; in fmd_case_recreate()
1352 cip->ci_xprt = xp; in fmd_case_recreate()
1353 cip->ci_refs = 1; in fmd_case_recreate()
1354 cip->ci_state = state; in fmd_case_recreate()
1355 cip->ci_uuid = fmd_strdup(uuid, FMD_SLEEP); in fmd_case_recreate()
1356 cip->ci_uuidlen = strlen(cip->ci_uuid); in fmd_case_recreate()
1357 cip->ci_code = fmd_strdup(code, FMD_SLEEP); in fmd_case_recreate()
1358 cip->ci_codelen = cip->ci_code ? strlen(cip->ci_code) + 1 : 0; in fmd_case_recreate()
1361 cip->ci_flags |= FMD_CF_SOLVED; in fmd_case_recreate()
1368 if ((eip = fmd_case_hash_insert(fmd.d_cases, cip)) != cip) { in fmd_case_recreate()
1369 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_recreate()
1370 cip->ci_refs--; /* decrement to zero */ in fmd_case_recreate()
1371 fmd_case_destroy((fmd_case_t *)cip, B_FALSE); in fmd_case_recreate()
1373 cip = eip; /* switch 'cip' to the existing case */ in fmd_case_recreate()
1374 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_recreate()
1385 if (cip->ci_state < FMD_CASE_CLOSED) { in fmd_case_recreate()
1386 if (code != NULL && cip->ci_code == NULL) { in fmd_case_recreate()
1387 cip->ci_code = fmd_strdup(code, in fmd_case_recreate()
1389 cip->ci_codelen = cip->ci_code ? in fmd_case_recreate()
1390 strlen(cip->ci_code) + 1 : 0; in fmd_case_recreate()
1392 cip); in fmd_case_recreate()
1402 if ((cip->ci_state == FMD_CASE_REPAIRED || in fmd_case_recreate()
1403 cip->ci_state == FMD_CASE_RESOLVED) && in fmd_case_recreate()
1405 cip->ci_state = FMD_CASE_CLOSED; in fmd_case_recreate()
1406 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_recreate()
1407 fmd_case_rele((fmd_case_t *)cip); in fmd_case_recreate()
1408 return ((fmd_case_t *)cip); in fmd_case_recreate()
1415 if (cip->ci_mod != fmd.d_rmod || xp != NULL) { in fmd_case_recreate()
1416 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_recreate()
1417 fmd_case_rele((fmd_case_t *)cip); in fmd_case_recreate()
1426 fmd_module_lock(cip->ci_mod); in fmd_case_recreate()
1427 fmd_list_delete(&cip->ci_mod->mod_cases, cip); in fmd_case_recreate()
1428 fmd_module_unlock(cip->ci_mod); in fmd_case_recreate()
1430 fmd_module_rele(cip->ci_mod); in fmd_case_recreate()
1431 cip->ci_mod = mp; in fmd_case_recreate()
1445 (fmd_case_t *)cip); in fmd_case_recreate()
1446 fmd_case_destroy_suspects(cip); in fmd_case_recreate()
1447 fmd_case_code_hash_delete(fmd.d_cases, cip); in fmd_case_recreate()
1448 fmd_free(cip->ci_code, cip->ci_codelen); in fmd_case_recreate()
1449 cip->ci_code = NULL; in fmd_case_recreate()
1450 cip->ci_codelen = 0; in fmd_case_recreate()
1451 cip->ci_tv_valid = 0; in fmd_case_recreate()
1454 cip->ci_state = state; in fmd_case_recreate()
1456 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_recreate()
1457 fmd_case_rele((fmd_case_t *)cip); in fmd_case_recreate()
1462 if (cip->ci_code) in fmd_case_recreate()
1463 fmd_case_code_hash_insert(fmd.d_cases, cip); in fmd_case_recreate()
1467 fmd_list_append(&mp->mod_cases, cip); in fmd_case_recreate()
1469 (void) pthread_mutex_lock(&cip->ci_mod->mod_stats_lock); in fmd_case_recreate()
1470 cip->ci_mod->mod_stats->ms_caseopen.fmds_value.ui64++; in fmd_case_recreate()
1471 (void) pthread_mutex_unlock(&cip->ci_mod->mod_stats_lock); in fmd_case_recreate()
1473 return ((fmd_case_t *)cip); in fmd_case_recreate()
1479 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_destroy() local
1482 ASSERT(MUTEX_HELD(&cip->ci_lock)); in fmd_case_destroy()
1483 ASSERT(cip->ci_refs == 0); in fmd_case_destroy()
1486 TRACE((FMD_DBG_CASE, "deleting case %s", cip->ci_uuid)); in fmd_case_destroy()
1487 fmd_case_hash_delete(fmd.d_cases, cip); in fmd_case_destroy()
1490 for (cit = cip->ci_items; cit != NULL; cit = ncit) { in fmd_case_destroy()
1496 fmd_case_destroy_suspects(cip); in fmd_case_destroy()
1498 if (cip->ci_principal != NULL) in fmd_case_destroy()
1499 fmd_event_rele(cip->ci_principal); in fmd_case_destroy()
1501 fmd_free(cip->ci_uuid, cip->ci_uuidlen + 1); in fmd_case_destroy()
1502 fmd_free(cip->ci_code, cip->ci_codelen); in fmd_case_destroy()
1503 (void) fmd_buf_hash_destroy(&cip->ci_bufs); in fmd_case_destroy()
1505 fmd_module_rele(cip->ci_mod); in fmd_case_destroy()
1506 fmd_free(cip, sizeof (fmd_case_impl_t)); in fmd_case_destroy()
1512 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_hold() local
1514 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_hold()
1516 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_hold()
1522 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_hold_locked() local
1524 ASSERT(MUTEX_HELD(&cip->ci_lock)); in fmd_case_hold_locked()
1525 if (cip->ci_flags & FMD_CF_DELETING) in fmd_case_hold_locked()
1527 (void *)cip, cip->ci_uuid); in fmd_case_hold_locked()
1528 cip->ci_refs++; in fmd_case_hold_locked()
1529 ASSERT(cip->ci_refs != 0); in fmd_case_hold_locked()
1533 fmd_case_tryhold(fmd_case_impl_t *cip) in fmd_case_tryhold() argument
1539 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_tryhold()
1540 if (cip->ci_flags & FMD_CF_DELETING) { in fmd_case_tryhold()
1541 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_tryhold()
1542 cip = NULL; in fmd_case_tryhold()
1544 fmd_case_hold_locked((fmd_case_t *)cip); in fmd_case_tryhold()
1545 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_tryhold()
1547 return (cip); in fmd_case_tryhold()
1553 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_rele() local
1555 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_rele()
1556 ASSERT(cip->ci_refs != 0); in fmd_case_rele()
1558 if (--cip->ci_refs == 0) in fmd_case_rele()
1559 fmd_case_destroy((fmd_case_t *)cip, B_TRUE); in fmd_case_rele()
1561 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_rele()
1567 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_rele_locked() local
1569 ASSERT(MUTEX_HELD(&cip->ci_lock)); in fmd_case_rele_locked()
1570 --cip->ci_refs; in fmd_case_rele_locked()
1571 ASSERT(cip->ci_refs != 0); in fmd_case_rele_locked()
1577 fmd_case_impl_t *cip = cp; in fmd_case_insert_principal() local
1584 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_insert_principal()
1586 if (cip->ci_flags & FMD_CF_SOLVED) in fmd_case_insert_principal()
1591 oep = cip->ci_principal; in fmd_case_insert_principal()
1592 cip->ci_principal = ep; in fmd_case_insert_principal()
1594 for (cit = cip->ci_items; cit != NULL; cit = cit->cit_next) { in fmd_case_insert_principal()
1599 cip->ci_flags |= FMD_CF_DIRTY; in fmd_case_insert_principal()
1602 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_insert_principal()
1604 fmd_module_setcdirty(cip->ci_mod); in fmd_case_insert_principal()
1616 fmd_case_impl_t *cip = cp; in fmd_case_insert_event() local
1622 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_insert_event()
1624 if (cip->ci_flags & FMD_CF_SOLVED) in fmd_case_insert_event()
1629 for (cit = cip->ci_items; cit != NULL; cit = cit->cit_next) { in fmd_case_insert_event()
1634 new = cit == NULL && ep != cip->ci_principal; in fmd_case_insert_event()
1640 if (cit != NULL || (cip->ci_flags & FMD_CF_SOLVED)) { in fmd_case_insert_event()
1641 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_insert_event()
1653 cit->cit_next = cip->ci_items; in fmd_case_insert_event()
1656 cip->ci_items = cit; in fmd_case_insert_event()
1657 cip->ci_nitems++; in fmd_case_insert_event()
1659 cip->ci_flags |= FMD_CF_DIRTY; in fmd_case_insert_event()
1660 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_insert_event()
1662 fmd_module_setcdirty(cip->ci_mod); in fmd_case_insert_event()
1671 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_insert_suspect() local
1674 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_insert_suspect()
1675 ASSERT(cip->ci_state < FMD_CASE_CLOSE_WAIT); in fmd_case_insert_suspect()
1676 cip->ci_flags |= FMD_CF_DIRTY; in fmd_case_insert_suspect()
1678 cis->cis_next = cip->ci_suspects; in fmd_case_insert_suspect()
1681 cip->ci_suspects = cis; in fmd_case_insert_suspect()
1682 cip->ci_nsuspects++; in fmd_case_insert_suspect()
1684 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_insert_suspect()
1685 if (cip->ci_xprt == NULL) in fmd_case_insert_suspect()
1686 fmd_module_setcdirty(cip->ci_mod); in fmd_case_insert_suspect()
1692 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_recreate_suspect() local
1696 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_recreate_suspect()
1698 cis->cis_next = cip->ci_suspects; in fmd_case_recreate_suspect()
1703 cip->ci_flags |= FMD_CF_INVISIBLE; in fmd_case_recreate_suspect()
1705 cip->ci_suspects = cis; in fmd_case_recreate_suspect()
1706 cip->ci_nsuspects++; in fmd_case_recreate_suspect()
1708 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_recreate_suspect()
1714 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_reset_suspects() local
1716 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_reset_suspects()
1717 ASSERT(cip->ci_state < FMD_CASE_SOLVED); in fmd_case_reset_suspects()
1719 fmd_case_destroy_suspects(cip); in fmd_case_reset_suspects()
1720 cip->ci_flags |= FMD_CF_DIRTY; in fmd_case_reset_suspects()
1722 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_reset_suspects()
1723 fmd_module_setcdirty(cip->ci_mod); in fmd_case_reset_suspects()
1741 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_transition() local
1748 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_transition()
1750 if (!(cip->ci_flags & FMD_CF_SOLVED) && !(flags & FMD_CF_SOLVED)) in fmd_case_transition()
1753 cip->ci_flags |= flags; in fmd_case_transition()
1755 if (cip->ci_state >= state) { in fmd_case_transition()
1756 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition()
1760 TRACE((FMD_DBG_CASE, "case %s %s->%s", cip->ci_uuid, in fmd_case_transition()
1761 _fmd_case_snames[cip->ci_state], _fmd_case_snames[state])); in fmd_case_transition()
1763 cip->ci_state = state; in fmd_case_transition()
1764 cip->ci_flags |= FMD_CF_DIRTY; in fmd_case_transition()
1766 if (cip->ci_xprt == NULL && cip->ci_mod != fmd.d_rmod) in fmd_case_transition()
1767 fmd_module_setcdirty(cip->ci_mod); in fmd_case_transition()
1771 for (cit = cip->ci_items; cit != NULL; cit = cit->cit_next) in fmd_case_transition()
1774 if (cip->ci_principal != NULL) { in fmd_case_transition()
1775 fmd_event_transition(cip->ci_principal, in fmd_case_transition()
1786 if ((cip->ci_flags & (FMD_CF_SOLVED | FMD_CF_ISOLATED | in fmd_case_transition()
1797 if (cip->ci_flags & FMD_CF_REPAIRED) { in fmd_case_transition()
1798 state = cip->ci_state = FMD_CASE_REPAIRED; in fmd_case_transition()
1800 cip->ci_uuid, in fmd_case_transition()
1805 state = cip->ci_state = FMD_CASE_CLOSED; in fmd_case_transition()
1807 cip->ci_uuid, in fmd_case_transition()
1816 ASSERT(cip->ci_xprt != NULL || fmd_case_orphaned(cp)); in fmd_case_transition()
1830 if (cip->ci_xprt != NULL) in fmd_case_transition()
1831 fmd_list_delete(&cip->ci_mod->mod_cases, cip); in fmd_case_transition()
1838 if (cip->ci_xprt != NULL) { in fmd_case_transition()
1839 fmd_xprt_uuresolved(cip->ci_xprt, cip->ci_uuid); in fmd_case_transition()
1844 cip->ci_state = FMD_CASE_RESOLVED; in fmd_case_transition()
1845 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition()
1847 TRACE((FMD_DBG_CASE, "case %s %s->%s", cip->ci_uuid, in fmd_case_transition()
1852 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_transition()
1861 if (cip->ci_xprt != NULL) { in fmd_case_transition()
1862 fmd_list_delete(&cip->ci_mod->mod_cases, cip); in fmd_case_transition()
1876 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition()
1884 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition()
1895 if (cip->ci_mod->mod_flags & FMD_MOD_INIT) in fmd_case_transition()
1900 fmd_eventq_insert_at_head(cip->ci_mod->mod_queue, e); in fmd_case_transition()
1904 if (cip->ci_xprt != NULL) { in fmd_case_transition()
1912 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_transition()
1914 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition()
1919 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_transition()
1921 cip->ci_flags |= FMD_CF_RES_CMPL; in fmd_case_transition()
1922 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition()
1935 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_discard_resolved() local
1940 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_discard_resolved()
1941 if (!(cip->ci_flags & FMD_CF_RES_CMPL)) { in fmd_case_discard_resolved()
1942 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_discard_resolved()
1955 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_discard_resolved()
1964 fmd_module_lock(cip->ci_mod); in fmd_case_discard_resolved()
1965 fmd_list_delete(&cip->ci_mod->mod_cases, cip); in fmd_case_discard_resolved()
1966 fmd_module_unlock(cip->ci_mod); in fmd_case_discard_resolved()
1968 cip->ci_flags &= ~FMD_CF_RES_CMPL; in fmd_case_discard_resolved()
1969 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_discard_resolved()
1983 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_transition_update() local
1988 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_transition_update()
1992 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_transition_update()
2005 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_setdirty() local
2007 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_setdirty()
2008 cip->ci_flags |= FMD_CF_DIRTY; in fmd_case_setdirty()
2009 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_setdirty()
2011 fmd_module_setcdirty(cip->ci_mod); in fmd_case_setdirty()
2017 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_clrdirty() local
2019 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_clrdirty()
2020 cip->ci_flags &= ~FMD_CF_DIRTY; in fmd_case_clrdirty()
2021 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_clrdirty()
2027 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_commit() local
2030 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_commit()
2032 if (cip->ci_flags & FMD_CF_DIRTY) { in fmd_case_commit()
2033 for (cit = cip->ci_items; cit != NULL; cit = cit->cit_next) in fmd_case_commit()
2036 if (cip->ci_principal != NULL) in fmd_case_commit()
2037 fmd_event_commit(cip->ci_principal); in fmd_case_commit()
2039 fmd_buf_hash_commit(&cip->ci_bufs); in fmd_case_commit()
2040 cip->ci_flags &= ~FMD_CF_DIRTY; in fmd_case_commit()
2043 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_commit()
2052 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_xprt_updated() local
2059 ASSERT(cip->ci_xprt != NULL); in fmd_case_xprt_updated()
2060 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_xprt_updated()
2061 ba = alloca(sizeof (uint8_t) * cip->ci_nsuspects); in fmd_case_xprt_updated()
2062 nva = alloca(sizeof (nvlist_t *) * cip->ci_nsuspects); in fmd_case_xprt_updated()
2064 fcl.fcl_maxcount = cip->ci_nsuspects; in fmd_case_xprt_updated()
2069 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_xprt_updated()
2070 fmd_xprt_updated(cip->ci_xprt, cip->ci_uuid, ba, cip->ci_proxy_asru, in fmd_case_xprt_updated()
2083 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_update_status() local
2091 faus.faus_maxcount = cip->ci_nsuspects; in fmd_case_update_status()
2095 faus.faus_is_proxy = (cip->ci_xprt != NULL); in fmd_case_update_status()
2096 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_update_status()
2099 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_update_status()
2110 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_update_containees() local
2112 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_update_containees()
2115 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_update_containees()
2125 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_close_status() local
2133 facs.facs_maxcount = cip->ci_nsuspects; in fmd_case_close_status()
2134 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_close_status()
2137 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_close_status()
2148 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_update() local
2152 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_update()
2153 cstate = cip->ci_state; in fmd_case_update()
2155 if (cip->ci_state < FMD_CASE_SOLVED) { in fmd_case_update()
2156 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_update()
2160 if (cip->ci_flags & FMD_CF_REPAIRED) { in fmd_case_update()
2161 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_update()
2165 TRACE((FMD_DBG_CASE, "case update %s", cip->ci_uuid)); in fmd_case_update()
2167 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_update()
2174 TRACE((FMD_DBG_CASE, "sending list.updated %s", cip->ci_uuid)); in fmd_case_update()
2203 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_delete() local
2207 TRACE((FMD_DBG_CASE, "case delete %s", cip->ci_uuid)); in fmd_case_delete()
2208 ASSERT(fmd_module_locked(cip->ci_mod)); in fmd_case_delete()
2209 fmd_list_delete(&cip->ci_mod->mod_cases, cip); in fmd_case_delete()
2210 buftotal = fmd_buf_hash_destroy(&cip->ci_bufs); in fmd_case_delete()
2212 (void) pthread_mutex_lock(&cip->ci_mod->mod_stats_lock); in fmd_case_delete()
2213 msp = cip->ci_mod->mod_stats; in fmd_case_delete()
2221 (void) pthread_mutex_unlock(&cip->ci_mod->mod_stats_lock); in fmd_case_delete()
2223 if (cip->ci_xprt == NULL) in fmd_case_delete()
2224 fmd_module_setcdirty(cip->ci_mod); in fmd_case_delete()
2226 fmd_module_rele(cip->ci_mod); in fmd_case_delete()
2227 cip->ci_mod = fmd.d_rmod; in fmd_case_delete()
2228 fmd_module_hold(cip->ci_mod); in fmd_case_delete()
2235 if (cip->ci_flags & FMD_CF_SOLVED) { in fmd_case_delete()
2236 fmd_module_lock(cip->ci_mod); in fmd_case_delete()
2237 fmd_list_append(&cip->ci_mod->mod_cases, cip); in fmd_case_delete()
2238 fmd_module_unlock(cip->ci_mod); in fmd_case_delete()
2250 if (cip->ci_flags & FMD_CF_REPAIRED) in fmd_case_delete()
2252 else if (cip->ci_flags & FMD_CF_ISOLATED) { in fmd_case_delete()
2254 if (cip->ci_xprt != NULL) in fmd_case_delete()
2255 fmd_xprt_uuclose(cip->ci_xprt, cip->ci_uuid); in fmd_case_delete()
2264 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_discard() local
2266 (void) pthread_mutex_lock(&cip->ci_mod->mod_stats_lock); in fmd_case_discard()
2267 cip->ci_mod->mod_stats->ms_caseopen.fmds_value.ui64--; in fmd_case_discard()
2268 (void) pthread_mutex_unlock(&cip->ci_mod->mod_stats_lock); in fmd_case_discard()
2270 ASSERT(fmd_module_locked(cip->ci_mod)); in fmd_case_discard()
2271 fmd_list_delete(&cip->ci_mod->mod_cases, cip); in fmd_case_discard()
2273 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_discard()
2275 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_discard()
2290 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_repair() local
2294 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_repair()
2295 cstate = cip->ci_state; in fmd_case_repair()
2298 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_repair()
2302 if (cip->ci_flags & FMD_CF_REPAIRED) { in fmd_case_repair()
2303 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_repair()
2307 TRACE((FMD_DBG_CASE, "case repair %s", cip->ci_uuid)); in fmd_case_repair()
2312 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_repair()
2319 if (cip->ci_xprt != NULL) { in fmd_case_repair()
2335 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_acquit() local
2339 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_acquit()
2340 cstate = cip->ci_state; in fmd_case_acquit()
2343 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_acquit()
2347 if (cip->ci_flags & FMD_CF_REPAIRED) { in fmd_case_acquit()
2348 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_acquit()
2352 TRACE((FMD_DBG_CASE, "case acquit %s", cip->ci_uuid)); in fmd_case_acquit()
2357 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_acquit()
2364 if (cip->ci_xprt != NULL) { in fmd_case_acquit()
2380 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_contains() local
2385 (void) pthread_mutex_lock(&cip->ci_lock); in fmd_case_contains()
2387 if (cip->ci_state >= FMD_CASE_SOLVED) in fmd_case_contains()
2392 for (cit = cip->ci_items; cit != NULL; cit = cit->cit_next) { in fmd_case_contains()
2397 if (rv == 0 && cip->ci_principal != NULL) in fmd_case_contains()
2398 rv = fmd_event_equal(ep, cip->ci_principal); in fmd_case_contains()
2400 (void) pthread_mutex_unlock(&cip->ci_lock); in fmd_case_contains()
2431 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_set_de_fmri() local
2433 nvlist_free(cip->ci_diag_de); in fmd_case_set_de_fmri()
2434 cip->ci_diag_de = nvl; in fmd_case_set_de_fmri()
2440 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_setcode() local
2442 cip->ci_code = fmd_strdup(code, FMD_SLEEP); in fmd_case_setcode()
2443 cip->ci_codelen = cip->ci_code ? strlen(cip->ci_code) + 1 : 0; in fmd_case_setcode()
2456 fmd_case_impl_t *cip = (fmd_case_impl_t *)cp; in fmd_case_repair_replay_case() local
2458 if (cip->ci_state < FMD_CASE_SOLVED || cip->ci_xprt != NULL) in fmd_case_repair_replay_case()
2461 if (cip->ci_state == FMD_CASE_RESOLVED) { in fmd_case_repair_replay_case()
2462 cip->ci_flags |= FMD_CF_RES_CMPL; in fmd_case_repair_replay_case()
2470 if (cip->ci_state >= FMD_CASE_REPAIRED && !faulty) { in fmd_case_repair_replay_case()
2479 cip->ci_state = FMD_CASE_RESOLVED; in fmd_case_repair_replay_case()
2482 cip->ci_uuid)); in fmd_case_repair_replay_case()
2490 cip->ci_uuid)); in fmd_case_repair_replay_case()
2494 cip->ci_flags |= FMD_CF_RES_CMPL; in fmd_case_repair_replay_case()
2497 cip->ci_uuid)); in fmd_case_repair_replay_case()
2510 cip->ci_uuid)); in fmd_case_repair_replay_case()