From: Mathieu Desnoyers Date: Thu, 11 Nov 2021 19:14:06 +0000 (-0500) Subject: Refactoring: move event id field to lttng_ust_event_session_common_private X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=b93e147b9c34e8856ff89f0b5599c7cc7dda14a6;p=lttng-ust.git Refactoring: move event id field to lttng_ust_event_session_common_private Signed-off-by: Mathieu Desnoyers Change-Id: Ideb8da3c1003872eeba6ed3c0d5ee6cf183934e3 --- diff --git a/src/common/counter-clients/percpu-32-modular.c b/src/common/counter-clients/percpu-32-modular.c index 9d0add6f..8675dc3d 100644 --- a/src/common/counter-clients/percpu-32-modular.c +++ b/src/common/counter-clients/percpu-32-modular.c @@ -71,7 +71,7 @@ static int counter_add(struct lttng_ust_channel_counter *counter, static int event_counter_add(struct lttng_ust_event_counter *event_counter, int64_t v) { struct lttng_ust_channel_counter *counter = event_counter->chan; - size_t index = event_counter->priv->counter_index; + size_t index = event_counter->priv->parent.id; return counter_add(counter, &index, v); } diff --git a/src/common/counter-clients/percpu-64-modular.c b/src/common/counter-clients/percpu-64-modular.c index 98509b34..c73f8d99 100644 --- a/src/common/counter-clients/percpu-64-modular.c +++ b/src/common/counter-clients/percpu-64-modular.c @@ -71,7 +71,7 @@ static int counter_add(struct lttng_ust_channel_counter *counter, static int event_counter_add(struct lttng_ust_event_counter *event_counter, int64_t v) { struct lttng_ust_channel_counter *counter = event_counter->chan; - size_t index = event_counter->priv->counter_index; + size_t index = event_counter->priv->parent.id; return counter_add(counter, &index, v); } diff --git a/src/common/events.h b/src/common/events.h index ff86c016..c8d37046 100644 --- a/src/common/events.h +++ b/src/common/events.h @@ -310,13 +310,14 @@ struct lttng_ust_event_session_common_private { struct lttng_ust_ctx *ctx; struct lttng_ust_channel_common *chan; + + uint64_t id; /* Event id */ }; struct lttng_ust_event_recorder_private { struct lttng_ust_event_session_common_private parent; struct lttng_ust_event_recorder *pub; /* Public event interface */ - unsigned int id; }; struct lttng_ust_event_counter_private { @@ -324,7 +325,6 @@ struct lttng_ust_event_counter_private { struct lttng_ust_event_counter *pub; /* Public event interface */ char key[LTTNG_KEY_TOKEN_STRING_LEN_MAX]; - uint64_t counter_index; }; struct lttng_ust_event_notifier_private { diff --git a/src/common/ringbuffer-clients/template.h b/src/common/ringbuffer-clients/template.h index 98cc9ef5..96c55d8b 100644 --- a/src/common/ringbuffer-clients/template.h +++ b/src/common/ringbuffer-clients/template.h @@ -687,7 +687,7 @@ int lttng_event_reserve(struct lttng_ust_ring_buffer_ctx *ctx) struct lttng_ust_ring_buffer_ctx_private *private_ctx; uint32_t event_id; - event_id = event_recorder->priv->id; + event_id = (uint32_t) event_recorder->priv->parent.id; client_ctx.chan_ctx = lttng_ust_rcu_dereference(lttng_chan->priv->ctx); client_ctx.event_ctx = lttng_ust_rcu_dereference(event_recorder->priv->parent.ctx); /* Compute internal size of context structures. */ diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index cbc887d0..c5ca6aaa 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -965,15 +965,13 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en struct lttng_ust_event_recorder_private *event_recorder_priv = caa_container_of(event->priv, struct lttng_ust_event_recorder_private, parent.parent); struct lttng_ust_session *session = event_recorder_enabler->chan->parent->session; - uint64_t id; - int ret; notify_socket = lttng_get_notify_socket(session->priv->owner); if (notify_socket < 0) return notify_socket; /* Fetch event ID from sessiond */ - ret = ustcomm_register_event(notify_socket, + return ustcomm_register_event(notify_socket, session, session->priv->objd, event_recorder_enabler->chan->priv->parent.objd, @@ -984,11 +982,7 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en desc->tp_class->fields, uri, 0, - &id); - if (ret) - return ret; - event_recorder_priv->id = id; - return 0; + &event_recorder_priv->parent.id); } case LTTNG_EVENT_ENABLER_TYPE_NOTIFIER: @@ -1018,7 +1012,7 @@ int lttng_event_register_to_sessiond(struct lttng_event_enabler_common *event_en desc->tp_class->fields, uri, event_counter_enabler->parent.parent.user_token, - &event_counter_priv->counter_index); + &event_counter_priv->parent.id); } default: return -EINVAL;