From fdd834b8cc69b1b8c9bdfcfa1f033f35affb4c09 Mon Sep 17 00:00:00 2001 From: Igor Ryzhov Date: Thu, 18 Jan 2024 23:27:56 +0200 Subject: lib: validate affinity-map reference using yang model Change the type of affinity leaf-list in frr-zebra to a leafref with "require-instance" property set to true. This change tells libyang to automatically check that affinity-map exists before usage and doesn't allow it to be deleted if it's referenced. It allows us to remove all the manual code that is doing the same thing. Signed-off-by: Igor Ryzhov --- lib/affinitymap.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) (limited to 'lib/affinitymap.c') diff --git a/lib/affinitymap.c b/lib/affinitymap.c index 17e1b2cc01..b748e74884 100644 --- a/lib/affinitymap.c +++ b/lib/affinitymap.c @@ -47,7 +47,7 @@ DEFINE_MTYPE_STATIC(LIB, AFFINITY_MAP_INDEX, "Affinity map index"); DEFINE_QOBJ_TYPE(affinity_maps); DEFINE_QOBJ_TYPE(affinity_map); -struct affinity_maps affinity_map_master = {NULL, NULL, NULL, NULL}; +struct affinity_maps affinity_map_master = {NULL, NULL, NULL}; static void affinity_map_free(struct affinity_map *map) { @@ -121,13 +121,6 @@ char *affinity_map_name_get(int pos) return NULL; } -bool affinity_map_check_use_hook(const char *affmap_name) -{ - if (affinity_map_master.check_use_hook) - return (*affinity_map_master.check_use_hook)(affmap_name); - return false; -} - bool affinity_map_check_update_hook(const char *affmap_name, uint16_t new_pos) { if (affinity_map_master.check_update_hook) @@ -153,12 +146,6 @@ void affinity_map_update_hook(const char *affmap_name, uint16_t new_pos) new_pos); } - -void affinity_map_set_check_use_hook(bool (*func)(const char *affmap_name)) -{ - affinity_map_master.check_use_hook = func; -} - void affinity_map_set_check_update_hook(bool (*func)(const char *affmap_name, uint16_t new_pos)) { -- cgit v1.2.3