コード例 #1
0
ファイル: sctp_cache.c プロジェクト: Aniruddha-Paul/openss7
void
sctp_init_caches(void)
{
	if (!sctp_sctp_cachep
	    && !(sctp_sctp_cachep =
		 kmem_create_cache("sctp_sctp_cachep", sizeof(sctp_t), 0, SLAB_HWCACHE_ALIGN, NULL,
				   NULL)))
		panic("%s:Cannot alloc sctp_sctp_cachep.\n", __FUNCTION__);
	if (!sctp_dest_cachep
	    && !(sctp_dest_cachep =
		 kmem_create_cache("sctp_dest_cachep", sizeof(sctp_daddr_t), 0, SLAB_HWCACHE_ALIGN,
				   NULL, NULL)))
		panic("%s:Cannot alloc sctp_dest_cachep.\n", __FUNCTION__);
	if (!sctp_srce_cachep
	    && !(sctp_srce_cachep =
		 kmem_create_cache("sctp_srce_cachep", sizeof(sctp_saddr_t), 0, SLAB_HWCACHE_ALIGN,
				   NULL, NULL)))
		panic("%s:Cannot alloc sctp_srce_cachep.\n", __FUNCTION__);
	if (!sctp_strm_cachep
	    && !(sctp_strm_cachep =
		 kmem_create_cache("sctp_strm_cachep", sizeof(sctp_strm_t), 0, SLAB_HWCACHE_ALIGN,
				   NULL, NULL)))
		panic("%s:Cannot alloc sctp_strm_cachep.\n", __FUNCTION__);
	return;
}
コード例 #2
0
ファイル: spm.c プロジェクト: Aniruddha-Paul/openss7
/*
 *  Cache allocation
 *  ------------------------------------------------------------------------
 */
STATIC int
spm_init_caches(void)
{
	if (!spm_priv_cachep &&
	    !(spm_priv_cachep = kmem_create_cache
	      ("spm_priv_cachep", sizeof(spm_t), 0, SLAB_HWCACHE_ALIGN, NULL, NULL))) {
		cmn_err(CE_PANIC, "%s: did not allocate spm_priv_cachep", MOD_NAME);
		return (-ENOMEM);
	} else
		printd(("%s: Allocated/selected private structure cache\n", MOD_NAME));
	return (0);
}
コード例 #3
0
ファイル: testdrv_mps.c プロジェクト: iHaD/openss7
static int
td_init_caches(void)
{
	if (!td_priv_cachep &&
	    !(td_priv_cachep =
	      kmem_create_cache("td_priv_cachep", mi_open_size(sizeof(struct td_priv)), 0,
				SLAB_HWCACHE_ALIGN, NULL, NULL))) {
		cmn_err(CE_WARN, "error: %s +%d: %s: cannot allocate td_priv_cachep",
			__FILE__, __LINE__, __FUNCTION__);
		return (-ENOMEM);
	}
	cmn_err(CE_DEBUG, "%s: initialized module private structure cache", DRV_NAME);
	return (0);
}
コード例 #4
0
ファイル: tali.c プロジェクト: iHaD/openss7
STATIC int
tali_init_caches(void)
{
	if (!(tali_pp_cachep))
		if (!(tali_pp_cachep = kmem_create_cache("tali_pp_cachep", sizeof(pp_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_pp_cache_allocated = 1;
	if (!(tali_xp_cachep))
		if (!(tali_xp_cachep = kmem_create_cache("tali_xp_cachep", sizeof(xp_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_xp_cache_allocated = 1;
	if (!(tali_gp_cachep))
		if (!(tali_gp_cachep = kmem_create_cache("tali_gp_cachep", sizeof(gp_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_gp_cache_allocated = 1;
	if (!(tali_sp_cachep))
		if (!(tali_sp_cachep = kmem_create_cache("tali_sp_cachep", sizeof(sp_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_sp_cache_allocated = 1;
	if (!(tali_as_cachep))
		if (!(tali_as_cachep = kmem_create_cache("tali_as_cachep", sizeof(as_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_as_cache_allocated = 1;
	if (!(tali_ap_cachep))
		if (!(tali_ap_cachep = kmem_create_cache("tali_ap_cachep", sizeof(ap_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_ap_cache_allocated = 1;
	if (!(tali_np_cachep))
		if (!(tali_np_cachep = kmem_create_cache("tali_np_cachep", sizeof(np_t),
							 0, SLAB_HWCACHE_ALIGN, NULL, NULL)))
			goto tali_init_caches_failed;
		else
			tali_np_cache_allocated = 1;
	return (0);

      tali_init_caches_failed:
	tali_term_caches();
	return (ENOMEM);
}
コード例 #5
0
ファイル: socksys.c プロジェクト: Aniruddha-Paul/openss7
STATIC __unlikely int
ssys_init_caches(void)
{
	if (ssys_priv_cachep == NULL) {
		ssys_priv_cachep =
		    kmem_create_cache("ssys_priv_cachep", sizeof(struct ssys), 0,
				      SLAB_HWCACHE_ALIGN, NULL, NULL);
		if (ssys_priv_cachep == NULL) {
			cmn_err(CE_WARN, "%s: Cannot allocation ssys_priv_cachep", __FUNCTION__);
			ssys_term_caches();
			return (-ENOMEM);
		}
		_printd(("%s: initialize driver private structure cache\n", DRV_NAME));
	}
	return (0);
}