Fix duplicate binary API registration messages / bugs 22/5622/1
authorDave Barach <dave@barachs.net>
Sat, 4 Mar 2017 13:35:48 +0000 (08:35 -0500)
committerDave Barach <dave@barachs.net>
Sat, 4 Mar 2017 13:50:49 +0000 (08:50 -0500)
Changed vat_api_hookup(...) to <plugin-name>_api_hookup, change to
static functions. Fixed the related emacs-lisp plugin skeleton.

Change-Id: Id14f8fc3138751f469d48fecb26175e938f5f028
Signed-off-by: Dave Barach <dave@barachs.net>
build-root/emacs-lisp/plugin-test-skel.el
src/examples/sample-plugin/sample/sample_test.c
src/plugins/dpdk/api/dpdk_test.c
src/plugins/snat/snat_test.c

index 2f8121a..837cbda 100644 (file)
@@ -158,7 +158,7 @@ static int api_" plugin-name "_enable_disable (vat_main_t * vam)
 #define foreach_vpe_api_msg \\
 _(" plugin-name "_enable_disable, \"<intfc> [disable]\")
 
-void vat_api_hookup (vat_main_t *vam)
+static void " plugin-name "_api_hookup (vat_main_t *vam)
 {
     " plugin-name "_test_main_t * sm = &" plugin-name "_test_main;
     /* Hook up handlers for replies from the data plane plug-in */
@@ -196,7 +196,7 @@ clib_error_t * vat_plugin_register (vat_main_t *vam)
   sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
 
   if (sm->msg_id_base != (u16) ~0)
-    vat_api_hookup (vam);
+    " plugin-name "_api_hookup (vam);
   
   vec_free(name);
   
index 6dd3a3e..b3e71c7 100644 (file)
@@ -137,7 +137,7 @@ static int api_sample_macswap_enable_disable (vat_main_t * vam)
 #define foreach_vpe_api_msg \
 _(sample_macswap_enable_disable, "<intfc> [disable]")
 
-void vat_api_hookup (vat_main_t *vam)
+static void sample_api_hookup (vat_main_t *vam)
 {
     sample_test_main_t * sm = &sample_test_main;
     /* Hook up handlers for replies from the data plane plug-in */
@@ -174,7 +174,7 @@ clib_error_t * vat_plugin_register (vat_main_t *vam)
   sm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
 
   if (sm->msg_id_base != (u16) ~0)
-    vat_api_hookup (vam);
+    sample_api_hookup (vam);
   
   vec_free(name);
   
index 9fe0f93..ea17e5d 100644 (file)
@@ -351,7 +351,7 @@ _(sw_interface_set_dpdk_hqos_subport,                                     \
 _(sw_interface_set_dpdk_hqos_tctbl,                                       \
   "rx sw_if_index <id> entry <n> tc <n> queue <n>\n")
 
-void vat_api_hookup (vat_main_t *vam)
+static void dpdk_api_hookup (vat_main_t *vam)
 {
   dpdk_test_main_t * dm __attribute__((unused)) = &dpdk_test_main;
   /* Hook up handlers for replies from the data plane plug-in */
@@ -389,7 +389,7 @@ clib_error_t * vat_plugin_register (vat_main_t *vam)
   dm->msg_id_base = vl_client_get_first_plugin_msg_id ((char *) name);
 
   if (dm->msg_id_base != (u16) ~0)
-    vat_api_hookup (vam);
+    dpdk_api_hookup (vam);
   
   vec_free(name);
   
index dae63a2..c97b813 100644 (file)
@@ -763,8 +763,7 @@ snat_vat_api_hookup (vat_main_t *vam)
 
   /* API messages we can send */
 #define _(n,h)                                          \
-  hash_set_mem (vam->function_by_name, #n, api_##n);    \
-  clib_warning ("vam %llx add '%s' handler %llx", vam, #n, api_##n);
+  hash_set_mem (vam->function_by_name, #n, api_##n);
   foreach_vpe_api_msg;
 #undef _