diff options
author | Damjan Marion <damarion@cisco.com> | 2022-05-18 22:16:11 +0200 |
---|---|---|
committer | Damjan Marion <damarion@cisco.com> | 2022-05-19 18:32:23 +0200 |
commit | cada9eb7894117db898f7c4def92cba5511baa4f (patch) | |
tree | 4cf552e2ad9e67b8bbc144eb5c6cb9aad0a8424b /src/vlibmemory/memory_shared.c | |
parent | bf95e3efde3402cf2f7beaf6d70433646cc68280 (diff) |
api: refactor api data storage
single struct to hold all api handler, flags, etc.
Provide functions to toggle flags instead of writing directly to
internal data.
Type: refactor
Change-Id: I4730d7290e57489de8eda34a72211527e015b721
Signed-off-by: Damjan Marion <damarion@cisco.com>
Diffstat (limited to 'src/vlibmemory/memory_shared.c')
-rw-r--r-- | src/vlibmemory/memory_shared.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/src/vlibmemory/memory_shared.c b/src/vlibmemory/memory_shared.c index b70f45fae14..77a610b9434 100644 --- a/src/vlibmemory/memory_shared.c +++ b/src/vlibmemory/memory_shared.c @@ -117,14 +117,16 @@ vl_msg_api_alloc_internal (svm_region_t *vlib_rp, int nbytes, int pool, if (CLIB_DEBUG > 0) { u16 *msg_idp, msg_id; + vl_api_msg_data_t *m; clib_warning ("garbage collect pool %d ring %d index %d", pool, i, q->head); msg_idp = (u16 *) (rv->data); msg_id = clib_net_to_host_u16 (*msg_idp); - if (msg_id < vec_len (vlibapi_get_main ()->msg_names)) + m = vl_api_get_msg_data (am, msg_id); + if (m) clib_warning ("msg id %d name %s", (u32) msg_id, - vlibapi_get_main ()->msg_names[msg_id]); + m->name); } shmem_hdr->garbage_collects++; goto collected; @@ -731,10 +733,7 @@ vl_unmap_shmem_internal (u8 is_client) is_client ? svm_region_exit_client () : svm_region_exit (); - /* $$$ more careful cleanup, valgrind run... */ - vec_free (am->msg_handlers); - vec_free (am->msg_endian_handlers); - vec_free (am->msg_print_handlers); + vec_free (am->msg_data); } void |