Example #1
0
static void
branch_free(fmd_hdl_t *hdl, cmd_branch_t *branch, int destroy)
{
	fmd_hdl_debug(hdl, "Free branch %s\n", branch->branch_unum);
	if (branch->branch_case.cc_cp != NULL) {
		if (destroy) {
			if (branch->branch_case.cc_serdnm != NULL) {
				fmd_serd_destroy(hdl,
				    branch->branch_case.cc_serdnm);
				fmd_hdl_strfree(hdl,
				    branch->branch_case.cc_serdnm);
				branch->branch_case.cc_serdnm = NULL;
			}
		}
		cmd_case_fini(hdl, branch->branch_case.cc_cp, destroy);
	}

	branch_dimmlist_free(hdl, branch);
	cmd_fmri_fini(hdl, &branch->branch_asru, destroy);

	if (destroy)
		fmd_buf_destroy(hdl, NULL, branch->branch_bufname);
	cmd_list_delete(&cmd.cmd_branches, branch);
	fmd_hdl_free(hdl, branch, sizeof (cmd_branch_t));
}
Example #2
0
static void
cmd_dimm_free(fmd_hdl_t *hdl, cmd_dimm_t *dimm, int destroy)
{
	cmd_case_t *cc = &dimm->dimm_case;

#ifdef sun4v
	cmd_branch_t *branch;
#endif
	if (cc->cc_cp != NULL) {
		cmd_case_fini(hdl, cc->cc_cp, destroy);
		if (cc->cc_serdnm != NULL) {
			if (fmd_serd_exists(hdl, cc->cc_serdnm) &&
			    destroy)
				fmd_serd_destroy(hdl, cc->cc_serdnm);
			fmd_hdl_strfree(hdl, cc->cc_serdnm);
		}
	}

	if (dimm->dimm_bank != NULL)
		cmd_bank_remove_dimm(hdl, dimm->dimm_bank, dimm);
#ifdef sun4v
	branch = cmd_branch_lookup_by_unum(hdl, dimm->dimm_unum);
	if (branch != NULL)
		cmd_branch_remove_dimm(hdl, branch, dimm);
#endif

	cmd_fmri_fini(hdl, &dimm->dimm_asru, destroy);

	if (destroy)
		fmd_buf_destroy(hdl, NULL, dimm->dimm_bufname);
	cmd_list_delete(&cmd.cmd_dimms, dimm);
	fmd_hdl_free(hdl, dimm, sizeof (cmd_dimm_t));
}