It should be possible to use vlib without the vlibmemory library, etc.
Change-Id: Ic2316b93d7dbb728fb4ff42a3ca8b0d747c9425e
Signed-off-by: Dave Barach <dave@barachs.net>
+#define foreach_weak_reference_stub \
+_(vlib_map_stat_segment_init) \
+_(vpe_api_init) \
+_(vlibmemory_init) \
+_(map_api_segment_init)
+
+#define _(name) \
+clib_error_t *name (vlib_main_t *vm) __attribute__((weak)); \
+clib_error_t *name (vlib_main_t *vm) { return 0; }
+foreach_weak_reference_stub;
+#undef _
+
/* Main function. */
int
vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
/* Main function. */
int
vlib_main (vlib_main_t * volatile vm, unformat_input_t * input)
- if ((error = vlib_call_init_function (vm, map_stat_segment_init)))
+ if ((error = vlib_map_stat_segment_init (vm)))
{
clib_error_report (error);
goto done;
{
clib_error_report (error);
goto done;
- if ((error = vlib_call_init_function (vm, vpe_api_init)))
+ /* Direct call / weak reference, for vlib standalone use-cases */
+ if ((error = vpe_api_init (vm)))
{
clib_error_report (error);
goto done;
}
{
clib_error_report (error);
goto done;
}
- if ((error = vlib_call_init_function (vm, vlibmemory_init)))
+ if ((error = vlibmemory_init (vm)))
{
clib_error_report (error);
goto done;
}
{
clib_error_report (error);
goto done;
}
- if ((error = vlib_call_init_function (vm, map_api_segment_init)))
+ if ((error = map_api_segment_init (vm)))
{
clib_error_report (error);
goto done;
{
clib_error_report (error);
goto done;
map_api_segment_init (vlib_main_t * vm)
{
api_main_t *am = &api_main;
map_api_segment_init (vlib_main_t * vm)
{
api_main_t *am = &api_main;
-VLIB_INIT_FUNCTION (map_api_segment_init);
-
static void
send_memclnt_keepalive (vl_api_registration_t * regp, f64 now)
{
static void
send_memclnt_keepalive (vl_api_registration_t * regp, f64 now)
{
-VLIB_INIT_FUNCTION (vlibmemory_init);
-
void
vl_set_memory_region_name (const char *name)
{
void
vl_set_memory_region_name (const char *name)
{
VLIB_API_INIT_FUNCTION (vpe_api_hookup);
VLIB_API_INIT_FUNCTION (vpe_api_hookup);
vpe_api_init (vlib_main_t * vm)
{
vpe_api_main_t *am = &vpe_api_main;
vpe_api_init (vlib_main_t * vm)
{
vpe_api_main_t *am = &vpe_api_main;
-VLIB_INIT_FUNCTION (vpe_api_init);
-
-
static clib_error_t *
api_segment_config (vlib_main_t * vm, unformat_input_t * input)
{
static clib_error_t *
api_segment_config (vlib_main_t * vm, unformat_input_t * input)
{
+socksvr {
+ default
+}
+
cpu {
## In the VPP there is one main thread and optionally the user can create worker(s)
## The main thread and worker thread(s) can be pinned to CPU core(s) manually or automatically
cpu {
## In the VPP there is one main thread and optionally the user can create worker(s)
## The main thread and worker thread(s) can be pinned to CPU core(s) manually or automatically
ssvm_pop_heap (oldheap);
}
ssvm_pop_heap (oldheap);
}
-static clib_error_t *
-map_stat_segment_init (vlib_main_t * vm)
+clib_error_t *
+vlib_map_stat_segment_init (void)
{
stats_main_t *sm = &stats_main;
ssvm_private_t *ssvmp = &sm->stat_segment;
{
stats_main_t *sm = &stats_main;
ssvm_private_t *ssvmp = &sm->stat_segment;
-VLIB_INIT_FUNCTION (map_stat_segment_init);
-
typedef struct
{
u8 *name;
typedef struct
{
u8 *name;