fib: Expressive type for walk return code. Honour code.
Type: improvement
Signed-off-by: Neale Ranns <neale.ranns@cisco.com>
Change-Id: I487e698555545fce85d02d55deaaf7bb0007e388
diff --git a/src/vnet/dpo/load_balance_map.c b/src/vnet/dpo/load_balance_map.c
index c03acaf..de5f30b 100644
--- a/src/vnet/dpo/load_balance_map.c
+++ b/src/vnet/dpo/load_balance_map.c
@@ -491,7 +491,7 @@
}
}
-static int
+static walk_rc_t
load_balance_map_path_state_change_walk (fib_node_ptr_t *fptr,
void *ctx)
{
@@ -501,7 +501,7 @@
load_balance_map_fill(lbm);
- return (!0);
+ return (WALK_CONTINUE);
}
/**
diff --git a/src/vnet/fib/fib_attached_export.c b/src/vnet/fib/fib_attached_export.c
index 4a33b88..5ea96fd 100644
--- a/src/vnet/fib/fib_attached_export.c
+++ b/src/vnet/fib/fib_attached_export.c
@@ -205,7 +205,7 @@
/**
* Call back when walking a connected prefix's covered prefixes for import
*/
-static int
+static walk_rc_t
fib_entry_covered_walk_import (fib_entry_t *cover,
fib_node_index_t covered,
void *ctx)
@@ -214,7 +214,7 @@
fib_entry_import_add(import, covered);
- return (0);
+ return (WALK_CONTINUE);
}
/*
diff --git a/src/vnet/fib/fib_entry_cover.c b/src/vnet/fib/fib_entry_cover.c
index 153bd70..47bc5c3 100644
--- a/src/vnet/fib/fib_entry_cover.c
+++ b/src/vnet/fib/fib_entry_cover.c
@@ -72,7 +72,7 @@
void *ctx;
} fib_enty_cover_walk_ctx_t;
-static int
+static walk_rc_t
fib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
void *args)
{
@@ -80,8 +80,7 @@
ctx->walk(ctx->cover, depend->fnp_index, ctx->ctx);
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void
@@ -107,7 +106,7 @@
&ctx);
}
-static int
+static walk_rc_t
fib_entry_cover_change_one (fib_entry_t *cover,
fib_node_index_t covered,
void *args)
@@ -144,8 +143,7 @@
fib_entry_cover_changed(covered);
}
}
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void
@@ -161,15 +159,14 @@
uword_to_pointer(covered, void*));
}
-static int
+static walk_rc_t
fib_entry_cover_update_one (fib_entry_t *cover,
fib_node_index_t covered,
void *args)
{
fib_entry_cover_updated(covered);
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void
diff --git a/src/vnet/fib/fib_entry_cover.h b/src/vnet/fib/fib_entry_cover.h
index 500d5b3..499efdc 100644
--- a/src/vnet/fib/fib_entry_cover.h
+++ b/src/vnet/fib/fib_entry_cover.h
@@ -21,9 +21,9 @@
/**
* callback function used when walking the covered entries
*/
-typedef int (*fib_entry_covered_walk_t)(fib_entry_t *cover,
- fib_node_index_t covered,
- void *ctx);
+typedef walk_rc_t (*fib_entry_covered_walk_t)(fib_entry_t *cover,
+ fib_node_index_t covered,
+ void *ctx);
extern u32 fib_entry_cover_track(fib_entry_t *cover,
fib_node_index_t covered);
diff --git a/src/vnet/fib/fib_node.c b/src/vnet/fib/fib_node.c
index 3e99007..1d3abd5 100644
--- a/src/vnet/fib/fib_node.c
+++ b/src/vnet/fib/fib_node.c
@@ -161,7 +161,7 @@
return (fn_vfts[ptr->fnp_type].fnv_back_walk(node, ctx));
}
-static int
+static walk_rc_t
fib_node_ptr_format_one_child (fib_node_ptr_t *ptr,
void *arg)
{
@@ -169,7 +169,7 @@
*s = fib_node_format(ptr, *s);
- return (1);
+ return (WALK_CONTINUE);
}
u8*
diff --git a/src/vnet/fib/fib_node_list.c b/src/vnet/fib/fib_node_list.c
index ceb951b..bcd9a09 100644
--- a/src/vnet/fib/fib_node_list.c
+++ b/src/vnet/fib/fib_node_list.c
@@ -372,7 +372,8 @@
elt = fib_node_list_elt_get(sibling);
sibling = elt->fnle_next;
- fn(&elt->fnle_owner, args);
+ if (WALK_STOP == fn(&elt->fnle_owner, args))
+ break;
}
}
diff --git a/src/vnet/fib/fib_node_list.h b/src/vnet/fib/fib_node_list.h
index 9567b96..76abec5 100644
--- a/src/vnet/fib/fib_node_list.h
+++ b/src/vnet/fib/fib_node_list.h
@@ -52,8 +52,8 @@
/**
* @brief Callback function invoked during a list walk
*/
-typedef int (*fib_node_list_walk_cb_t)(fib_node_ptr_t *owner,
- void *args);
+typedef walk_rc_t (*fib_node_list_walk_cb_t)(fib_node_ptr_t *owner,
+ void *args);
extern void fib_node_list_walk(fib_node_list_t head,
fib_node_list_walk_cb_t fn,
diff --git a/src/vnet/mfib/mfib_entry_cover.c b/src/vnet/mfib/mfib_entry_cover.c
index 6caeb1b..2f5fd6b 100644
--- a/src/vnet/mfib/mfib_entry_cover.c
+++ b/src/vnet/mfib/mfib_entry_cover.c
@@ -71,7 +71,7 @@
void *ctx;
} mfib_enty_cover_walk_ctx_t;
-static int
+static walk_rc_t
mfib_entry_cover_walk_node_ptr (fib_node_ptr_t *depend,
void *args)
{
@@ -79,8 +79,7 @@
ctx->walk(ctx->cover, depend->fnp_index, ctx->ctx);
- /* continue */
- return (1);
+ return (WALK_CONTINUE);
}
void