From 86eca0c91d270d4c2d77cd8dc923929f9317c54b Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Mon, 8 Nov 2021 14:28:05 -0500 Subject: [PATCH] Refactoring: combine notifier and session-common hash table types Signed-off-by: Mathieu Desnoyers Change-Id: Id6b25e25d58c36bf6b5675210c383106c7599d9f --- src/common/events.h | 8 +------- src/lib/lttng-ust/lttng-events.c | 6 +++--- 2 files changed, 4 insertions(+), 10 deletions(-) diff --git a/src/common/events.h b/src/common/events.h index 955e307a..0eb7ecc9 100644 --- a/src/common/events.h +++ b/src/common/events.h @@ -252,12 +252,6 @@ struct lttng_ust_event_ht { struct cds_hlist_head table[LTTNG_UST_EVENT_HT_SIZE]; }; -#define LTTNG_UST_EVENT_NOTIFIER_HT_BITS 12 -#define LTTNG_UST_EVENT_NOTIFIER_HT_SIZE (1U << LTTNG_UST_EVENT_NOTIFIER_HT_BITS) -struct lttng_ust_event_notifier_ht { - struct cds_hlist_head table[LTTNG_UST_EVENT_NOTIFIER_HT_SIZE]; -}; - #define LTTNG_UST_ENUM_HT_BITS 12 #define LTTNG_UST_ENUM_HT_SIZE (1U << LTTNG_UST_ENUM_HT_BITS) @@ -272,7 +266,7 @@ struct lttng_event_notifier_group { struct cds_list_head node; /* Event notifier group handle list */ struct cds_list_head enablers_head; struct cds_list_head event_notifiers_head; /* list of event_notifiers */ - struct lttng_ust_event_notifier_ht event_notifiers_ht; /* hashtable of event_notifiers */ + struct lttng_ust_event_ht event_notifiers_ht; /* hashtable of event notifiers */ struct lttng_ust_ctx *ctx; /* contexts for filters. */ struct lttng_ust_channel_counter *error_counter; diff --git a/src/lib/lttng-ust/lttng-events.c b/src/lib/lttng-ust/lttng-events.c index 57c323cf..4ffba70d 100644 --- a/src/lib/lttng-ust/lttng-events.c +++ b/src/lib/lttng-ust/lttng-events.c @@ -229,7 +229,7 @@ struct lttng_event_notifier_group *lttng_event_notifier_group_create(void) CDS_INIT_LIST_HEAD(&event_notifier_group->enablers_head); CDS_INIT_LIST_HEAD(&event_notifier_group->event_notifiers_head); - for (i = 0; i < LTTNG_UST_EVENT_NOTIFIER_HT_SIZE; i++) + for (i = 0; i < LTTNG_UST_EVENT_HT_SIZE; i++) CDS_INIT_HLIST_HEAD(&event_notifier_group->event_notifiers_ht.table[i]); cds_list_add(&event_notifier_group->node, &event_notifier_groups); @@ -1041,7 +1041,7 @@ int lttng_event_notifier_create(struct lttng_event_notifier_enabler *event_notif lttng_ust_format_event_name(desc, name); head = borrow_hash_table_bucket( event_notifier_group->event_notifiers_ht.table, - LTTNG_UST_EVENT_NOTIFIER_HT_SIZE, name); + LTTNG_UST_EVENT_HT_SIZE, name); cds_hlist_for_each_entry(event_priv, node, head, name_hlist_node) { /* @@ -1430,7 +1430,7 @@ void probe_provider_event_for_each(const struct lttng_ust_probe_desc *provider_d lttng_ust_format_event_name(event_desc, name); head = borrow_hash_table_bucket( event_notifier_group->event_notifiers_ht.table, - LTTNG_UST_EVENT_NOTIFIER_HT_SIZE, name); + LTTNG_UST_EVENT_HT_SIZE, name); cds_hlist_for_each_entry_safe(event_priv, node, tmp_node, head, name_hlist_node) { if (event_desc == event_priv->desc) { -- 2.34.1