コード例 #1
0
void
zcrypt_key_free(zcrypt_key_t *key)
{
#if _KERNEL
	if (key == NULL)
		return;

	refcount_destroy(&key->zk_refcnt);
	if (key->zk_key.ck_length != 0) {
		/*
		 * This will need updating for key
		 * types other than CRYPTO_KEY_RAW.
		 */
		bzero(key->zk_key.ck_data, key->zk_key.ck_length / 8);
		kmem_free(key->zk_key.ck_data, key->zk_key.ck_length / 8);
	}
	crypto_destroy_ctx_template(key->zk_ctx_tmpl);
	if (key->zk_mackey.ck_length != 0) {
		/*
		 * This will need updating for key
		 * types other than CRYPTO_KEY_RAW.
		 */
		bzero(key->zk_mackey.ck_data, key->zk_mackey.ck_length / 8);
		kmem_free(key->zk_mackey.ck_data, key->zk_mackey.ck_length / 8);
	}
	crypto_destroy_ctx_template(key->zk_mac_ctx_tmpl);
	bzero(key, sizeof (zcrypt_key_t));
	kmem_free(key, sizeof (zcrypt_key_t));
	key = NULL;
#endif
}
コード例 #2
0
ファイル: zfs_ctldir.c プロジェクト: MarkGavalda/zfs
/*
 * Free a zfs_snapentry_t the called must ensure there are no active
 * references.
 */
static void
zfsctl_snapshot_free(zfs_snapentry_t *se)
{
	refcount_destroy(&se->se_refcount);
	strfree(se->se_name);
	strfree(se->se_path);

	kmem_free(se, sizeof (zfs_snapentry_t));
}
コード例 #3
0
/* ARGSUSED */
static void
dnode_dest(void *arg, void *unused)
{
	int i;
	dnode_t *dn = arg;

	rw_destroy(&dn->dn_struct_rwlock);
	mutex_destroy(&dn->dn_mtx);
	mutex_destroy(&dn->dn_dbufs_mtx);
	cv_destroy(&dn->dn_notxholds);
	refcount_destroy(&dn->dn_holds);
	refcount_destroy(&dn->dn_tx_holds);

	for (i = 0; i < TXG_SIZE; i++) {
		avl_destroy(&dn->dn_ranges[i]);
		list_destroy(&dn->dn_dirty_records[i]);
	}

	list_destroy(&dn->dn_dbufs);
}
コード例 #4
0
ファイル: dnode.c プロジェクト: JackieXie168/mac-zfs
/* ARGSUSED */
static void
dnode_dest(void *arg, void *unused)
{
	int i;
	dnode_t *dn = arg;

	rw_destroy(&dn->dn_struct_rwlock);
// This is from the 10a286 bits
#ifdef __APPLE__
        cv_destroy(&dn->dn_notxholds);
#endif
	mutex_destroy(&dn->dn_mtx);
	mutex_destroy(&dn->dn_dbufs_mtx);
	refcount_destroy(&dn->dn_holds);
	refcount_destroy(&dn->dn_tx_holds);

	for (i = 0; i < TXG_SIZE; i++) {
		avl_destroy(&dn->dn_ranges[i]);
		list_destroy(&dn->dn_dirty_records[i]);
	}

	list_destroy(&dn->dn_dbufs);
}
コード例 #5
0
ファイル: sa.c プロジェクト: kelsieflynn/SamFlynnOS
static void
sa_idx_tab_rele(objset_t *os, void *arg)
{
	sa_os_t *sa = os->os_sa;
	sa_idx_tab_t *idx_tab = arg;

	if (idx_tab == NULL)
		return;

	mutex_enter(&sa->sa_lock);
	if (refcount_remove(&idx_tab->sa_refcount, NULL) == 0) {
		list_remove(&idx_tab->sa_layout->lot_idx_tab, idx_tab);
		if (idx_tab->sa_variable_lengths)
			kmem_free(idx_tab->sa_variable_lengths,
			    sizeof (uint16_t) *
			    idx_tab->sa_layout->lot_var_sizes);
		refcount_destroy(&idx_tab->sa_refcount);
		kmem_free(idx_tab->sa_idx_tab,
		    sizeof (uint32_t) * sa->sa_num_attrs);
		kmem_free(idx_tab, sizeof (sa_idx_tab_t));
	}
	mutex_exit(&sa->sa_lock);
}