diff --git a/inc/ocf_cache.h b/inc/ocf_cache.h index cf85cb2..0595d87 100644 --- a/inc/ocf_cache.h +++ b/inc/ocf_cache.h @@ -151,6 +151,16 @@ bool ocf_cache_is_device_attached(ocf_cache_t cache); */ bool ocf_cache_is_running(ocf_cache_t cache); +/** + * @brief Check if cache object is passive + * + * @param[in] cache Cache object + * + * @retval 1 Caching device is in passive state + * @retval 0 Caching device is not in passive state + */ +bool ocf_cache_is_passive(ocf_cache_t cache); + /** * @brief Get cache mode of given cache object * diff --git a/src/ocf_cache.c b/src/ocf_cache.c index a89655b..e78cd14 100644 --- a/src/ocf_cache.c +++ b/src/ocf_cache.c @@ -56,6 +56,12 @@ bool ocf_cache_is_running(ocf_cache_t cache) return env_bit_test(ocf_cache_state_running, &cache->cache_state); } +bool ocf_cache_is_passive(ocf_cache_t cache) +{ + OCF_CHECK_NULL(cache); + return env_bit_test(ocf_cache_state_passive, &cache->cache_state); +} + bool ocf_cache_is_device_attached(ocf_cache_t cache) { OCF_CHECK_NULL(cache);