From: Mathieu Desnoyers Date: Thu, 15 Apr 2021 20:28:08 +0000 (-0400) Subject: Rename ringbuffer-context.h to ust-ringbuffer-context.h X-Git-Tag: v2.13.0-rc1~94 X-Git-Url: https://git.lttng.org/?a=commitdiff_plain;h=0b4b88119eced28c0cd4fcec773f76525103ac3f;p=lttng-ust.git Rename ringbuffer-context.h to ust-ringbuffer-context.h For naming consistency of public headers. Signed-off-by: Mathieu Desnoyers Change-Id: If01b2157c4e150b5bd7740348c9f7372ebf5ac97 --- diff --git a/include/Makefile.am b/include/Makefile.am index 042f9e00..287fe13d 100644 --- a/include/Makefile.am +++ b/include/Makefile.am @@ -21,7 +21,7 @@ nobase_include_HEADERS = \ lttng/ust-compiler.h \ lttng/ust-fork.h \ lttng/ust-endian.h \ - lttng/ringbuffer-context.h \ + lttng/ust-ringbuffer-context.h \ lttng/ust-utils.h \ lttng/ust-error.h \ lttng/tracef.h \ diff --git a/include/lttng/ringbuffer-context.h b/include/lttng/ringbuffer-context.h deleted file mode 100644 index a31e80e3..00000000 --- a/include/lttng/ringbuffer-context.h +++ /dev/null @@ -1,131 +0,0 @@ -/* - * SPDX-License-Identifier: MIT - * - * Copyright (C) 2010-2021 Mathieu Desnoyers - * - * Ring buffer context header. - */ - -#ifndef _LTTNG_RING_BUFFER_CONTEXT_H -#define _LTTNG_RING_BUFFER_CONTEXT_H - -#include -#include -#include -#include -#include - -#include -#include -#include - -struct lttng_ust_ring_buffer; -struct lttng_ust_ring_buffer_channel; -struct lttng_ust_ring_buffer_ctx; -struct lttng_ust_ring_buffer_ctx_private; - -/* - * ring buffer context - * - * IMPORTANT: this structure is part of the ABI between the probe and - * UST. Fields need to be only added at the end, never reordered, never - * removed. - * - * The field @struct_size should be used to determine the size of the - * structure. It should be queried before using additional fields added - * at the end of the structure. - */ -struct lttng_ust_ring_buffer_ctx { - uint32_t struct_size; /* Size of this structure. */ - - void *client_priv; /* Ring buffer client private data */ - size_t data_size; /* size of payload */ - int largest_align; /* - * alignment of the largest element - * in the payload - */ - void *ip; /* caller ip address */ - - /* Private ring buffer context, set by reserve callback. */ - struct lttng_ust_ring_buffer_ctx_private *priv; - - /* End of base ABI. Fields below should be used after checking struct_size. */ -}; - -/** - * lttng_ust_ring_buffer_ctx_init - initialize ring buffer context - * @ctx: ring buffer context to initialize - * @client_priv: client private data - * @data_size: size of record data payload - * @largest_align: largest alignment within data payload types - * @ip: caller ip address - */ -static inline -void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx, - void *client_priv, size_t data_size, int largest_align, - void *ip) - lttng_ust_notrace; -static inline -void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx, - void *client_priv, size_t data_size, int largest_align, - void *ip) -{ - ctx->struct_size = sizeof(struct lttng_ust_ring_buffer_ctx); - ctx->client_priv = client_priv; - ctx->data_size = data_size; - ctx->largest_align = largest_align; - ctx->ip = ip; - ctx->priv = NULL; -} - -/* - * We need to define LTTNG_UST_RING_BUFFER_ALIGN_ATTR so it is known early at - * compile-time. We have to duplicate the "config->align" information and the - * definition here because config->align is used both in the slow and fast - * paths, but LTTNG_UST_RING_BUFFER_ALIGN_ATTR is only available for the client - * code. - */ -#ifdef LTTNG_UST_RING_BUFFER_NATURAL_ALIGN - -# define LTTNG_UST_RING_BUFFER_ALIGN_ATTR /* Default arch alignment */ - -/* - * lttng_ust_ring_buffer_align - Calculate the offset needed to align the type. - * @align_drift: object offset from an "alignment"-aligned address. - * @size_of_type: Must be non-zero, power of 2. - */ -static inline -unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) - lttng_ust_notrace; -static inline -unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) -{ - return lttng_ust_offset_align(align_drift, size_of_type); -} - -#else - -# define LTTNG_UST_RING_BUFFER_ALIGN_ATTR __attribute__((packed)) - -/* - * lttng_ust_ring_buffer_align - Calculate the offset needed to align the type. - * @align_drift: object offset from an "alignment"-aligned address. - * @size_of_type: Must be non-zero, power of 2. - */ -static inline -unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) - lttng_ust_notrace; -static inline -unsigned int lttng_ust_ring_buffer_align(size_t align_drift __attribute__((unused)), - size_t size_of_type __attribute__((unused))) -{ - /* - * On architectures with efficient unaligned memory access, the content - * of the ringbuffer is packed and so the offset is always zero. - */ - return 0; -} - -#endif - -#endif /* _LTTNG_RING_BUFFER_CONTEXT_H */ diff --git a/include/lttng/ust-ringbuffer-context.h b/include/lttng/ust-ringbuffer-context.h new file mode 100644 index 00000000..133d802d --- /dev/null +++ b/include/lttng/ust-ringbuffer-context.h @@ -0,0 +1,131 @@ +/* + * SPDX-License-Identifier: MIT + * + * Copyright (C) 2010-2021 Mathieu Desnoyers + * + * Ring buffer context header. + */ + +#ifndef _LTTNG_UST_RING_BUFFER_CONTEXT_H +#define _LTTNG_UST_RING_BUFFER_CONTEXT_H + +#include +#include +#include +#include +#include + +#include +#include +#include + +struct lttng_ust_ring_buffer; +struct lttng_ust_ring_buffer_channel; +struct lttng_ust_ring_buffer_ctx; +struct lttng_ust_ring_buffer_ctx_private; + +/* + * ring buffer context + * + * IMPORTANT: this structure is part of the ABI between the probe and + * UST. Fields need to be only added at the end, never reordered, never + * removed. + * + * The field @struct_size should be used to determine the size of the + * structure. It should be queried before using additional fields added + * at the end of the structure. + */ +struct lttng_ust_ring_buffer_ctx { + uint32_t struct_size; /* Size of this structure. */ + + void *client_priv; /* Ring buffer client private data */ + size_t data_size; /* size of payload */ + int largest_align; /* + * alignment of the largest element + * in the payload + */ + void *ip; /* caller ip address */ + + /* Private ring buffer context, set by reserve callback. */ + struct lttng_ust_ring_buffer_ctx_private *priv; + + /* End of base ABI. Fields below should be used after checking struct_size. */ +}; + +/** + * lttng_ust_ring_buffer_ctx_init - initialize ring buffer context + * @ctx: ring buffer context to initialize + * @client_priv: client private data + * @data_size: size of record data payload + * @largest_align: largest alignment within data payload types + * @ip: caller ip address + */ +static inline +void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx, + void *client_priv, size_t data_size, int largest_align, + void *ip) + lttng_ust_notrace; +static inline +void lttng_ust_ring_buffer_ctx_init(struct lttng_ust_ring_buffer_ctx *ctx, + void *client_priv, size_t data_size, int largest_align, + void *ip) +{ + ctx->struct_size = sizeof(struct lttng_ust_ring_buffer_ctx); + ctx->client_priv = client_priv; + ctx->data_size = data_size; + ctx->largest_align = largest_align; + ctx->ip = ip; + ctx->priv = NULL; +} + +/* + * We need to define LTTNG_UST_RING_BUFFER_ALIGN_ATTR so it is known early at + * compile-time. We have to duplicate the "config->align" information and the + * definition here because config->align is used both in the slow and fast + * paths, but LTTNG_UST_RING_BUFFER_ALIGN_ATTR is only available for the client + * code. + */ +#ifdef LTTNG_UST_RING_BUFFER_NATURAL_ALIGN + +# define LTTNG_UST_RING_BUFFER_ALIGN_ATTR /* Default arch alignment */ + +/* + * lttng_ust_ring_buffer_align - Calculate the offset needed to align the type. + * @align_drift: object offset from an "alignment"-aligned address. + * @size_of_type: Must be non-zero, power of 2. + */ +static inline +unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) + lttng_ust_notrace; +static inline +unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) +{ + return lttng_ust_offset_align(align_drift, size_of_type); +} + +#else + +# define LTTNG_UST_RING_BUFFER_ALIGN_ATTR __attribute__((packed)) + +/* + * lttng_ust_ring_buffer_align - Calculate the offset needed to align the type. + * @align_drift: object offset from an "alignment"-aligned address. + * @size_of_type: Must be non-zero, power of 2. + */ +static inline +unsigned int lttng_ust_ring_buffer_align(size_t align_drift, size_t size_of_type) + lttng_ust_notrace; +static inline +unsigned int lttng_ust_ring_buffer_align(size_t align_drift __attribute__((unused)), + size_t size_of_type __attribute__((unused))) +{ + /* + * On architectures with efficient unaligned memory access, the content + * of the ringbuffer is packed and so the offset is always zero. + */ + return 0; +} + +#endif + +#endif /* _LTTNG_UST_RING_BUFFER_CONTEXT_H */ diff --git a/include/lttng/ust-tracepoint-event.h b/include/lttng/ust-tracepoint-event.h index 28684092..ea0e9564 100644 --- a/include/lttng/ust-tracepoint-event.h +++ b/include/lttng/ust-tracepoint-event.h @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/common/ringbuffer/backend_internal.h b/src/common/ringbuffer/backend_internal.h index 96561b03..9ce9d140 100644 --- a/src/common/ringbuffer/backend_internal.h +++ b/src/common/ringbuffer/backend_internal.h @@ -14,7 +14,7 @@ #include #include -#include +#include #include "ringbuffer-config.h" #include "backend_types.h" #include "frontend_types.h" diff --git a/src/common/ringbuffer/frontend_internal.h b/src/common/ringbuffer/frontend_internal.h index 8ec90dbc..9655a19f 100644 --- a/src/common/ringbuffer/frontend_internal.h +++ b/src/common/ringbuffer/frontend_internal.h @@ -17,7 +17,7 @@ #include #include -#include +#include #include "ringbuffer-config.h" #include "backend_types.h" #include "backend_internal.h" diff --git a/src/common/ringbuffer/frontend_types.h b/src/common/ringbuffer/frontend_types.h index e368c734..57655797 100644 --- a/src/common/ringbuffer/frontend_types.h +++ b/src/common/ringbuffer/frontend_types.h @@ -18,7 +18,7 @@ #include #include -#include +#include #include "ringbuffer-config.h" #include "common/logging.h" #include "backend_types.h" diff --git a/src/common/ringbuffer/ring_buffer_backend.c b/src/common/ringbuffer/ring_buffer_backend.c index c880c9d6..5a998742 100644 --- a/src/common/ringbuffer/ring_buffer_backend.c +++ b/src/common/ringbuffer/ring_buffer_backend.c @@ -12,7 +12,7 @@ #include #include -#include +#include #include "ringbuffer-config.h" #include "vatomic.h" diff --git a/src/common/ringbuffer/ring_buffer_frontend.c b/src/common/ringbuffer/ring_buffer_frontend.c index 924d6852..5a9117f6 100644 --- a/src/common/ringbuffer/ring_buffer_frontend.c +++ b/src/common/ringbuffer/ring_buffer_frontend.c @@ -53,7 +53,7 @@ #include "common/macros.h" #include -#include +#include #include "smp.h" #include "ringbuffer-config.h" diff --git a/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c b/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c index 1562ab0a..6f6d0e06 100644 --- a/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c +++ b/src/lib/lttng-ust-java-agent/jni/common/lttng_ust_context.c @@ -11,7 +11,7 @@ #include #include #include -#include +#include #include #include "common/macros.h" diff --git a/src/lib/lttng-ust/lttng-context-cgroup-ns.c b/src/lib/lttng-ust/lttng-context-cgroup-ns.c index 1d5abc2d..7e992d86 100644 --- a/src/lib/lttng-ust/lttng-context-cgroup-ns.c +++ b/src/lib/lttng-ust/lttng-context-cgroup-ns.c @@ -17,7 +17,7 @@ #include #include "common/compat/tid.h" #include -#include +#include #include "context-internal.h" #include "lttng-tracer-core.h" diff --git a/src/lib/lttng-ust/lttng-context-cpu-id.c b/src/lib/lttng-ust/lttng-context-cpu-id.c index 9ade4dfb..f1455ea1 100644 --- a/src/lib/lttng-ust/lttng-context-cpu-id.c +++ b/src/lib/lttng-ust/lttng-context-cpu-id.c @@ -20,7 +20,7 @@ #include #include #include "lib/lttng-ust/getcpu.h" -#include +#include #include "context-internal.h" diff --git a/src/lib/lttng-ust/lttng-context-ip.c b/src/lib/lttng-ust/lttng-context-ip.c index 9cf72eb2..2a652913 100644 --- a/src/lib/lttng-ust/lttng-context-ip.c +++ b/src/lib/lttng-ust/lttng-context-ip.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "context-internal.h" diff --git a/src/lib/lttng-ust/lttng-context-ipc-ns.c b/src/lib/lttng-ust/lttng-context-ipc-ns.c index f37252cd..d6206bd4 100644 --- a/src/lib/lttng-ust/lttng-context-ipc-ns.c +++ b/src/lib/lttng-ust/lttng-context-ipc-ns.c @@ -17,7 +17,7 @@ #include #include "common/compat/tid.h" #include -#include +#include #include "context-internal.h" #include "lttng-tracer-core.h" diff --git a/src/lib/lttng-ust/lttng-context-mnt-ns.c b/src/lib/lttng-ust/lttng-context-mnt-ns.c index 4cd552e7..e7b32e64 100644 --- a/src/lib/lttng-ust/lttng-context-mnt-ns.c +++ b/src/lib/lttng-ust/lttng-context-mnt-ns.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/ns.h" diff --git a/src/lib/lttng-ust/lttng-context-net-ns.c b/src/lib/lttng-ust/lttng-context-net-ns.c index af80eab5..5a8086f4 100644 --- a/src/lib/lttng-ust/lttng-context-net-ns.c +++ b/src/lib/lttng-ust/lttng-context-net-ns.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "common/compat/tid.h" #include diff --git a/src/lib/lttng-ust/lttng-context-perf-counters.c b/src/lib/lttng-ust/lttng-context-perf-counters.c index e1ce4890..e6833ecd 100644 --- a/src/lib/lttng-ust/lttng-context-perf-counters.c +++ b/src/lib/lttng-ust/lttng-context-perf-counters.c @@ -21,7 +21,7 @@ #include #include #include -#include +#include #include #include #include diff --git a/src/lib/lttng-ust/lttng-context-pid-ns.c b/src/lib/lttng-ust/lttng-context-pid-ns.c index a67b0e3b..f8e5aa4f 100644 --- a/src/lib/lttng-ust/lttng-context-pid-ns.c +++ b/src/lib/lttng-ust/lttng-context-pid-ns.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/ns.h" diff --git a/src/lib/lttng-ust/lttng-context-procname.c b/src/lib/lttng-ust/lttng-context-procname.c index 09484d85..093b50c7 100644 --- a/src/lib/lttng-ust/lttng-context-procname.c +++ b/src/lib/lttng-ust/lttng-context-procname.c @@ -10,7 +10,7 @@ #include #include #include -#include +#include #include #include #include "common/compat/pthread.h" diff --git a/src/lib/lttng-ust/lttng-context-pthread-id.c b/src/lib/lttng-ust/lttng-context-pthread-id.c index f6f8d768..8a608c24 100644 --- a/src/lib/lttng-ust/lttng-context-pthread-id.c +++ b/src/lib/lttng-ust/lttng-context-pthread-id.c @@ -12,7 +12,7 @@ #include #include #include -#include +#include #include "context-internal.h" diff --git a/src/lib/lttng-ust/lttng-context-time-ns.c b/src/lib/lttng-ust/lttng-context-time-ns.c index ea3acc21..328d9e08 100644 --- a/src/lib/lttng-ust/lttng-context-time-ns.c +++ b/src/lib/lttng-ust/lttng-context-time-ns.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "common/compat/tid.h" #include #include "lttng-tracer-core.h" diff --git a/src/lib/lttng-ust/lttng-context-user-ns.c b/src/lib/lttng-ust/lttng-context-user-ns.c index 70c0b3e3..ab49e34c 100644 --- a/src/lib/lttng-ust/lttng-context-user-ns.c +++ b/src/lib/lttng-ust/lttng-context-user-ns.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/ns.h" diff --git a/src/lib/lttng-ust/lttng-context-uts-ns.c b/src/lib/lttng-ust/lttng-context-uts-ns.c index 3266b553..9ca666eb 100644 --- a/src/lib/lttng-ust/lttng-context-uts-ns.c +++ b/src/lib/lttng-ust/lttng-context-uts-ns.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "common/compat/tid.h" #include diff --git a/src/lib/lttng-ust/lttng-context-vegid.c b/src/lib/lttng-ust/lttng-context-vegid.c index b8b23ab7..9fcd43ec 100644 --- a/src/lib/lttng-ust/lttng-context-vegid.c +++ b/src/lib/lttng-ust/lttng-context-vegid.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/creds.h" diff --git a/src/lib/lttng-ust/lttng-context-veuid.c b/src/lib/lttng-ust/lttng-context-veuid.c index a351284f..201ee2f3 100644 --- a/src/lib/lttng-ust/lttng-context-veuid.c +++ b/src/lib/lttng-ust/lttng-context-veuid.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/creds.h" diff --git a/src/lib/lttng-ust/lttng-context-vgid.c b/src/lib/lttng-ust/lttng-context-vgid.c index 93f65e80..312580e3 100644 --- a/src/lib/lttng-ust/lttng-context-vgid.c +++ b/src/lib/lttng-ust/lttng-context-vgid.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/creds.h" diff --git a/src/lib/lttng-ust/lttng-context-vpid.c b/src/lib/lttng-ust/lttng-context-vpid.c index 37d607f8..47b5a8e1 100644 --- a/src/lib/lttng-ust/lttng-context-vpid.c +++ b/src/lib/lttng-ust/lttng-context-vpid.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "context-internal.h" diff --git a/src/lib/lttng-ust/lttng-context-vsgid.c b/src/lib/lttng-ust/lttng-context-vsgid.c index 1363265c..e05e680d 100644 --- a/src/lib/lttng-ust/lttng-context-vsgid.c +++ b/src/lib/lttng-ust/lttng-context-vsgid.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/creds.h" diff --git a/src/lib/lttng-ust/lttng-context-vsuid.c b/src/lib/lttng-ust/lttng-context-vsuid.c index c679a26d..ee2f022b 100644 --- a/src/lib/lttng-ust/lttng-context-vsuid.c +++ b/src/lib/lttng-ust/lttng-context-vsuid.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/creds.h" diff --git a/src/lib/lttng-ust/lttng-context-vtid.c b/src/lib/lttng-ust/lttng-context-vtid.c index ff91002d..732a8205 100644 --- a/src/lib/lttng-ust/lttng-context-vtid.c +++ b/src/lib/lttng-ust/lttng-context-vtid.c @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "common/compat/tid.h" #include diff --git a/src/lib/lttng-ust/lttng-context-vuid.c b/src/lib/lttng-ust/lttng-context-vuid.c index 8f40aae4..3e72d05e 100644 --- a/src/lib/lttng-ust/lttng-context-vuid.c +++ b/src/lib/lttng-ust/lttng-context-vuid.c @@ -15,7 +15,7 @@ #include #include #include -#include +#include #include "context-internal.h" #include "common/creds.h" diff --git a/src/lib/lttng-ust/lttng-tracer-core.h b/src/lib/lttng-ust/lttng-tracer-core.h index df4857b9..ade4636a 100644 --- a/src/lib/lttng-ust/lttng-tracer-core.h +++ b/src/lib/lttng-ust/lttng-tracer-core.h @@ -13,7 +13,7 @@ #include #include #include -#include +#include #include "common/logging.h" struct lttng_ust_session; diff --git a/tests/compile/test-app-ctx/hello.c b/tests/compile/test-app-ctx/hello.c index a8c40451..be63ecbc 100644 --- a/tests/compile/test-app-ctx/hello.c +++ b/tests/compile/test-app-ctx/hello.c @@ -29,7 +29,7 @@ struct mmsghdr; #include "ust_tests_hello.h" #include -#include +#include /* Internal header. */ #include