From: Jérémie Galarneau Date: Fri, 26 Jul 2024 19:52:38 +0000 (+0000) Subject: sessiond: context.cpp: iterate on lfht using lfht_iteration_adapter X-Git-Url: http://git.lttng.org./?a=commitdiff_plain;h=ad3be2dea67b8e2cb16350c2371f6ce273cf2b81;p=lttng-tools.git sessiond: context.cpp: iterate on lfht using lfht_iteration_adapter Change-Id: Idbcd23b281188732f1746e9f1f911c527b1f0903 Signed-off-by: Jérémie Galarneau --- diff --git a/src/bin/lttng-sessiond/context.cpp b/src/bin/lttng-sessiond/context.cpp index 0e9e91f0e..656314bd2 100644 --- a/src/bin/lttng-sessiond/context.cpp +++ b/src/bin/lttng-sessiond/context.cpp @@ -367,9 +367,8 @@ int context_ust_add(struct ltt_ust_session *usess, const char *channel_name) { int ret = LTTNG_OK; - struct lttng_ht_iter iter; struct lttng_ht *chan_ht; - struct ltt_ust_channel *uchan = nullptr; + ltt_ust_channel *uchan = nullptr; LTTNG_ASSERT(usess); LTTNG_ASSERT(ctx); @@ -393,10 +392,13 @@ int context_ust_add(struct ltt_ust_session *usess, ret = add_uctx_to_channel(usess, domain, uchan, ctx); } else { /* Add ctx all events, all channels */ - cds_lfht_for_each_entry (chan_ht->ht, &iter.iter, uchan, node.node) { - ret = add_uctx_to_channel(usess, domain, uchan, ctx); + for (auto *iterated_uchan : + lttng::urcu::lfht_iteration_adapter(*chan_ht->ht)) { + ret = add_uctx_to_channel(usess, domain, iterated_uchan, ctx); if (ret) { - ERR("Failed to add context to channel %s", uchan->name); + ERR("Failed to add context to channel %s", iterated_uchan->name); continue; } }