From e4db8f987126e1c1e586e5ae1e1ba73d0ab43438 Mon Sep 17 00:00:00 2001 From: Michael Jeanson Date: Fri, 2 Apr 2021 18:45:31 -0400 Subject: [PATCH] Move libringbuffer to 'src/common/' This is part of an effort to standardize our autotools setup across projects to simplify maintenance. Change-Id: I8f19a59bd0a72970199ede1b81c5d5971d613f31 Signed-off-by: Michael Jeanson Signed-off-by: Mathieu Desnoyers --- .gitignore | 1 - configure.ac | 1 - src/Makefile.am | 1 - src/common/Makefile.am | 35 +++++++++++++++++++ src/common/counter/counter-api.h | 2 +- src/common/counter/shm.c | 2 +- .../ringbuffer}/api.h | 0 .../ringbuffer}/backend.h | 0 .../ringbuffer}/backend_internal.h | 0 .../ringbuffer}/backend_types.h | 0 .../ringbuffer}/frontend.h | 0 .../ringbuffer}/frontend_api.h | 0 .../ringbuffer}/frontend_internal.h | 0 .../ringbuffer}/frontend_types.h | 0 .../ringbuffer}/getcpu.h | 0 .../ringbuffer}/mmap.h | 0 .../ringbuffer}/nohz.h | 0 .../ringbuffer}/rb-init.h | 0 .../ringbuffer}/ring_buffer_backend.c | 0 .../ringbuffer}/ring_buffer_frontend.c | 2 +- .../ringbuffer}/ringbuffer-config.h | 0 .../ringbuffer}/shm.c | 0 .../ringbuffer}/shm.h | 0 .../ringbuffer}/shm_internal.h | 0 .../ringbuffer}/shm_types.h | 0 .../ringbuffer}/smp.c | 0 .../ringbuffer}/smp.h | 0 .../ringbuffer}/vatomic.h | 0 src/lib/lttng-ust-ctl/ustctl.c | 4 +-- src/liblttng-ust/Makefile.am | 2 +- src/liblttng-ust/lttng-context-cpu-id.c | 2 +- src/liblttng-ust/lttng-events.c | 6 ++-- src/liblttng-ust/lttng-getcpu.c | 2 +- src/liblttng-ust/lttng-rb-clients.h | 2 +- .../lttng-ring-buffer-client-template.h | 4 +-- ...tng-ring-buffer-metadata-client-template.h | 4 +-- src/liblttng-ust/lttng-ust-abi.c | 6 ++-- src/liblttng-ust/lttng-ust-comm.c | 4 +-- src/libringbuffer/Makefile.am | 24 ------------- tests/unit/libringbuffer/Makefile.am | 2 +- tests/unit/libringbuffer/shm.c | 2 +- 41 files changed, 58 insertions(+), 50 deletions(-) rename src/{libringbuffer => common/ringbuffer}/api.h (100%) rename src/{libringbuffer => common/ringbuffer}/backend.h (100%) rename src/{libringbuffer => common/ringbuffer}/backend_internal.h (100%) rename src/{libringbuffer => common/ringbuffer}/backend_types.h (100%) rename src/{libringbuffer => common/ringbuffer}/frontend.h (100%) rename src/{libringbuffer => common/ringbuffer}/frontend_api.h (100%) rename src/{libringbuffer => common/ringbuffer}/frontend_internal.h (100%) rename src/{libringbuffer => common/ringbuffer}/frontend_types.h (100%) rename src/{libringbuffer => common/ringbuffer}/getcpu.h (100%) rename src/{libringbuffer => common/ringbuffer}/mmap.h (100%) rename src/{libringbuffer => common/ringbuffer}/nohz.h (100%) rename src/{libringbuffer => common/ringbuffer}/rb-init.h (100%) rename src/{libringbuffer => common/ringbuffer}/ring_buffer_backend.c (100%) rename src/{libringbuffer => common/ringbuffer}/ring_buffer_frontend.c (99%) rename src/{libringbuffer => common/ringbuffer}/ringbuffer-config.h (100%) rename src/{libringbuffer => common/ringbuffer}/shm.c (100%) rename src/{libringbuffer => common/ringbuffer}/shm.h (100%) rename src/{libringbuffer => common/ringbuffer}/shm_internal.h (100%) rename src/{libringbuffer => common/ringbuffer}/shm_types.h (100%) rename src/{libringbuffer => common/ringbuffer}/smp.c (100%) rename src/{libringbuffer => common/ringbuffer}/smp.h (100%) rename src/{libringbuffer => common/ringbuffer}/vatomic.h (100%) delete mode 100644 src/libringbuffer/Makefile.am diff --git a/.gitignore b/.gitignore index 9f38fa9c..2dc1914c 100644 --- a/.gitignore +++ b/.gitignore @@ -146,7 +146,6 @@ cscope.* /src/lib/lttng-ust-python-agent/Makefile /src/lib/Makefile /src/liblttng-ust/Makefile -/src/libringbuffer/Makefile /src/python-lttngust/Makefile /src/Makefile /tests/Makefile diff --git a/configure.ac b/configure.ac index 285d269d..21dee733 100644 --- a/configure.ac +++ b/configure.ac @@ -540,7 +540,6 @@ AC_CONFIG_FILES([ src/liblttng-ust/Makefile src/lib/lttng-ust-python-agent/Makefile src/lib/Makefile - src/libringbuffer/Makefile src/lttng-ust-ctl.pc src/lttng-ust.pc src/Makefile diff --git a/src/Makefile.am b/src/Makefile.am index 4fca446e..5f958375 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -2,7 +2,6 @@ SUBDIRS = \ common \ - libringbuffer \ liblttng-ust-comm \ liblttng-ust \ lib diff --git a/src/common/Makefile.am b/src/common/Makefile.am index a198b685..2fbc8fff 100644 --- a/src/common/Makefile.am +++ b/src/common/Makefile.am @@ -40,6 +40,7 @@ noinst_HEADERS += \ noinst_LTLIBRARIES = \ libcounter.la \ msgpack/libmsgpack.la \ + libringbuffer.la \ snprintf/libsnprintf.la \ libcommon.la @@ -73,6 +74,40 @@ msgpack_libmsgpack_la_SOURCES = \ msgpack_libmsgpack_la_CFLAGS = -DUST_COMPONENT="libmsgpack" $(AM_CFLAGS) +# ringbuffer +libringbuffer_la_SOURCES = \ + ringbuffer/api.h \ + ringbuffer/backend.h \ + ringbuffer/backend_internal.h \ + ringbuffer/backend_types.h \ + ringbuffer/frontend_api.h \ + ringbuffer/frontend.h \ + ringbuffer/frontend_internal.h \ + ringbuffer/frontend_types.h \ + ringbuffer/getcpu.h \ + ringbuffer/mmap.h \ + ringbuffer/nohz.h \ + ringbuffer/rb-init.h \ + ringbuffer/ring_buffer_backend.c \ + ringbuffer/ringbuffer-config.h \ + ringbuffer/ring_buffer_frontend.c \ + ringbuffer/shm.c \ + ringbuffer/shm.h \ + ringbuffer/shm_internal.h \ + ringbuffer/shm_types.h \ + ringbuffer/smp.c \ + ringbuffer/smp.h \ + ringbuffer/vatomic.h + +libringbuffer_la_LIBADD = \ + -lrt + +if ENABLE_NUMA +libringbuffer_la_LIBADD += -lnuma +endif + +libringbuffer_la_CFLAGS = -DUST_COMPONENT="libringbuffer" $(AM_CFLAGS) + # snprintf snprintf_libsnprintf_la_SOURCES = \ snprintf/fflush.c \ diff --git a/src/common/counter/counter-api.h b/src/common/counter/counter-api.h index 08511d3a..81bb551b 100644 --- a/src/common/counter/counter-api.h +++ b/src/common/counter/counter-api.h @@ -16,7 +16,7 @@ #include #include #include "common/bitmap.h" -#include "libringbuffer/getcpu.h" +#include "common/ringbuffer/getcpu.h" /* * Using unsigned arithmetic because overflow is defined. diff --git a/src/common/counter/shm.c b/src/common/counter/shm.c index d1116c9c..596d5e59 100644 --- a/src/common/counter/shm.c +++ b/src/common/counter/shm.c @@ -29,7 +29,7 @@ #include "common/macros.h" #include "common/ust-fd.h" -#include "libringbuffer/mmap.h" +#include "common/ringbuffer/mmap.h" /* * Ensure we have the required amount of space available by writing 0 diff --git a/src/libringbuffer/api.h b/src/common/ringbuffer/api.h similarity index 100% rename from src/libringbuffer/api.h rename to src/common/ringbuffer/api.h diff --git a/src/libringbuffer/backend.h b/src/common/ringbuffer/backend.h similarity index 100% rename from src/libringbuffer/backend.h rename to src/common/ringbuffer/backend.h diff --git a/src/libringbuffer/backend_internal.h b/src/common/ringbuffer/backend_internal.h similarity index 100% rename from src/libringbuffer/backend_internal.h rename to src/common/ringbuffer/backend_internal.h diff --git a/src/libringbuffer/backend_types.h b/src/common/ringbuffer/backend_types.h similarity index 100% rename from src/libringbuffer/backend_types.h rename to src/common/ringbuffer/backend_types.h diff --git a/src/libringbuffer/frontend.h b/src/common/ringbuffer/frontend.h similarity index 100% rename from src/libringbuffer/frontend.h rename to src/common/ringbuffer/frontend.h diff --git a/src/libringbuffer/frontend_api.h b/src/common/ringbuffer/frontend_api.h similarity index 100% rename from src/libringbuffer/frontend_api.h rename to src/common/ringbuffer/frontend_api.h diff --git a/src/libringbuffer/frontend_internal.h b/src/common/ringbuffer/frontend_internal.h similarity index 100% rename from src/libringbuffer/frontend_internal.h rename to src/common/ringbuffer/frontend_internal.h diff --git a/src/libringbuffer/frontend_types.h b/src/common/ringbuffer/frontend_types.h similarity index 100% rename from src/libringbuffer/frontend_types.h rename to src/common/ringbuffer/frontend_types.h diff --git a/src/libringbuffer/getcpu.h b/src/common/ringbuffer/getcpu.h similarity index 100% rename from src/libringbuffer/getcpu.h rename to src/common/ringbuffer/getcpu.h diff --git a/src/libringbuffer/mmap.h b/src/common/ringbuffer/mmap.h similarity index 100% rename from src/libringbuffer/mmap.h rename to src/common/ringbuffer/mmap.h diff --git a/src/libringbuffer/nohz.h b/src/common/ringbuffer/nohz.h similarity index 100% rename from src/libringbuffer/nohz.h rename to src/common/ringbuffer/nohz.h diff --git a/src/libringbuffer/rb-init.h b/src/common/ringbuffer/rb-init.h similarity index 100% rename from src/libringbuffer/rb-init.h rename to src/common/ringbuffer/rb-init.h diff --git a/src/libringbuffer/ring_buffer_backend.c b/src/common/ringbuffer/ring_buffer_backend.c similarity index 100% rename from src/libringbuffer/ring_buffer_backend.c rename to src/common/ringbuffer/ring_buffer_backend.c diff --git a/src/libringbuffer/ring_buffer_frontend.c b/src/common/ringbuffer/ring_buffer_frontend.c similarity index 99% rename from src/libringbuffer/ring_buffer_frontend.c rename to src/common/ringbuffer/ring_buffer_frontend.c index 296368f3..9074dbcb 100644 --- a/src/libringbuffer/ring_buffer_frontend.c +++ b/src/common/ringbuffer/ring_buffer_frontend.c @@ -62,7 +62,7 @@ #include "frontend.h" #include "shm.h" #include "rb-init.h" -#include "../liblttng-ust/compat.h" /* For ENODATA */ +#include "liblttng-ust/compat.h" /* For ENODATA */ /* Print DBG() messages about events lost only every 1048576 hits */ #define DBG_PRINT_NR_LOST (1UL << 20) diff --git a/src/libringbuffer/ringbuffer-config.h b/src/common/ringbuffer/ringbuffer-config.h similarity index 100% rename from src/libringbuffer/ringbuffer-config.h rename to src/common/ringbuffer/ringbuffer-config.h diff --git a/src/libringbuffer/shm.c b/src/common/ringbuffer/shm.c similarity index 100% rename from src/libringbuffer/shm.c rename to src/common/ringbuffer/shm.c diff --git a/src/libringbuffer/shm.h b/src/common/ringbuffer/shm.h similarity index 100% rename from src/libringbuffer/shm.h rename to src/common/ringbuffer/shm.h diff --git a/src/libringbuffer/shm_internal.h b/src/common/ringbuffer/shm_internal.h similarity index 100% rename from src/libringbuffer/shm_internal.h rename to src/common/ringbuffer/shm_internal.h diff --git a/src/libringbuffer/shm_types.h b/src/common/ringbuffer/shm_types.h similarity index 100% rename from src/libringbuffer/shm_types.h rename to src/common/ringbuffer/shm_types.h diff --git a/src/libringbuffer/smp.c b/src/common/ringbuffer/smp.c similarity index 100% rename from src/libringbuffer/smp.c rename to src/common/ringbuffer/smp.c diff --git a/src/libringbuffer/smp.h b/src/common/ringbuffer/smp.h similarity index 100% rename from src/libringbuffer/smp.h rename to src/common/ringbuffer/smp.h diff --git a/src/libringbuffer/vatomic.h b/src/common/ringbuffer/vatomic.h similarity index 100% rename from src/libringbuffer/vatomic.h rename to src/common/ringbuffer/vatomic.h diff --git a/src/lib/lttng-ust-ctl/ustctl.c b/src/lib/lttng-ust-ctl/ustctl.c index c89085a1..488148bf 100644 --- a/src/lib/lttng-ust-ctl/ustctl.c +++ b/src/lib/lttng-ust-ctl/ustctl.c @@ -22,8 +22,8 @@ #include "common/macros.h" #include "common/align.h" -#include "libringbuffer/backend.h" -#include "libringbuffer/frontend.h" +#include "common/ringbuffer/backend.h" +#include "common/ringbuffer/frontend.h" #include "liblttng-ust/ust-events-internal.h" #include "liblttng-ust/wait.h" #include "liblttng-ust/lttng-rb-clients.h" diff --git a/src/liblttng-ust/Makefile.am b/src/liblttng-ust/Makefile.am index 89fba09a..78d82f0e 100644 --- a/src/liblttng-ust/Makefile.am +++ b/src/liblttng-ust/Makefile.am @@ -130,7 +130,7 @@ liblttng_ust_la_SOURCES = liblttng_ust_la_LDFLAGS = -no-undefined -version-info $(LTTNG_UST_LIBRARY_VERSION) liblttng_ust_support_la_LIBADD = \ - $(top_builddir)/src/libringbuffer/libringbuffer.la \ + $(top_builddir)/src/common/libringbuffer.la \ $(top_builddir)/src/common/libcounter.la liblttng_ust_la_LIBADD = \ diff --git a/src/liblttng-ust/lttng-context-cpu-id.c b/src/liblttng-ust/lttng-context-cpu-id.c index 358dff98..900b3c2e 100644 --- a/src/liblttng-ust/lttng-context-cpu-id.c +++ b/src/liblttng-ust/lttng-context-cpu-id.c @@ -19,7 +19,7 @@ #include #include #include -#include "../libringbuffer/getcpu.h" +#include "common/ringbuffer/getcpu.h" #include #include "context-internal.h" diff --git a/src/liblttng-ust/lttng-events.c b/src/liblttng-ust/lttng-events.c index 7a4ade01..ccd3dfd9 100644 --- a/src/liblttng-ust/lttng-events.c +++ b/src/liblttng-ust/lttng-events.c @@ -52,9 +52,9 @@ #include "context-internal.h" #include "ust-events-internal.h" #include "wait.h" -#include "../libringbuffer/shm.h" -#include "../libringbuffer/frontend_types.h" -#include "../libringbuffer/frontend.h" +#include "common/ringbuffer/shm.h" +#include "common/ringbuffer/frontend_types.h" +#include "common/ringbuffer/frontend.h" #include "common/counter/counter.h" #include "jhash.h" #include diff --git a/src/liblttng-ust/lttng-getcpu.c b/src/liblttng-ust/lttng-getcpu.c index d4d91da6..8d2c944c 100644 --- a/src/liblttng-ust/lttng-getcpu.c +++ b/src/liblttng-ust/lttng-getcpu.c @@ -14,7 +14,7 @@ #include #include "getenv.h" -#include "../libringbuffer/getcpu.h" +#include "common/ringbuffer/getcpu.h" int (*lttng_get_cpu)(void); diff --git a/src/liblttng-ust/lttng-rb-clients.h b/src/liblttng-ust/lttng-rb-clients.h index 9cec72e8..afdbd057 100644 --- a/src/liblttng-ust/lttng-rb-clients.h +++ b/src/liblttng-ust/lttng-rb-clients.h @@ -8,7 +8,7 @@ #define _LTTNG_RB_CLIENT_H #include -#include "../libringbuffer/ringbuffer-config.h" +#include "common/ringbuffer/ringbuffer-config.h" struct lttng_ust_client_lib_ring_buffer_client_cb { struct lttng_ust_lib_ring_buffer_client_cb parent; diff --git a/src/liblttng-ust/lttng-ring-buffer-client-template.h b/src/liblttng-ust/lttng-ring-buffer-client-template.h index d7f77698..880ae94c 100644 --- a/src/liblttng-ust/lttng-ring-buffer-client-template.h +++ b/src/liblttng-ust/lttng-ring-buffer-client-template.h @@ -17,7 +17,7 @@ #include "clock.h" #include "context-internal.h" #include "lttng-tracer.h" -#include "../libringbuffer/frontend_types.h" +#include "common/ringbuffer/frontend_types.h" #include #define LTTNG_COMPACT_EVENT_BITS 5 @@ -195,7 +195,7 @@ size_t record_header_size( return offset - orig_offset; } -#include "../libringbuffer/api.h" +#include "common/ringbuffer/api.h" #include "lttng-rb-clients.h" static diff --git a/src/liblttng-ust/lttng-ring-buffer-metadata-client-template.h b/src/liblttng-ust/lttng-ring-buffer-metadata-client-template.h index 2406567e..954fc020 100644 --- a/src/liblttng-ust/lttng-ring-buffer-metadata-client-template.h +++ b/src/liblttng-ust/lttng-ring-buffer-metadata-client-template.h @@ -14,7 +14,7 @@ #include "common/bitfield.h" #include "common/align.h" #include "lttng-tracer.h" -#include "../libringbuffer/frontend_types.h" +#include "common/ringbuffer/frontend_types.h" #include struct metadata_packet_header { @@ -58,7 +58,7 @@ size_t record_header_size( return 0; } -#include "../libringbuffer/api.h" +#include "common/ringbuffer/api.h" #include "lttng-rb-clients.h" static uint64_t client_ring_buffer_clock_read( diff --git a/src/liblttng-ust/lttng-ust-abi.c b/src/liblttng-ust/lttng-ust-abi.c index 31b6fe22..f1096d06 100644 --- a/src/liblttng-ust/lttng-ust-abi.c +++ b/src/liblttng-ust/lttng-ust-abi.c @@ -39,9 +39,9 @@ #include "common/ust-fd.h" #include "common/logging.h" -#include "../libringbuffer/frontend_types.h" -#include "../libringbuffer/frontend.h" -#include "../libringbuffer/shm.h" +#include "common/ringbuffer/frontend_types.h" +#include "common/ringbuffer/frontend.h" +#include "common/ringbuffer/shm.h" #include "common/counter/counter.h" #include "tracepoint-internal.h" #include "lttng-tracer.h" diff --git a/src/liblttng-ust/lttng-ust-comm.c b/src/liblttng-ust/lttng-ust-comm.c index 137107cd..a753206f 100644 --- a/src/liblttng-ust/lttng-ust-comm.c +++ b/src/liblttng-ust/lttng-ust-comm.c @@ -46,10 +46,10 @@ #include "tracepoint-internal.h" #include "lttng-tracer-core.h" #include "compat.h" -#include "../libringbuffer/rb-init.h" +#include "common/ringbuffer/rb-init.h" #include "lttng-ust-statedump.h" #include "clock.h" -#include "../libringbuffer/getcpu.h" +#include "common/ringbuffer/getcpu.h" #include "getenv.h" #include "ust-events-internal.h" #include "context-internal.h" diff --git a/src/libringbuffer/Makefile.am b/src/libringbuffer/Makefile.am deleted file mode 100644 index eb9ba512..00000000 --- a/src/libringbuffer/Makefile.am +++ /dev/null @@ -1,24 +0,0 @@ -# SPDX-License-Identifier: LGPL-2.1-only - -AM_CFLAGS += -fno-strict-aliasing - -noinst_LTLIBRARIES = libringbuffer.la - -libringbuffer_la_SOURCES = \ - smp.h smp.c getcpu.h \ - shm.c shm.h shm_types.h shm_internal.h \ - ring_buffer_backend.c \ - ring_buffer_frontend.c \ - api.h mmap.h \ - backend.h backend_internal.h backend_types.h \ - frontend_api.h frontend.h frontend_internal.h frontend_types.h \ - nohz.h vatomic.h rb-init.h ringbuffer-config.h - -libringbuffer_la_LIBADD = \ - -lrt - -if ENABLE_NUMA -libringbuffer_la_LIBADD += -lnuma -endif - -libringbuffer_la_CFLAGS = -DUST_COMPONENT="libringbuffer" $(AM_CFLAGS) diff --git a/tests/unit/libringbuffer/Makefile.am b/tests/unit/libringbuffer/Makefile.am index 1954e454..7b086442 100644 --- a/tests/unit/libringbuffer/Makefile.am +++ b/tests/unit/libringbuffer/Makefile.am @@ -5,7 +5,7 @@ AM_CPPFLAGS += -I$(top_srcdir)/tests/utils noinst_PROGRAMS = test_shm test_shm_SOURCES = shm.c test_shm_LDADD = \ - $(top_builddir)/src/libringbuffer/libringbuffer.la \ + $(top_builddir)/src/common/libringbuffer.la \ $(top_builddir)/src/liblttng-ust-comm/liblttng-ust-comm.la \ $(top_builddir)/src/common/libcommon.la \ $(top_builddir)/tests/utils/libtap.a diff --git a/tests/unit/libringbuffer/shm.c b/tests/unit/libringbuffer/shm.c index c0092170..13c74c3d 100644 --- a/tests/unit/libringbuffer/shm.c +++ b/tests/unit/libringbuffer/shm.c @@ -12,7 +12,7 @@ #include #include -#include "../../../src/libringbuffer/shm.h" +#include "common/ringbuffer/shm.h" #include "common/align.h" #include "tap.h" -- 2.34.1