diff --git a/inc/ocf_cache.h b/inc/ocf_cache.h index cfb89a05..e3ff051f 100644 --- a/inc/ocf_cache.h +++ b/inc/ocf_cache.h @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2023 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -154,6 +155,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 initializing + * + * @param[in] cache Cache object + * + * @retval 1 Caching device is initializing + * @retval 0 Caching device is not initializing + */ +bool ocf_cache_is_initializing(ocf_cache_t cache); + /** * @brief Check if cache object is standby * diff --git a/src/ocf_cache.c b/src/ocf_cache.c index be112447..211708e1 100644 --- a/src/ocf_cache.c +++ b/src/ocf_cache.c @@ -1,5 +1,6 @@ /* * Copyright(c) 2012-2021 Intel Corporation + * Copyright(c) 2023 Huawei Technologies * SPDX-License-Identifier: BSD-3-Clause */ @@ -62,6 +63,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_initializing(ocf_cache_t cache) +{ + OCF_CHECK_NULL(cache); + return env_bit_test(ocf_cache_state_initializing, &cache->cache_state); +} + bool ocf_cache_is_standby(ocf_cache_t cache) { OCF_CHECK_NULL(cache);