57 while (*s && *s !=
',')
76 (_vlib_init_function_list_elt_t ** head)
80 u8 **init_f_names = 0;
82 char **these_constraints;
83 char *this_constraint_c;
95 _vlib_init_function_list_elt_t *this_reg = 0;
97 u8 **keys_to_delete = 0;
111 init_f_name =
format (0,
"%s%c", this_reg->name, 0);
116 vec_add1 (init_f_names, init_f_name);
118 these_constraints = this_reg->runs_before;
119 while (these_constraints && these_constraints[0])
121 this_constraint_c = these_constraints[0];
123 constraint_tuple =
format (0,
"%s,%s%c", init_f_name,
124 this_constraint_c, 0);
125 vec_add1 (constraints, constraint_tuple);
129 these_constraints = this_reg->runs_after;
130 while (these_constraints && these_constraints[0])
132 this_constraint_c = these_constraints[0];
134 constraint_tuple =
format (0,
"%s,%s%c",
135 this_constraint_c, init_f_name, 0);
136 vec_add1 (constraints, constraint_tuple);
140 this_reg = this_reg->next_init_function;
150 these_constraints = this_reg->init_order;
154 while (these_constraints && these_constraints[0])
156 this_constraint_c = these_constraints[0];
161 (
"order constraint fcn '%s' not found", this_constraint_c);
168 prev_name = this_constraint_c;
173 constraint_tuple =
format (0,
"%s,%s%c", prev_name,
174 this_constraint_c, 0);
175 vec_add1 (constraints, constraint_tuple);
176 prev_name = this_constraint_c;
179 this_reg = this_reg->next_init_function;
182 n_init_fns =
vec_len (init_f_names);
187 this_constraint = constraints[
i];
189 if (
comma_split (this_constraint, &a_name, &b_name))
200 clib_warning (
"init function '%s' not found (before '%s')",
209 clib_warning (
"init function '%s' not found (after '%s')",
216 orig[a_index][b_index] = 1;
225 for (
i = 0;
i < n_init_fns;
i++)
227 for (j = 0; j < n_init_fns; j++)
230 goto item_constrained;
235 for (k = 0; k < n_init_fns; k++)
249 if (
vec_len (result) != n_init_fns)
251 (0,
"Failed to find a suitable init function order!");
262 for (
i = 0;
i < n_init_fns;
i++)
266 this_reg = (_vlib_init_function_list_elt_t *) p[0];
268 this_reg->next_init_function = *head;
280 for (
i = 0;
i <
vec_len (keys_to_delete);
i++)
334 _vlib_init_function_list_elt_t **headp,
335 int call_once,
int do_sort,
int is_global)
339 _vlib_init_function_list_elt_t *
i;
367 i =
i->next_init_function;
374 _vlib_init_function_list_elt_t **headp,
383 _vlib_init_function_list_elt_t **headp,
396 #define _(f) vlib_##f##_reference ();
442 c =
c->next_registration;
468 if (is_early ^
c->is_early)
498 _vlib_init_function_list_elt_t *head, *
this;
505 this = this->next_init_function;
518 _vlib_init_function_list_elt_t *head, *
this;
519 uword *index_by_name;
521 u8 **init_f_names = 0;
524 _vlib_init_function_list_elt_t *this_reg = 0;
526 u8 **keys_to_delete = 0;
536 else if (
unformat (input,
"verbose %d", &verbose))
538 else if (
unformat (input,
"verbose"))
566 this = this->next_init_function;
579 init_f_name =
format (0,
"%s%c", this_reg->name, 0);
583 vec_add1 (init_f_names, init_f_name);
585 this_reg = this_reg->next_init_function;
588 for (
i = 0;
i < n_init_fns;
i++)
592 this_reg = (_vlib_init_function_list_elt_t *) p[0];
595 char **runs_before, **runs_after, **init_order;
596 runs_before = this_reg->runs_before;
597 while (runs_before && runs_before[0])
599 _vlib_init_function_list_elt_t *successor;
600 uword successor_index;
604 clib_warning (
"couldn't find successor '%s'", runs_before[0]);
608 successor_index = p[0];
611 successor = (_vlib_init_function_list_elt_t *) p[0];
613 successor->name, successor_index);
616 runs_after = this_reg->runs_after;
617 while (runs_after && runs_after[0])
619 _vlib_init_function_list_elt_t *predecessor;
620 uword predecessor_index;
629 predecessor_index = p[0];
632 predecessor = (_vlib_init_function_list_elt_t *) p[0];
634 predecessor->name, predecessor_index);
637 init_order = this_reg->init_order;
638 while (init_order && init_order[0])
640 _vlib_init_function_list_elt_t *inorder;
650 inorder_index = p[0];
653 inorder = (_vlib_init_function_list_elt_t *) p[0];
655 inorder->name, inorder_index);
667 for (
i = 0;
i <
vec_len (keys_to_delete);
i++)
684 .path =
"show init-function",
685 .short_help =
"show init-function [init | enter | exit][verbose [nn]]",