Merge pull request #348 from robertbaldyga/introduce-core-priv

Introduce core priv
This commit is contained in:
Robert Baldyga 2020-03-03 15:52:59 +01:00 committed by GitHub
commit 2a7a2bd6ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 31 additions and 0 deletions

View File

@ -239,4 +239,21 @@ int ocf_core_visit(ocf_cache_t cache, ocf_core_visitor_t visitor, void *cntx,
*/ */
int ocf_core_get_info(ocf_core_t core, struct ocf_core_info *info); int ocf_core_get_info(ocf_core_t core, struct ocf_core_info *info);
/**
* @brief Set core private data
*
* @param[in] core Core object
* @param[in] priv Private data
*/
void ocf_core_set_priv(ocf_core_t core, void *priv);
/**
* @brief Get core private data
*
* @param[in] core Core object
*
* @retval Private data
*/
void *ocf_core_get_priv(ocf_core_t core);
#endif /* __OCF_CORE_H__ */ #endif /* __OCF_CORE_H__ */

View File

@ -620,3 +620,15 @@ int ocf_core_get_info(ocf_core_t core, struct ocf_core_info *info)
return 0; return 0;
} }
void ocf_core_set_priv(ocf_core_t core, void *priv)
{
OCF_CHECK_NULL(core);
core->priv = priv;
}
void *ocf_core_get_priv(ocf_core_t core)
{
OCF_CHECK_NULL(core);
return core->priv;
}

View File

@ -91,6 +91,8 @@ struct ocf_core {
uint32_t added : 1; uint32_t added : 1;
struct ocf_counters_core *counters; struct ocf_counters_core *counters;
void *priv;
}; };
bool ocf_core_is_valid(ocf_cache_t cache, ocf_core_id_t id); bool ocf_core_is_valid(ocf_cache_t cache, ocf_core_id_t id);