void
internal_service_free(entity_t *s)
{
	entity_t *inst;
	pgroup_t *pg;
	void *cookie;

	if (s->sc_u.sc_service.sc_restarter != NULL)
		internal_instance_free(s->sc_u.sc_service.sc_restarter);
	if (s->sc_u.sc_service.sc_global != NULL)
		internal_instance_free(s->sc_u.sc_service.sc_global);

	cookie = NULL;
	while ((pg = uu_list_teardown(s->sc_pgroups, &cookie)) != NULL)
		internal_pgroup_free(pg);

	cookie = NULL;
	while ((pg = uu_list_teardown(s->sc_dependents, &cookie)) != NULL)
		internal_pgroup_free(pg);

	cookie = NULL;
	while ((inst = uu_list_teardown(s->sc_u.sc_service.sc_service_instances,
	    &cookie)) != NULL)
		internal_instance_free(inst);
	uu_free((void *)s->sc_fmri);

	free(s);
}
Exemple #2
0
void
internal_instance_free(entity_t *i)
{
	pgroup_t *pg;
	void *cookie = NULL;

	while ((pg = uu_list_teardown(i->sc_pgroups, &cookie)) != NULL)
		internal_pgroup_free(pg);

	cookie = NULL;
	while ((pg = uu_list_teardown(i->sc_dependents, &cookie)) != NULL)
		internal_pgroup_free(pg);

	free(i);
}
void
internal_instance_free(entity_t *i)
{
	pgroup_t *pg;
	void *cookie = NULL;
	entity_t *rs;

	rs = i->sc_u.sc_instance.sc_instance_restarter;
	if (rs != NULL)
		internal_instance_free(rs);
	while ((pg = uu_list_teardown(i->sc_pgroups, &cookie)) != NULL)
		internal_pgroup_free(pg);

	cookie = NULL;
	while ((pg = uu_list_teardown(i->sc_dependents, &cookie)) != NULL)
		internal_pgroup_free(pg);
	uu_free((void *)i->sc_fmri);

	free(i);
}
Exemple #4
0
void
internal_pgroup_free(pgroup_t *pg)
{
	property_t *prop;
	void *cookie = NULL;

	while ((prop = uu_list_teardown(pg->sc_pgroup_props, &cookie)) != NULL)
		internal_property_free(prop);

	uu_free(pg);
}
void
internal_bundle_free(bundle_t *b)
{
	void *cookie = NULL;
	entity_t *service;

	while ((service = uu_list_teardown(b->sc_bundle_services, &cookie)) !=
	    NULL)
		internal_service_free(service);

	free(b);
}
Exemple #6
0
void
destroy_proto_list(basic_cfg_t *cfg)
{
	void		*cookie = NULL;
	proto_info_t	*pi;

	if (cfg->proto_list == NULL)
		return;

	while ((pi = uu_list_teardown(cfg->proto_list, &cookie)) != NULL)
		destroy_proto_info(cfg, pi);
	uu_list_destroy(cfg->proto_list);
	cfg->proto_list = NULL;
}
Exemple #7
0
void
internal_property_free(property_t *p)
{
	value_t *val;
	void *cookie = NULL;

	while ((val = uu_list_teardown(p->sc_property_values, &cookie)) !=
	    NULL) {
		if (val->sc_free != NULL)
			val->sc_free(val);
		free(val);
	}

	free(p);
}
Exemple #8
0
/*
 * A counterpart to add_proto_list(), this function removes and frees the
 * scf_value_t's it added to entry 'entry'.
 */
static void
remove_proto_list(scf_transaction_entry_t *entry, uu_list_t *sv_list)
{
	scf_val_el_t	*sv_el;
	void		*cookie = NULL;

	scf_entry_reset(entry);

	while ((sv_el = uu_list_teardown(sv_list, &cookie)) != NULL) {
		scf_value_destroy(sv_el->val);
		free(sv_el);
	}

	uu_list_destroy(sv_list);
}
void
internal_pgroup_free(pgroup_t *pg)
{
	property_t *prop;
	void *cookie = NULL;

	/*
	 * Templates validation code should clean up this reference when
	 * the validation is finished.
	 */
	assert(pg->sc_pgroup_composed == NULL);

	while ((prop = uu_list_teardown(pg->sc_pgroup_props, &cookie)) != NULL)
		internal_property_free(prop);

	uu_free(pg);
}
Exemple #10
0
/*
 * Release any memory associated with a changelist.
 */
void
changelist_free(prop_changelist_t *clp)
{
	prop_changenode_t *cn;
	void *cookie;

	if (clp->cl_list) {
		cookie = NULL;
		while ((cn = uu_list_teardown(clp->cl_list, &cookie)) != NULL) {
			zfs_close(cn->cn_handle);
			free(cn);
		}

		uu_list_destroy(clp->cl_list);
	}
	if (clp->cl_pool)
		uu_list_pool_destroy(clp->cl_pool);

	free(clp);
}
Exemple #11
0
void
destroy_tlx_info(tlx_info_t *tlx)
{
	tlx_conn_ind_t  *ci;
	void		*cookie = NULL;

	if (tlx == NULL)
		return;

	free(tlx->dev_name);

	if (tlx->conn_ind_queue != NULL) {
		/* free up conn ind queue */
		while ((ci = uu_list_teardown(tlx->conn_ind_queue, &cookie)) !=
		    NULL) {
			(void) t_free((char *)ci->call, T_CALL);
			free(ci);
		}
		uu_list_destroy(tlx->conn_ind_queue);
	}

	free(tlx->local_addr.buf);
	free(tlx);
}