Ensure that core name is set and unique
Signed-off-by: Robert Baldyga <robert.baldyga@intel.com>
This commit is contained in:
@@ -16,6 +16,19 @@
|
||||
#include "ocf_io.h"
|
||||
#include "ocf_mngt.h"
|
||||
|
||||
/**
|
||||
* @brief Get OCF core by name
|
||||
*
|
||||
* @param[in] cache OCF cache
|
||||
* @param[in] name Core name
|
||||
* @param[out] core OCF core handle
|
||||
*
|
||||
* @retval 0 Get cache successfully
|
||||
* @retval -OCF_ERR_CORE_NOT_EXIST Core with given name doesn't exist
|
||||
*/
|
||||
int ocf_core_get_by_name(ocf_cache_t cache, const char *name,
|
||||
ocf_core_t *core);
|
||||
|
||||
/**
|
||||
* @brief Obtain cache object from core
|
||||
*
|
||||
@@ -82,18 +95,6 @@ ocf_seq_cutoff_policy ocf_core_get_seq_cutoff_policy(ocf_core_t core);
|
||||
*/
|
||||
ocf_core_id_t ocf_core_get_id(ocf_core_t core);
|
||||
|
||||
/**
|
||||
* @brief Set name of given core object
|
||||
*
|
||||
* @param[in] core Core object
|
||||
* @param[in] src Source of Core name
|
||||
* @param[in] src_size Size of src
|
||||
*
|
||||
* @retval 0 Success
|
||||
* @retval Non-zero Fail
|
||||
*/
|
||||
int ocf_core_set_name(ocf_core_t core, const char *src, size_t src_size);
|
||||
|
||||
/**
|
||||
* @brief Get name of given core object
|
||||
*
|
||||
|
||||
@@ -60,9 +60,15 @@ typedef enum {
|
||||
/** Cache ID/name does not exist */
|
||||
OCF_ERR_CACHE_NOT_EXIST,
|
||||
|
||||
/** Core ID/name does not exist */
|
||||
OCF_ERR_CORE_NOT_EXIST,
|
||||
|
||||
/** Cache ID/name already exists */
|
||||
OCF_ERR_CACHE_EXIST,
|
||||
|
||||
/** Core ID/name already exists */
|
||||
OCF_ERR_CORE_EXIST,
|
||||
|
||||
/** Too many core devices in cache */
|
||||
OCF_ERR_TOO_MANY_CORES,
|
||||
|
||||
|
||||
@@ -58,7 +58,7 @@ struct ocf_mngt_core_config {
|
||||
/**
|
||||
* @brief Initialize core config to default values
|
||||
*
|
||||
* @note This function doesn't initiialize uuid and volume_type fields
|
||||
* @note This function doesn't initialize name, uuid and volume_type fields
|
||||
* which have no default values and are required to be set by user.
|
||||
*
|
||||
* @param[in] cfg Core config stucture
|
||||
@@ -67,7 +67,6 @@ static inline void ocf_mngt_core_config_set_default(
|
||||
struct ocf_mngt_core_config *cfg)
|
||||
{
|
||||
cfg->core_id = OCF_CORE_ID_INVALID;
|
||||
cfg->name = NULL;
|
||||
cfg->try_add = false;
|
||||
cfg->seq_cutoff_threshold = 1024;
|
||||
cfg->user_metadata.data = NULL;
|
||||
|
||||
Reference in New Issue
Block a user