From 867b47257f503a929308d62fdb8656da18408bd8 Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Fri, 24 Nov 2023 17:29:26 -0500 Subject: [PATCH] Move side_callback to libside internals Signed-off-by: Mathieu Desnoyers --- include/side/instrumentation-c-api.h | 2 +- include/side/trace.h | 15 ++------------- src/side.c | 15 ++++++++++++++- 3 files changed, 17 insertions(+), 15 deletions(-) diff --git a/include/side/instrumentation-c-api.h b/include/side/instrumentation-c-api.h index be61d6c..048dfea 100644 --- a/include/side/instrumentation-c-api.h +++ b/include/side/instrumentation-c-api.h @@ -1165,7 +1165,7 @@ }, \ .nr_callbacks = 0, \ .enabled = 0, \ - .callbacks = &side_empty_callback, \ + .callbacks = (const struct side_callback *) &side_empty_callback[0], \ .desc = &(_identifier), \ }; \ _linkage struct side_event_description __attribute__((section("side_event_description"))) \ diff --git a/include/side/trace.h b/include/side/trace.h index b4d56cc..5df637f 100644 --- a/include/side/trace.h +++ b/include/side/trace.h @@ -72,20 +72,9 @@ struct side_event_state_0 { extern "C" { #endif -struct side_callback { - union { - void (*call)(const struct side_event_description *desc, - const struct side_arg_vec *side_arg_vec, - void *priv); - void (*call_variadic)(const struct side_event_description *desc, - const struct side_arg_vec *side_arg_vec, - const struct side_arg_dynamic_struct *var_struct, - void *priv); - } u; - void *priv; -}; +struct side_callback; -extern const struct side_callback side_empty_callback; +extern const char side_empty_callback[]; void side_call(const struct side_event_state *state, const struct side_arg_vec *side_arg_vec); diff --git a/src/side.c b/src/side.c index bcce608..b781712 100644 --- a/src/side.c +++ b/src/side.c @@ -38,6 +38,19 @@ struct side_tracer_handle { void *priv; }; +struct side_callback { + union { + void (*call)(const struct side_event_description *desc, + const struct side_arg_vec *side_arg_vec, + void *priv); + void (*call_variadic)(const struct side_event_description *desc, + const struct side_arg_vec *side_arg_vec, + const struct side_arg_dynamic_struct *var_struct, + void *priv); + } u; + void *priv; +}; + static struct side_rcu_gp_state rcu_gp; /* @@ -61,7 +74,7 @@ static DEFINE_SIDE_LIST_HEAD(side_tracer_list); * The empty callback has a NULL function callback pointer, which stops * iteration on the array of callbacks immediately. */ -const struct side_callback side_empty_callback = { }; +const char side_empty_callback[sizeof(struct side_callback)]; void side_call(const struct side_event_state *event_state, const struct side_arg_vec *side_arg_vec) { -- 2.34.1