sessiond: context.cpp: iterate on lfht using lfht_iteration_adapter
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Fri, 26 Jul 2024 19:52:38 +0000 (19:52 +0000)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Tue, 30 Jul 2024 01:26:51 +0000 (01:26 +0000)
Change-Id: Idbcd23b281188732f1746e9f1f911c527b1f0903
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
src/bin/lttng-sessiond/context.cpp

index 0e9e91f0e7f6d030feb91dd88eb29af43a07f115..656314bd24f01a72f6781d17986e469039facdc8 100644 (file)
@@ -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<ltt_ust_channel,
+                                                        decltype(ltt_ust_channel::node),
+                                                        &ltt_ust_channel::node>(*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;
                        }
                }
This page took 0.025452 seconds and 4 git commands to generate.