本文整理汇总了C++中KMEM_CACHE函数的典型用法代码示例。如果您正苦于以下问题:C++ KMEM_CACHE函数的具体用法?C++ KMEM_CACHE怎么用?C++ KMEM_CACHE使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了KMEM_CACHE函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: fscrypt_init
/**
* fscrypt_init() - Set up for fs encryption.
*/
static int __init fscrypt_init(void)
{
/*
* Use an unbound workqueue to allow bios to be decrypted in parallel
* even when they happen to complete on the same CPU. This sacrifices
* locality, but it's worthwhile since decryption is CPU-intensive.
*
* Also use a high-priority workqueue to prioritize decryption work,
* which blocks reads from completing, over regular application tasks.
*/
fscrypt_read_workqueue = alloc_workqueue("fscrypt_read_queue",
WQ_UNBOUND | WQ_HIGHPRI,
num_online_cpus());
if (!fscrypt_read_workqueue)
goto fail;
fscrypt_ctx_cachep = KMEM_CACHE(fscrypt_ctx, SLAB_RECLAIM_ACCOUNT);
if (!fscrypt_ctx_cachep)
goto fail_free_queue;
fscrypt_info_cachep = KMEM_CACHE(fscrypt_info, SLAB_RECLAIM_ACCOUNT);
if (!fscrypt_info_cachep)
goto fail_free_ctx;
return 0;
fail_free_ctx:
kmem_cache_destroy(fscrypt_ctx_cachep);
fail_free_queue:
destroy_workqueue(fscrypt_read_workqueue);
fail:
return -ENOMEM;
}
开发者ID:avagin,项目名称:linux,代码行数:36,代码来源:crypto.c
示例2: ext4_init_pageio
int __init ext4_init_pageio(void)
{
io_page_cachep = KMEM_CACHE(ext4_io_page, SLAB_RECLAIM_ACCOUNT);
if (io_page_cachep == NULL)
return -ENOMEM;
io_end_cachep = KMEM_CACHE(ext4_io_end, SLAB_RECLAIM_ACCOUNT);
if (io_end_cachep == NULL) {
kmem_cache_destroy(io_page_cachep);
return -ENOMEM;
}
return 0;
}
开发者ID:jing-git,项目名称:rt-n56u,代码行数:12,代码来源:page-io.c
示例3: ext4_init_system_zone
int __init ext4_init_system_zone(void)
{
ext4_system_zone_cachep = KMEM_CACHE(ext4_system_zone, 0);
if (ext4_system_zone_cachep == NULL)
return -ENOMEM;
return 0;
}
开发者ID:Albinoman887,项目名称:pyramid-3.4.10,代码行数:7,代码来源:block_validity.c
示例4: ext4_init_pageio
int __init ext4_init_pageio(void)
{
io_end_cachep = KMEM_CACHE(ext4_io_end, SLAB_RECLAIM_ACCOUNT);
if (io_end_cachep == NULL)
return -ENOMEM;
return 0;
}
开发者ID:acton393,项目名称:linux,代码行数:7,代码来源:page-io.c
示例5: ext4_init_pageio
int __init ext4_init_pageio(void)
{
int i;
io_page_cachep = KMEM_CACHE(ext4_io_page, SLAB_RECLAIM_ACCOUNT);
if (io_page_cachep == NULL)
return -ENOMEM;
io_end_cachep = KMEM_CACHE(ext4_io_end, SLAB_RECLAIM_ACCOUNT);
if (io_end_cachep == NULL) {
kmem_cache_destroy(io_page_cachep);
return -ENOMEM;
}
for (i = 0; i < WQ_HASH_SZ; i++)
init_waitqueue_head(&ioend_wq[i]);
return 0;
}
开发者ID:BackupTheBerlios,项目名称:gemini-board,代码行数:17,代码来源:page-io.c
示例6: dm_bio_prison_init
static int __init dm_bio_prison_init(void)
{
_cell_cache = KMEM_CACHE(dm_bio_prison_cell, 0);
if (!_cell_cache)
return -ENOMEM;
return 0;
}
开发者ID:03199618,项目名称:linux,代码行数:8,代码来源:dm-bio-prison.c
示例7: ext4_init_crypto
/**
* ext4_init_crypto() - Set up for ext4 encryption.
*
* We only call this when we start accessing encrypted files, since it
* results in memory getting allocated that wouldn't otherwise be used.
*
* Return: Zero on success, non-zero otherwise.
*/
int ext4_init_crypto(void)
{
int i, res = -ENOMEM;
mutex_lock(&crypto_init);
if (ext4_read_workqueue)
goto already_initialized;
ext4_read_workqueue = alloc_workqueue("ext4_crypto", WQ_HIGHPRI, 0);
if (!ext4_read_workqueue)
goto fail;
ext4_crypto_ctx_cachep = KMEM_CACHE(ext4_crypto_ctx,
SLAB_RECLAIM_ACCOUNT);
if (!ext4_crypto_ctx_cachep)
goto fail;
ext4_crypt_info_cachep = KMEM_CACHE(ext4_crypt_info,
SLAB_RECLAIM_ACCOUNT);
if (!ext4_crypt_info_cachep)
goto fail;
for (i = 0; i < num_prealloc_crypto_ctxs; i++) {
struct ext4_crypto_ctx *ctx;
ctx = kmem_cache_zalloc(ext4_crypto_ctx_cachep, GFP_NOFS);
if (!ctx) {
res = -ENOMEM;
goto fail;
}
list_add(&ctx->free_list, &ext4_free_crypto_ctxs);
}
ext4_bounce_page_pool =
mempool_create_page_pool(num_prealloc_crypto_pages, 0);
if (!ext4_bounce_page_pool) {
res = -ENOMEM;
goto fail;
}
already_initialized:
mutex_unlock(&crypto_init);
return 0;
fail:
ext4_exit_crypto();
mutex_unlock(&crypto_init);
return res;
}
开发者ID:Menpiko,项目名称:SnaPKernel-N6P,代码行数:54,代码来源:crypto.c
示例8: init_ext4_system_zone
int __init init_ext4_system_zone(void)
{
ext4_system_zone_cachep = KMEM_CACHE(ext4_system_zone,
SLAB_RECLAIM_ACCOUNT);
if (ext4_system_zone_cachep == NULL)
return -ENOMEM;
return 0;
}
开发者ID:ditu123,项目名称:LuPuS-STOCK-ICS-Xperia2011,代码行数:8,代码来源:block_validity.c
示例9: dm_kcopyd_init
int __init dm_kcopyd_init(void)
{
_job_cache = KMEM_CACHE(kcopyd_job, 0);
if (!_job_cache)
return -ENOMEM;
return 0;
}
开发者ID:E-LLP,项目名称:n900,代码行数:8,代码来源:dm-kcopyd.c
示例10: mmap_init
/*
* initialise the VMA and region record slabs
*/
void __init mmap_init(void)
{
int ret;
ret = percpu_counter_init(&vm_committed_as, 0, GFP_KERNEL);
VM_BUG_ON(ret);
vm_region_jar = KMEM_CACHE(vm_region, SLAB_PANIC);
}
开发者ID:rochecr,项目名称:linux,代码行数:11,代码来源:nommu.c
示例11: dm_io_init
int __init dm_io_init(void)
{
_dm_io_cache = KMEM_CACHE(io, 0);
if (!_dm_io_cache)
return -ENOMEM;
return 0;
}
开发者ID:JamesAng,项目名称:lx-sk,代码行数:8,代码来源:dm-io.c
示例12: kvm_async_pf_init
int kvm_async_pf_init(void)
{
async_pf_cache = KMEM_CACHE(kvm_async_pf, 0);
if (!async_pf_cache)
return -ENOMEM;
return 0;
}
开发者ID:LuweiLight,项目名称:linux-3.14.35-vbal,代码行数:9,代码来源:async_pf.c
示例13: i915_global_context_init
int __init i915_global_context_init(void)
{
global.slab_ce = KMEM_CACHE(intel_context, SLAB_HWCACHE_ALIGN);
if (!global.slab_ce)
return -ENOMEM;
i915_global_register(&global.base);
return 0;
}
开发者ID:grate-driver,项目名称:linux,代码行数:9,代码来源:intel_context.c
示例14: iostash_init
static int __init iostash_init(void)
{
int ret = -1, i;
#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,28)
ERR("Kernel version < 2.6.28 not supported.");
return -ENOENT;
#endif
DBG("++ iostash_init() ++\n");
memset(&gctx, 0, sizeof(gctx));
do {
gctx.io_pool = KMEM_CACHE(iostash_bio, 0);
if (!gctx.io_pool) {
ERR("iostash_init: KMEM_CACHE() failed\n");
break;
}
gctx.io_client = dm_io_client_create();
if (IS_ERR(gctx.io_client)) {
ERR("iostash_init: dm_io_client() failed\n");
break;
}
gctx.sce = sce_create();
if (!gctx.sce) {
ERR("iostash_init: sce_create() failed\n");
break;
}
gctx.pdm = pdm_create(gctx.sce, poptask_read, poptask_write);
if (_init_iostash_kobjects()) {
ERR("KOBJECT INIT FAILED!");
_destroy_iostash_kobjects();
}
mutex_init(&gctx.ctl_mtx);
for (i = 0; i < IOSTASH_MAXHDD_BCKTS; ++i)
INIT_LIST_HEAD(&gctx.hddtbl.bucket[i]);
for (i = 0; i < IOSTASH_MAXSSD_BCKTS; ++i)
INIT_LIST_HEAD(&gctx.ssdtbl.bucket[i]);
ret = 0;
} while (0);
if (ret) {
_free_resource();
}
DBG("-- iostash_init() returns = %d --\n", ret);
return ret;
}
开发者ID:ETSENGENEERINGSYSTEMS,项目名称:iostash,代码行数:56,代码来源:iostash_module.c
示例15: ua_init
int ua_init(void)
{
ua_cache = KMEM_CACHE(ua_entry, 0);
if (!ua_cache) {
eprintk("%s", "Failed to create ua cache\n");
return -ENOMEM;
}
return 0;
}
开发者ID:kissthink,项目名称:IET,代码行数:10,代码来源:ua.c
示例16: kllds_init_module
static int __init kllds_init_module(void) {
int ret_val;
ret_val = register_chrdev(CHRDEV_MJR_NUM, LLDS_CDEV_NAME, &fops);
printk(KERN_INFO "llds: make sure you execute the following:\nllds: # mknod /dev/%s c %d 0\nllds: before attempting to work with libforrest (unless it exists)!\n", LLDS_CDEV_NAME, CHRDEV_MJR_NUM);
printk(KERN_INFO "llds: page size is %lu bytes\n", PAGE_SIZE);
tmp_kllds_cache = KMEM_CACHE(__kllds_entry, SLAB_HWCACHE_ALIGN);
return 0;
}
开发者ID:HackLinux,项目名称:llds,代码行数:10,代码来源:llds.c
示例17: jbd2_journal_init_revoke_caches
int __init jbd2_journal_init_revoke_caches(void)
{
J_ASSERT(!jbd2_revoke_record_cache);
J_ASSERT(!jbd2_revoke_table_cache);
jbd2_revoke_record_cache = KMEM_CACHE(jbd2_revoke_record_s,
SLAB_HWCACHE_ALIGN|SLAB_TEMPORARY);
if (!jbd2_revoke_record_cache)
goto record_cache_failure;
jbd2_revoke_table_cache = KMEM_CACHE(jbd2_revoke_table_s,
SLAB_TEMPORARY);
if (!jbd2_revoke_table_cache)
goto table_cache_failure;
return 0;
table_cache_failure:
jbd2_journal_destroy_revoke_caches();
record_cache_failure:
return -ENOMEM;
}
开发者ID:AlexShiLucky,项目名称:linux,代码行数:20,代码来源:revoke.c
示例18: vmmr0_async_pf_init
int vmmr0_async_pf_init(void)
{
async_pf_cache = KMEM_CACHE(vmmr0_async_pf, 0);
if (!async_pf_cache)
{
return -ENOMEM;
}
return 0;
}
开发者ID:cgvarela,项目名称:fvm,代码行数:11,代码来源:async_pf.c
示例19: ua_init
int ua_init(void)
{
#ifdef LINUX
ua_cache = KMEM_CACHE(ua_entry, 0);
#else
ua_cache = uma_zcreate("ietuacache", sizeof(struct ua_entry), NULL, NULL, NULL, NULL, 0, 0);
#endif
if (!ua_cache) {
eprintk("%s", "Failed to create ua cache\n");
return -ENOMEM;
}
return 0;
}
开发者ID:delphij,项目名称:ietbsd,代码行数:14,代码来源:ua.c
示例20: f2fs_init_crypto
int __init f2fs_init_crypto(void)
{
int res = -ENOMEM;
f2fs_read_workqueue = alloc_workqueue("f2fs_crypto", WQ_HIGHPRI, 0);
if (!f2fs_read_workqueue)
goto fail;
f2fs_crypto_ctx_cachep = KMEM_CACHE(f2fs_crypto_ctx,
SLAB_RECLAIM_ACCOUNT);
if (!f2fs_crypto_ctx_cachep)
goto fail;
f2fs_crypt_info_cachep = KMEM_CACHE(f2fs_crypt_info,
SLAB_RECLAIM_ACCOUNT);
if (!f2fs_crypt_info_cachep)
goto fail;
return 0;
fail:
f2fs_exit_crypto();
return res;
}
开发者ID:Swapnil133609,项目名称:Zeus_sprout,代码行数:23,代码来源:crypto.c
注:本文中的KMEM_CACHE函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论