It allows us to remove the code that does the same thing manually.
Signed-off-by: Igor Ryzhov <iryzhov@nfware.com>
return NULL;
}
-
-char *affinity_map_name_get(int pos)
-{
- struct listnode *node;
- struct affinity_map *map;
-
- if (!affinity_map_master.maps)
- return NULL;
-
- for (ALL_LIST_ELEMENTS_RO(affinity_map_master.maps, node, map))
- if (map->bit_position == pos)
- return map->name;
- return NULL;
-}
-
bool affinity_map_check_update_hook(const char *affmap_name, uint16_t new_pos)
{
if (affinity_map_master.check_update_hook)
void affinity_map_set(const char *name, int pos);
void affinity_map_unset(const char *name);
struct affinity_map *affinity_map_get(const char *name);
-char *affinity_map_name_get(const int pos);
bool affinity_map_check_update_hook(const char *affmap_name, uint16_t new_pos);
void affinity_map_update_hook(const char *affmap_name, uint16_t new_pos);
static int lib_affinity_map_value_modify(struct nb_cb_modify_args *args)
{
const char *name;
- char *map_name;
uint16_t pos;
name = yang_dnode_get_string(
switch (args->event) {
case NB_EV_VALIDATE:
- map_name = affinity_map_name_get(pos);
- if (map_name &&
- strncmp(map_name, name, AFFINITY_NAME_SIZE) != 0) {
- snprintf(args->errmsg, args->errmsg_len,
- "bit-position is used by %s.", map_name);
- return NB_ERR_VALIDATION;
- }
if (!affinity_map_check_update_hook(name, pos)) {
snprintf(
args->errmsg, args->errmsg_len,
"Affinity Mapping Table";
list affinity-map {
key "name";
+ unique "value";
description
"Affinity Mapping configuration";
leaf name {