From 35897f8b2d311b756b81657dad9c53ef1c0fad8a Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 18 Nov 2011 13:56:30 -0500 Subject: [PATCH] Remove core.h Signed-off-by: Mathieu Desnoyers --- include/Makefile.am | 4 +- include/helper.h | 44 ++++++++++++++++++++ include/lttng/core.h | 62 ---------------------------- include/lttng/usterr-signal-safe.h | 1 - include/usterr.h | 1 - liblttng-ust/clock.h | 1 - liblttng-ust/ltt-context.c | 2 +- liblttng-ust/ltt-events.c | 2 +- liblttng-ust/ltt-probes.c | 1 - liblttng-ust/ltt-tracer-core.h | 1 - liblttng-ust/ltt-tracer.h | 1 - liblttng-ust/lttng-ust-abi.c | 2 +- liblttng-ust/tracepoint.c | 1 + libringbuffer/backend.h | 2 - libringbuffer/backend_internal.h | 16 +++++++ libringbuffer/frontend_api.h | 1 - libringbuffer/frontend_types.h | 2 - libringbuffer/ring_buffer_backend.c | 2 - libringbuffer/ring_buffer_frontend.c | 1 + libringbuffer/shm.c | 1 + libringbuffer/shm.h | 2 +- libringbuffer/smp.c | 1 - libringbuffer/smp.h | 1 - 23 files changed, 69 insertions(+), 83 deletions(-) create mode 100644 include/helper.h delete mode 100644 include/lttng/core.h diff --git a/include/Makefile.am b/include/Makefile.am index 4a0a4ba6..28462e60 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -14,7 +14,6 @@ nobase_include_HEADERS = \ lttng/config.h \ lttng/share.h \ lttng/ust.h \ - lttng/core.h \ lttng/ringbuffer-config.h \ lttng/align.h \ lttng/bug.h @@ -25,4 +24,5 @@ noinst_HEADERS = \ usterr.h \ ust_snprintf.h \ ust-comm.h \ - lttng/bitfield.h + lttng/bitfield.h \ + helper.h diff --git a/include/helper.h b/include/helper.h new file mode 100644 index 00000000..8aeb7728 --- /dev/null +++ b/include/helper.h @@ -0,0 +1,44 @@ +#ifndef _LTTNG_UST_HELPER_H +#define _LTTNG_UST_HELPER_H + +/* + * Copyright (C) 2011 Mathieu Desnoyers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; version 2.1 of + * the License. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#include + +static inline +void *zmalloc(size_t len) +{ + return calloc(len, 1); +} + +#define max_t(type, x, y) \ + ({ \ + type __max1 = (x); \ + type __max2 = (y); \ + __max1 > __max2 ? __max1: __max2; \ + }) + +#define min_t(type, x, y) \ + ({ \ + type __min1 = (x); \ + type __min2 = (y); \ + __min1 <= __min2 ? __min1: __min2; \ + }) + +#endif /* _LTTNG_UST_HELPER_H */ diff --git a/include/lttng/core.h b/include/lttng/core.h deleted file mode 100644 index 838cdb20..00000000 --- a/include/lttng/core.h +++ /dev/null @@ -1,62 +0,0 @@ -#ifndef UST_CORE_H -#define UST_CORE_H - -/* - * Copyright (C) 2010 Pierre-Marc Fournier - * Copyright (C) 2011 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; version 2.1 of - * the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA - */ - -#include -#include -#include -#include - -/* Min / Max */ - -#define min_t(type, x, y) ({ \ - type __min1 = (x); \ - type __min2 = (y); \ - __min1 < __min2 ? __min1: __min2; }) - -#define max_t(type, x, y) ({ \ - type __max1 = (x); \ - type __max2 = (y); \ - __max1 > __max2 ? __max1: __max2; }) - - -/* MALLOCATION */ - -#include - -static inline -void *zmalloc(size_t len) -{ - return calloc(1, len); -} - -/* MATH */ - -static inline unsigned int hweight32(unsigned int w) -{ - unsigned int res = w - ((w >> 1) & 0x55555555); - res = (res & 0x33333333) + ((res >> 2) & 0x33333333); - res = (res + (res >> 4)) & 0x0F0F0F0F; - res = res + (res >> 8); - return (res + (res >> 16)) & 0x000000FF; -} - -#endif /* UST_CORE_H */ diff --git a/include/lttng/usterr-signal-safe.h b/include/lttng/usterr-signal-safe.h index 3e07d33b..ab4c8a36 100644 --- a/include/lttng/usterr-signal-safe.h +++ b/include/lttng/usterr-signal-safe.h @@ -27,7 +27,6 @@ #include #include -#include #include enum ust_loglevel { diff --git a/include/usterr.h b/include/usterr.h index fd5c80ae..866e9a03 100644 --- a/include/usterr.h +++ b/include/usterr.h @@ -27,7 +27,6 @@ #include #include -#include #include "lttng/share.h" enum ust_loglevel { diff --git a/liblttng-ust/clock.h b/liblttng-ust/clock.h index 3de1fa81..ed191b0b 100644 --- a/liblttng-ust/clock.h +++ b/liblttng-ust/clock.h @@ -24,7 +24,6 @@ #include #include #include -#include /* TRACE CLOCK */ diff --git a/liblttng-ust/ltt-context.c b/liblttng-ust/ltt-context.c index 90747a55..70578a26 100644 --- a/liblttng-ust/ltt-context.c +++ b/liblttng-ust/ltt-context.c @@ -10,7 +10,7 @@ #include #include -#include +#include #include #include diff --git a/liblttng-ust/ltt-events.c b/liblttng-ust/ltt-events.c index 27f24d98..b67998c3 100644 --- a/liblttng-ust/ltt-events.c +++ b/liblttng-ust/ltt-events.c @@ -24,7 +24,6 @@ #include #include #include -#include "lttng/core.h" #include "ltt-tracer.h" #include "ltt-tracer-core.h" #include "wait.h" @@ -33,6 +32,7 @@ #include #include #include "jhash.h" +#include /* * The sessions mutex is the centralized mutex across UST tracing diff --git a/liblttng-ust/ltt-probes.c b/liblttng-ust/ltt-probes.c index fda35bf9..9b25900d 100644 --- a/liblttng-ust/ltt-probes.c +++ b/liblttng-ust/ltt-probes.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include diff --git a/liblttng-ust/ltt-tracer-core.h b/liblttng-ust/ltt-tracer-core.h index 0a0bad99..c54d620e 100644 --- a/liblttng-ust/ltt-tracer-core.h +++ b/liblttng-ust/ltt-tracer-core.h @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/liblttng-ust/ltt-tracer.h b/liblttng-ust/ltt-tracer.h index d51479ce..fb54e9cd 100644 --- a/liblttng-ust/ltt-tracer.h +++ b/liblttng-ust/ltt-tracer.h @@ -25,7 +25,6 @@ #include #include -#include #include #include "ltt-tracer-core.h" #include "compat.h" diff --git a/liblttng-ust/lttng-ust-abi.c b/liblttng-ust/lttng-ust-abi.c index 6a568ba8..dbf53306 100644 --- a/liblttng-ust/lttng-ust-abi.c +++ b/liblttng-ust/lttng-ust-abi.c @@ -29,10 +29,10 @@ #include #include #include -#include "lttng/core.h" #include #include "ltt-tracer.h" #include "tracepoint-internal.h" +#include struct ltt_tracepoint_list { struct tracepoint_iter iter; diff --git a/liblttng-ust/tracepoint.c b/liblttng-ust/tracepoint.c index 2f8474f5..e62b11c7 100644 --- a/liblttng-ust/tracepoint.c +++ b/liblttng-ust/tracepoint.c @@ -29,6 +29,7 @@ #include #include #include +#include #include #include "tracepoint-internal.h" diff --git a/libringbuffer/backend.h b/libringbuffer/backend.h index 69c47ab6..d4824d63 100644 --- a/libringbuffer/backend.h +++ b/libringbuffer/backend.h @@ -16,8 +16,6 @@ #include -#include "lttng/core.h" - /* Internal helpers */ #include "backend_internal.h" #include "frontend_internal.h" diff --git a/libringbuffer/backend_internal.h b/libringbuffer/backend_internal.h index c4fb7604..36d53dfd 100644 --- a/libringbuffer/backend_internal.h +++ b/libringbuffer/backend_internal.h @@ -475,4 +475,20 @@ static inline int get_count_order(unsigned int count) return order; } +static inline +unsigned int hweight32(unsigned int value) +{ + unsigned int r; + + r = value; + r = r - ((r >> 1) & 0x55555555); + r = (r & 0x33333333) + ((r >> 2) & 0x33333333); + r += r >> 4; + r &= 0x0F0F0F0F; + r += r >> 8; + r += r >> 16; + r &= 0x000000FF; + return r; +} + #endif /* _LINUX_RING_BUFFER_BACKEND_INTERNAL_H */ diff --git a/libringbuffer/frontend_api.h b/libringbuffer/frontend_api.h index d644a65b..49f6e4c2 100644 --- a/libringbuffer/frontend_api.h +++ b/libringbuffer/frontend_api.h @@ -18,7 +18,6 @@ */ #include "frontend.h" -#include "lttng/core.h" #include #include diff --git a/libringbuffer/frontend_types.h b/libringbuffer/frontend_types.h index bccd5f85..cb3b21cd 100644 --- a/libringbuffer/frontend_types.h +++ b/libringbuffer/frontend_types.h @@ -21,8 +21,6 @@ #include #include -#include "lttng/core.h" - #include #include #include "backend_types.h" diff --git a/libringbuffer/ring_buffer_backend.c b/libringbuffer/ring_buffer_backend.c index d676b5f8..95346049 100644 --- a/libringbuffer/ring_buffer_backend.c +++ b/libringbuffer/ring_buffer_backend.c @@ -8,8 +8,6 @@ #include -#include "lttng/core.h" - #include #include "vatomic.h" #include "backend.h" diff --git a/libringbuffer/ring_buffer_frontend.c b/libringbuffer/ring_buffer_frontend.c index d469d040..7de1d60c 100644 --- a/libringbuffer/ring_buffer_frontend.c +++ b/libringbuffer/ring_buffer_frontend.c @@ -44,6 +44,7 @@ #include #include #include +#include #include "smp.h" #include diff --git a/libringbuffer/shm.c b/libringbuffer/shm.c index 781295be..994204d1 100644 --- a/libringbuffer/shm.c +++ b/libringbuffer/shm.c @@ -17,6 +17,7 @@ #include #include #include +#include struct shm_object_table *shm_object_table_create(size_t max_nb_obj) { diff --git a/libringbuffer/shm.h b/libringbuffer/shm.h index e8fc8d70..d102b8bf 100644 --- a/libringbuffer/shm.h +++ b/libringbuffer/shm.h @@ -11,7 +11,7 @@ #include #include -#include "lttng/core.h" +#include #include "shm_types.h" /* diff --git a/libringbuffer/smp.c b/libringbuffer/smp.c index f9dbd75a..5b2aedba 100644 --- a/libringbuffer/smp.c +++ b/libringbuffer/smp.c @@ -7,7 +7,6 @@ */ #include -#include "lttng/core.h" #include "usterr.h" #include #include "smp.h" diff --git a/libringbuffer/smp.h b/libringbuffer/smp.h index bef3e0ef..034058e9 100644 --- a/libringbuffer/smp.h +++ b/libringbuffer/smp.h @@ -9,7 +9,6 @@ * Dual LGPL v2.1/GPL v2 license. */ -#include #include "getcpu.h" /* -- 2.34.1