From 2152e1cf8b3420d94ba31fe25853977ad945f35a Mon Sep 17 00:00:00 2001 From: Ole Troan Date: Fri, 23 Nov 2018 23:07:13 +0100 Subject: [PATCH] stats: Remove unneeded dependencies in stat_client Remove exposing stat_client_main internals and atomics to simplify use from C++. Change-Id: Ie864170fee8b4eaa2fd7f98556cf0ebb46cb1a2a Signed-off-by: Ole Troan --- src/vpp-api/client/stat_client.c | 8 ++++++++ src/vpp-api/client/stat_client.h | 20 +++++++++++++------- src/vpp/stats/stat_segment.c | 2 +- src/vpp/stats/stat_segment.h | 13 +------------ 4 files changed, 23 insertions(+), 20 deletions(-) diff --git a/src/vpp-api/client/stat_client.c b/src/vpp-api/client/stat_client.c index 98c275727f0..538820ad338 100644 --- a/src/vpp-api/client/stat_client.c +++ b/src/vpp-api/client/stat_client.c @@ -30,7 +30,15 @@ #include #include "stat_client.h" #include +#include +struct stat_client_main_t +{ + uint64_t current_epoch; + stat_segment_shared_header_t *shared_header; + stat_segment_directory_entry_t *directory_vector; + ssize_t memory_size; +}; stat_client_main_t stat_client_main; diff --git a/src/vpp-api/client/stat_client.h b/src/vpp-api/client/stat_client.h index aeca63419ee..31fd82b41e2 100644 --- a/src/vpp-api/client/stat_client.h +++ b/src/vpp-api/client/stat_client.h @@ -18,16 +18,22 @@ #define included_stat_client_h #include -#include +#include #include -typedef struct +typedef enum { - uint64_t current_epoch; - stat_segment_shared_header_t *shared_header; - stat_segment_directory_entry_t *directory_vector; - ssize_t memory_size; -} stat_client_main_t; + STAT_DIR_TYPE_ILLEGAL = 0, + STAT_DIR_TYPE_SCALAR_INDEX, + STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE, + STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED, + STAT_DIR_TYPE_ERROR_INDEX, +} stat_directory_type_t; + +/* Default socket to exchange segment fd */ +#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock" + +typedef struct stat_client_main_t stat_client_main_t; typedef struct { diff --git a/src/vpp/stats/stat_segment.c b/src/vpp/stats/stat_segment.c index 3c5d4ebf2f4..9b6b37b934f 100644 --- a/src/vpp/stats/stat_segment.c +++ b/src/vpp/stats/stat_segment.c @@ -21,7 +21,7 @@ #include /* vnet_get_aggregate_rx_packets */ #undef HAVE_MEMFD_CREATE #include - +#include stat_segment_main_t stat_segment_main; /* diff --git a/src/vpp/stats/stat_segment.h b/src/vpp/stats/stat_segment.h index 21c7c3b0d48..3ce82809255 100644 --- a/src/vpp/stats/stat_segment.h +++ b/src/vpp/stats/stat_segment.h @@ -19,18 +19,7 @@ #include #include #include - -/* Default socket to exchange segment fd */ -#define STAT_SEGMENT_SOCKET_FILE "/run/vpp/stats.sock" - -typedef enum -{ - STAT_DIR_TYPE_ILLEGAL = 0, - STAT_DIR_TYPE_SCALAR_INDEX, - STAT_DIR_TYPE_COUNTER_VECTOR_SIMPLE, - STAT_DIR_TYPE_COUNTER_VECTOR_COMBINED, - STAT_DIR_TYPE_ERROR_INDEX, -} stat_directory_type_t; +#include typedef enum { -- 2.16.6