session: cleanup segment manager and fifo segment

Change-Id: I984f347fb465c0c405cef668d8690457e81788e2
Signed-off-by: Florin Coras <fcoras@cisco.com>
diff --git a/src/tests/vnet/session/quic_echo.c b/src/tests/vnet/session/quic_echo.c
index 4d1288f..7d0cedd 100644
--- a/src/tests/vnet/session/quic_echo.c
+++ b/src/tests/vnet/session/quic_echo.c
@@ -17,10 +17,10 @@
 #include <signal.h>
 
 #include <vnet/session/application_interface.h>
-#include <svm/svm_fifo_segment.h>
 #include <vlibmemory/api.h>
 
 #include <vpp/api/vpe_msg_enum.h>
+#include <svm/fifo_segment.h>
 
 #define vl_typedefs		/* define message structures */
 #include <vpp/api/vpe_all_api_h.h>
@@ -141,7 +141,7 @@
    * and all other messages are exchanged using shm IPC. */
   u8 use_sock_api;
 
-  svm_fifo_segment_main_t segment_main;
+  fifo_segment_main_t segment_main;
 } echo_main_t;
 
 echo_main_t echo_main;
@@ -290,8 +290,8 @@
 static int
 ssvm_segment_attach (char *name, ssvm_segment_type_t type, int fd)
 {
-  svm_fifo_segment_create_args_t _a, *a = &_a;
-  svm_fifo_segment_main_t *sm = &echo_main.segment_main;
+  fifo_segment_create_args_t _a, *a = &_a;
+  fifo_segment_main_t *sm = &echo_main.segment_main;
   int rv;
 
   clib_memset (a, 0, sizeof (*a));
@@ -301,7 +301,7 @@
   if (type == SSVM_SEGMENT_MEMFD)
     a->memfd_fd = fd;
 
-  if ((rv = svm_fifo_segment_attach (sm, a)))
+  if ((rv = fifo_segment_attach (sm, a)))
     {
       clib_warning ("svm_fifo_segment_attach ('%s') failed", name);
       return rv;
@@ -454,15 +454,15 @@
 static void
 vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
 {
-  svm_fifo_segment_main_t *sm = &echo_main.segment_main;
-  svm_fifo_segment_create_args_t _a, *a = &_a;
+  fifo_segment_main_t *sm = &echo_main.segment_main;
+  fifo_segment_create_args_t _a, *a = &_a;
   int rv;
 
   clib_memset (a, 0, sizeof (*a));
   a->segment_name = (char *) mp->segment_name;
   a->segment_size = mp->segment_size;
   /* Attach to the segment vpp created */
-  rv = svm_fifo_segment_attach (sm, a);
+  rv = fifo_segment_attach (sm, a);
   if (rv)
     {
       clib_warning ("svm_fifo_segment_attach ('%s') failed",
@@ -1286,7 +1286,7 @@
 {
   int i_am_server = 1, test_return_packets = 0;
   echo_main_t *em = &echo_main;
-  svm_fifo_segment_main_t *sm = &em->segment_main;
+  fifo_segment_main_t *sm = &em->segment_main;
   unformat_input_t _argv, *a = &_argv;
   u8 *chroot_prefix;
   u8 *uri = 0;
@@ -1309,7 +1309,7 @@
 
   clib_time_init (&em->clib_time);
   init_error_string_table (em);
-  svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20);
+  fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20);
   unformat_init_command_line (a, argv);
 
   while (unformat_check_input (a) != UNFORMAT_END_OF_INPUT)
diff --git a/src/tests/vnet/session/tcp_echo.c b/src/tests/vnet/session/tcp_echo.c
index 3fcc285..6c3ce92 100644
--- a/src/tests/vnet/session/tcp_echo.c
+++ b/src/tests/vnet/session/tcp_echo.c
@@ -17,10 +17,10 @@
 #include <signal.h>
 
 #include <vnet/session/application_interface.h>
-#include <svm/svm_fifo_segment.h>
 #include <vlibmemory/api.h>
 
 #include <vpp/api/vpe_msg_enum.h>
+#include <svm/fifo_segment.h>
 
 #define vl_typedefs		/* define message structures */
 #include <vpp/api/vpe_all_api_h.h>
@@ -141,7 +141,7 @@
    * and all other messages are exchanged using shm IPC. */
   u8 use_sock_api;
 
-  svm_fifo_segment_main_t segment_main;
+  fifo_segment_main_t segment_main;
 } echo_main_t;
 
 echo_main_t echo_main;
@@ -290,8 +290,8 @@
 static int
 ssvm_segment_attach (char *name, ssvm_segment_type_t type, int fd)
 {
-  svm_fifo_segment_create_args_t _a, *a = &_a;
-  svm_fifo_segment_main_t *sm = &echo_main.segment_main;
+  fifo_segment_create_args_t _a, *a = &_a;
+  fifo_segment_main_t *sm = &echo_main.segment_main;
   int rv;
 
   clib_memset (a, 0, sizeof (*a));
@@ -301,7 +301,7 @@
   if (type == SSVM_SEGMENT_MEMFD)
     a->memfd_fd = fd;
 
-  if ((rv = svm_fifo_segment_attach (sm, a)))
+  if ((rv = fifo_segment_attach (sm, a)))
     {
       clib_warning ("svm_fifo_segment_attach ('%s') failed", name);
       return rv;
@@ -456,15 +456,15 @@
 static void
 vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
 {
-  svm_fifo_segment_main_t *sm = &echo_main.segment_main;
-  svm_fifo_segment_create_args_t _a, *a = &_a;
+  fifo_segment_main_t *sm = &echo_main.segment_main;
+  fifo_segment_create_args_t _a, *a = &_a;
   int rv;
 
   clib_memset (a, 0, sizeof (*a));
   a->segment_name = (char *) mp->segment_name;
   a->segment_size = mp->segment_size;
   /* Attach to the segment vpp created */
-  rv = svm_fifo_segment_attach (sm, a);
+  rv = fifo_segment_attach (sm, a);
   if (rv)
     {
       clib_warning ("svm_fifo_segment_attach ('%s') failed",
@@ -1291,7 +1291,7 @@
 {
   int i_am_server = 1, test_return_packets = 0;
   echo_main_t *em = &echo_main;
-  svm_fifo_segment_main_t *sm = &em->segment_main;
+  fifo_segment_main_t *sm = &em->segment_main;
   unformat_input_t _argv, *a = &_argv;
   u8 *chroot_prefix;
   u8 *uri = 0;
@@ -1314,7 +1314,7 @@
 
   clib_time_init (&em->clib_time);
   init_error_string_table (em);
-  svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20);
+  fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20);
   unformat_init_command_line (a, argv);
 
   while (unformat_check_input (a) != UNFORMAT_END_OF_INPUT)
diff --git a/src/tests/vnet/session/udp_echo.c b/src/tests/vnet/session/udp_echo.c
index c949d4c..f1ecca8 100644
--- a/src/tests/vnet/session/udp_echo.c
+++ b/src/tests/vnet/session/udp_echo.c
@@ -27,9 +27,9 @@
 #include <vlibapi/api.h>
 #include <vlibmemory/api.h>
 #include <vpp/api/vpe_msg_enum.h>
-#include <svm/svm_fifo_segment.h>
 #include <pthread.h>
 #include <vnet/session/application_interface.h>
+#include <svm/fifo_segment.h>
 
 #define vl_typedefs		/* define message structures */
 #include <vpp/api/vpe_all_api_h.h>
@@ -79,7 +79,7 @@
   uword *session_index_by_vpp_handles;
 
   /* fifo segment */
-  svm_fifo_segment_private_t *seg;
+  fifo_segment_t *seg;
 
   /* intermediate rx buffer */
   u8 *rx_buf;
@@ -121,7 +121,7 @@
   /* VNET_API_ERROR_FOO -> "Foo" hash table */
   uword *error_string_by_error_number;
 
-  svm_fifo_segment_main_t segment_main;
+  fifo_segment_main_t segment_main;
 
   u8 *connect_test_data;
 
@@ -334,9 +334,9 @@
 vl_api_application_attach_reply_t_handler (vl_api_application_attach_reply_t *
 					   mp)
 {
-  svm_fifo_segment_create_args_t _a = { 0 }, *a = &_a;
+  fifo_segment_create_args_t _a = { 0 }, *a = &_a;
   udp_echo_main_t *utm = &udp_echo_main;
-  svm_fifo_segment_main_t *sm = &utm->segment_main;
+  fifo_segment_main_t *sm = &utm->segment_main;
   int rv;
 
   if (mp->retval)
@@ -358,7 +358,7 @@
   ASSERT (mp->app_event_queue_address);
 
   /* Attach to the segment vpp created */
-  rv = svm_fifo_segment_attach (sm, a);
+  rv = fifo_segment_attach (sm, a);
   if (rv)
     {
       clib_warning ("svm_fifo_segment_attach ('%s') failed",
@@ -841,24 +841,24 @@
 static void
 vl_api_map_another_segment_t_handler (vl_api_map_another_segment_t * mp)
 {
-  svm_fifo_segment_create_args_t _a, *a = &_a;
+  fifo_segment_create_args_t _a, *a = &_a;
   udp_echo_main_t *utm = &udp_echo_main;
-  svm_fifo_segment_main_t *sm = &utm->segment_main;
-  svm_fifo_segment_private_t *seg;
+  fifo_segment_main_t *sm = &utm->segment_main;
+  fifo_segment_t *seg;
   int rv;
 
   clib_memset (a, 0, sizeof (*a));
   a->segment_name = (char *) mp->segment_name;
   a->segment_size = mp->segment_size;
   /* Attach to the segment vpp created */
-  rv = svm_fifo_segment_attach (sm, a);
+  rv = fifo_segment_attach (sm, a);
   if (rv)
     {
       clib_warning ("svm_fifo_segment_attach ('%s') failed",
 		    mp->segment_name);
       return;
     }
-  seg = svm_fifo_segment_get_segment (sm, a->new_segment_indices[0]);
+  seg = fifo_segment_get_segment (sm, a->new_segment_indices[0]);
   clib_warning ("Mapped new segment '%s' size %d", seg->ssvm.name,
 		seg->ssvm.ssvm_size);
   hash_set (utm->segments_table, clib_net_to_host_u64 (mp->segment_handle),
@@ -869,8 +869,8 @@
 vl_api_unmap_segment_t_handler (vl_api_unmap_segment_t * mp)
 {
   udp_echo_main_t *utm = &udp_echo_main;
-  svm_fifo_segment_main_t *sm = &utm->segment_main;
-  svm_fifo_segment_private_t *seg;
+  fifo_segment_main_t *sm = &utm->segment_main;
+  fifo_segment_t *seg;
   uword *seg_indexp;
   u64 segment_handle;
 
@@ -882,8 +882,8 @@
       return;
     }
   hash_unset (utm->segments_table, segment_handle);
-  seg = svm_fifo_segment_get_segment (sm, (u32) seg_indexp[0]);
-  svm_fifo_segment_delete (sm, seg);
+  seg = fifo_segment_get_segment (sm, (u32) seg_indexp[0]);
+  fifo_segment_delete (sm, seg);
   clib_warning ("Unmapped segment '%s'", segment_handle);
 }
 
@@ -1127,7 +1127,7 @@
 main (int argc, char **argv)
 {
   udp_echo_main_t *utm = &udp_echo_main;
-  svm_fifo_segment_main_t *sm = &utm->segment_main;
+  fifo_segment_main_t *sm = &utm->segment_main;
   u8 *uri = (u8 *) "udp://6.0.1.1/1234";
   unformat_input_t _argv, *a = &_argv;
   int i_am_server = 1;
@@ -1139,7 +1139,7 @@
 
   clib_mem_init_thread_safe (0, 256 << 20);
 
-  svm_fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20);
+  fifo_segment_main_init (sm, HIGH_SEGMENT_BASEVA, 20);
 
   vec_validate (utm->rx_buf, 128 << 10);
   utm->session_index_by_vpp_handles = hash_create (0, sizeof (uword));