ocf/src/mngt/ocf_mngt_misc.c
Robert Baldyga 331b99397f Change ctx lock to rmutex
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
2019-07-29 15:08:44 +02:00

30 lines
602 B
C

/*
* Copyright(c) 2012-2018 Intel Corporation
* SPDX-License-Identifier: BSD-3-Clause-Clear
*/
#include "ocf/ocf.h"
#include "ocf_mngt_common.h"
#include "../ocf_priv.h"
#include "../metadata/metadata.h"
#include "../engine/cache_engine.h"
#include "../ocf_ctx_priv.h"
uint32_t ocf_mngt_cache_get_count(ocf_ctx_t ctx)
{
struct ocf_cache *cache;
uint32_t count = 0;
OCF_CHECK_NULL(ctx);
env_rmutex_lock(&ctx->lock);
/* currently, there are no macros in list.h to get list size.*/
list_for_each_entry(cache, &ctx->caches, list)
count++;
env_rmutex_unlock(&ctx->lock);
return count;
}