static clib_error_t *
main_stub_init (vlib_main_t * vm)
{
- clib_error_t *error;
-
- if ((error =
- unix_physmem_init (vm, /* fail_if_physical_memory_not_present */ 0)))
- return error;
-
- if ((error = vlib_call_init_function (vm, unix_cli_init)))
- return error;
+ clib_error_t *error = 0;
return error;
}
-VLIB_INIT_FUNCTION (main_stub_init);
+VLIB_INIT_FUNCTION (main_stub_init) =
+{
+ .runs_after = VLIB_INITS("unix_physmem_init", "unix_cli_init"),
+};
#if 0
/* Node test code. */
format_my_node_frame (u8 * s, va_list * va)
{
vlib_frame_t *f = va_arg (*va, vlib_frame_t *);
- my_frame_t *g = vlib_frame_args (f);
+ my_frame_t *g = vlib_frame_scalar_args (f);
int i;
s = format (s, "scalar %d, vector { ", g->scalar);
{
vlib_frame_t *next = vlib_get_next_frame (vm, rt, /* next index */ 0);
n_left = VLIB_FRAME_SIZE - next->n_vectors;
- y = vlib_frame_args (next);
+ y = vlib_frame_scalar_args (next);
y->scalar = serial++;
}
else
return i;
}
-/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_node1,static) = {
.function = my_func,
.type = VLIB_NODE_TYPE_INPUT,
[0] = "my-node2",
},
};
-/* *INDENT-ON* */
-/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_node2,static) = {
.function = my_func,
.name = "my-node2",
.scalar_size = sizeof (my_frame_t),
.vector_size = STRUCT_SIZE_OF (my_frame_t, vector[0]),
};
-/* *INDENT-ON* */
#endif
vlib_cli_output (vm, "%U %v: completion #%d type %d data 0x%wx",
format_time_interval, "h:m:s:u",
vlib_time_now (vm), node->name, i, type, data[0]);
- _vec_len (data) = 0;
+ vec_set_len (data, 0);
}
vec_free (data);
return i;
}
-/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_proc_node,static) = {
.function = my_proc,
.type = VLIB_NODE_TYPE_PROCESS,
.name = "my-proc",
};
-/* *INDENT-ON* */
static uword
my_proc_input (vlib_main_t * vm, vlib_node_runtime_t * rt, vlib_frame_t * f)
return 0;
}
-/* *INDENT-OFF* */
VLIB_REGISTER_NODE (my_proc_input_node,static) = {
.function = my_proc_input,
.type = VLIB_NODE_TYPE_INPUT,
.name = "my-proc-input",
};
-/* *INDENT-ON* */
static uword
_unformat_farith (unformat_input_t * i, va_list * args)
return 0;
}
-/* *INDENT-OFF* */
VLIB_CLI_COMMAND (bar_command2, static) = {
.path = "bar %decimal_integer",
.short_help = "bar1 command",
.function = bar_command,
.function_arg = 3,
};
-/* *INDENT-ON* */
#endif