Typo: priorty -> priority
[babeltrace.git] / plugins / utils / muxer / muxer.c
index cd9cc3f2f041fba30aed0ce957227c61cc2bccbe..0779ec8f7eac739d0b117ab4faa19171b8ce2419 100644 (file)
 
 #include <babeltrace/babeltrace-internal.h>
 #include <babeltrace/compat/uuid-internal.h>
-#include <babeltrace/ctf-ir/clock-class.h>
-#include <babeltrace/ctf-ir/event.h>
-#include <babeltrace/graph/clock-class-priority-map.h>
-#include <babeltrace/graph/component-filter.h>
-#include <babeltrace/graph/component.h>
+#include <babeltrace/babeltrace.h>
+#include <babeltrace/values-internal.h>
 #include <babeltrace/graph/component-internal.h>
-#include <babeltrace/graph/notification-event.h>
-#include <babeltrace/graph/notification-inactivity.h>
-#include <babeltrace/graph/notification-iterator.h>
 #include <babeltrace/graph/notification-iterator-internal.h>
-#include <babeltrace/graph/notification.h>
-#include <babeltrace/graph/port.h>
-#include <babeltrace/graph/private-component-filter.h>
-#include <babeltrace/graph/private-component.h>
-#include <babeltrace/graph/private-component.h>
-#include <babeltrace/graph/private-connection.h>
-#include <babeltrace/graph/private-notification-iterator.h>
-#include <babeltrace/graph/private-port.h>
-#include <babeltrace/graph/connection.h>
 #include <babeltrace/graph/connection-internal.h>
-#include <babeltrace/values-internal.h>
 #include <plugins-common.h>
 #include <glib.h>
 #include <stdbool.h>
 #define ASSUME_ABSOLUTE_CLOCK_CLASSES_PARAM_NAME       "assume-absolute-clock-classes"
 
 struct muxer_comp {
-       /* Array of struct bt_private_notification_iterator * (weak refs) */
+       /*
+        * Array of struct
+        * bt_private_connection_private_notification_iterator *
+        * (weak refs)
+        */
        GPtrArray *muxer_notif_iters;
 
        /* Weak ref */
@@ -117,7 +105,7 @@ struct muxer_notif_iter {
        GList *newly_connected_priv_ports;
 
        /* Next thing to return by the "next" method */
-       struct bt_notification_iterator_next_return next_next_return;
+       struct bt_notification_iterator_next_method_return next_next_return;
 
        /* Last time returned in a notification */
        int64_t last_returned_ts_ns;
@@ -240,7 +228,8 @@ void destroy_muxer_comp(struct muxer_comp *muxer_comp)
 
        BT_LOGD("Destroying muxer component: muxer-comp-addr=%p, "
                "muxer-notif-iter-count=%u", muxer_comp,
-               muxer_comp->muxer_notif_iters->len);
+               muxer_comp->muxer_notif_iters ?
+                       muxer_comp->muxer_notif_iters->len : 0);
 
        if (muxer_comp->muxer_notif_iters) {
                g_ptr_array_free(muxer_comp->muxer_notif_iters, TRUE);
@@ -417,7 +406,7 @@ static
 struct bt_notification_iterator *create_notif_iter_on_input_port(
                struct bt_private_port *priv_port, int *ret)
 {
-       struct bt_port *port = bt_port_from_private_port(priv_port);
+       struct bt_port *port = bt_port_from_private(priv_port);
        struct bt_notification_iterator *notif_iter = NULL;
        struct bt_private_connection *priv_conn = NULL;
        enum bt_connection_status conn_status;
@@ -541,7 +530,7 @@ int muxer_notif_iter_handle_newly_connected_ports(
                }
 
                priv_port = node->data;
-               port = bt_port_from_private_port(priv_port);
+               port = bt_port_from_private(priv_port);
                assert(port);
 
                if (!bt_port_is_connected(port)) {
@@ -603,9 +592,9 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                int64_t *ts_ns)
 {
        struct bt_clock_class_priority_map *cc_prio_map = NULL;
-       struct bt_ctf_clock_class *clock_class = NULL;
-       struct bt_ctf_clock_value *clock_value = NULL;
-       struct bt_ctf_event *event = NULL;
+       struct bt_clock_class *clock_class = NULL;
+       struct bt_clock_value *clock_value = NULL;
+       struct bt_event *event = NULL;
        int ret = 0;
        const unsigned char *cc_uuid;
        const char *cc_name;
@@ -649,7 +638,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
         * the youngest.
         */
        if (bt_clock_class_priority_map_get_clock_class_count(cc_prio_map) == 0) {
-               BT_LOGV_STR("Notification's clock class priorty map contains 0 clock classes: "
+               BT_LOGV_STR("Notification's clock class priority map contains 0 clock classes: "
                        "using the last returned timestamp.");
                *ts_ns = last_returned_ts_ns;
                goto end;
@@ -664,8 +653,8 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                goto error;
        }
 
-       cc_uuid = bt_ctf_clock_class_get_uuid(clock_class);
-       cc_name = bt_ctf_clock_class_get_name(clock_class);
+       cc_uuid = bt_clock_class_get_uuid(clock_class);
+       cc_name = bt_clock_class_get_name(clock_class);
 
        if (muxer_notif_iter->clock_class_expectation ==
                        MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ANY) {
@@ -676,7 +665,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                 * the iterator without a true
                 * `assume-absolute-clock-classes` parameter.
                 */
-               if (bt_ctf_clock_class_is_absolute(clock_class)) {
+               if (bt_clock_class_is_absolute(clock_class)) {
                        /* Expect absolute clock classes */
                        muxer_notif_iter->clock_class_expectation =
                                MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE;
@@ -704,7 +693,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
        if (!muxer_comp->assume_absolute_clock_classes) {
                switch (muxer_notif_iter->clock_class_expectation) {
                case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_ABSOLUTE:
-                       if (!bt_ctf_clock_class_is_absolute(clock_class)) {
+                       if (!bt_clock_class_is_absolute(clock_class)) {
                                BT_LOGE("Expecting an absolute clock class, "
                                        "but got a non-absolute one: "
                                        "clock-class-addr=%p, clock-class-name=\"%s\"",
@@ -713,7 +702,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                        }
                        break;
                case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_NO_UUID:
-                       if (bt_ctf_clock_class_is_absolute(clock_class)) {
+                       if (bt_clock_class_is_absolute(clock_class)) {
                                BT_LOGE("Expecting a non-absolute clock class with no UUID, "
                                        "but got an absolute one: "
                                        "clock-class-addr=%p, clock-class-name=\"%s\"",
@@ -747,7 +736,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                        }
                        break;
                case MUXER_NOTIF_ITER_CLOCK_CLASS_EXPECTATION_NOT_ABS_SPEC_UUID:
-                       if (bt_ctf_clock_class_is_absolute(clock_class)) {
+                       if (bt_clock_class_is_absolute(clock_class)) {
                                BT_LOGE("Expecting a non-absolute clock class with a specific UUID, "
                                        "but got an absolute one: "
                                        "clock-class-addr=%p, clock-class-name=\"%s\"",
@@ -819,7 +808,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
        case BT_NOTIFICATION_TYPE_EVENT:
                event = bt_notification_event_get_event(notif);
                assert(event);
-               clock_value = bt_ctf_event_get_clock_value(event,
+               clock_value = bt_event_get_clock_value(event,
                        clock_class);
                break;
        case BT_NOTIFICATION_TYPE_INACTIVITY:
@@ -839,7 +828,7 @@ int get_notif_ts_ns(struct muxer_comp *muxer_comp,
                goto error;
        }
 
-       ret = bt_ctf_clock_value_get_value_ns_from_epoch(clock_value, ts_ns);
+       ret = bt_clock_value_get_value_ns_from_epoch(clock_value, ts_ns);
        if (ret) {
                BT_LOGE("Cannot get nanoseconds from Epoch of clock value: "
                        "clock-value-addr=%p", clock_value);
@@ -1033,12 +1022,12 @@ end:
 }
 
 static
-struct bt_notification_iterator_next_return muxer_notif_iter_do_next(
+struct bt_notification_iterator_next_method_return muxer_notif_iter_do_next(
                struct muxer_comp *muxer_comp,
                struct muxer_notif_iter *muxer_notif_iter)
 {
        struct muxer_upstream_notif_iter *muxer_upstream_notif_iter = NULL;
-       struct bt_notification_iterator_next_return next_return = {
+       struct bt_notification_iterator_next_method_return next_return = {
                .notification = NULL,
                .status = BT_NOTIFICATION_ITERATOR_STATUS_OK,
        };
@@ -1175,7 +1164,7 @@ int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp,
         * iterator's list of newly connected ports. They will be
         * handled by muxer_notif_iter_handle_newly_connected_ports().
         */
-       comp = bt_component_from_private_component(muxer_comp->priv_comp);
+       comp = bt_component_from_private(muxer_comp->priv_comp);
        assert(comp);
        count = bt_component_filter_get_input_port_count(comp);
        if (count < 0) {
@@ -1192,7 +1181,7 @@ int muxer_notif_iter_init_newly_connected_ports(struct muxer_comp *muxer_comp,
                struct bt_port *port;
 
                assert(priv_port);
-               port = bt_port_from_private_port(priv_port);
+               port = bt_port_from_private(priv_port);
                assert(port);
 
                if (!bt_port_is_connected(port)) {
@@ -1232,7 +1221,7 @@ end:
 
 BT_HIDDEN
 enum bt_notification_iterator_status muxer_notif_iter_init(
-               struct bt_private_notification_iterator *priv_notif_iter,
+               struct bt_private_connection_private_notification_iterator *priv_notif_iter,
                struct bt_private_port *output_priv_port)
 {
        struct muxer_comp *muxer_comp = NULL;
@@ -1242,7 +1231,7 @@ enum bt_notification_iterator_status muxer_notif_iter_init(
                BT_NOTIFICATION_ITERATOR_STATUS_OK;
        int ret;
 
-       priv_comp = bt_private_notification_iterator_get_private_component(
+       priv_comp = bt_private_connection_private_notification_iterator_get_private_component(
                priv_notif_iter);
        assert(priv_comp);
        muxer_comp = bt_private_component_get_user_data(priv_comp);
@@ -1299,7 +1288,7 @@ enum bt_notification_iterator_status muxer_notif_iter_init(
                goto error;
        }
 
-       ret = bt_private_notification_iterator_set_user_data(priv_notif_iter,
+       ret = bt_private_connection_private_notification_iterator_set_user_data(priv_notif_iter,
                muxer_notif_iter);
        assert(ret == 0);
        BT_LOGD("Initialized muxer component's notification iterator: "
@@ -1316,7 +1305,7 @@ error:
        }
 
        destroy_muxer_notif_iter(muxer_notif_iter);
-       ret = bt_private_notification_iterator_set_user_data(priv_notif_iter,
+       ret = bt_private_connection_private_notification_iterator_set_user_data(priv_notif_iter,
                NULL);
        assert(ret == 0);
        status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;
@@ -1329,14 +1318,14 @@ end:
 
 BT_HIDDEN
 void muxer_notif_iter_finalize(
-               struct bt_private_notification_iterator *priv_notif_iter)
+               struct bt_private_connection_private_notification_iterator *priv_notif_iter)
 {
        struct muxer_notif_iter *muxer_notif_iter =
-               bt_private_notification_iterator_get_user_data(priv_notif_iter);
+               bt_private_connection_private_notification_iterator_get_user_data(priv_notif_iter);
        struct bt_private_component *priv_comp = NULL;
        struct muxer_comp *muxer_comp = NULL;
 
-       priv_comp = bt_private_notification_iterator_get_private_component(
+       priv_comp = bt_private_connection_private_notification_iterator_get_private_component(
                priv_notif_iter);
        assert(priv_comp);
        muxer_comp = bt_private_component_get_user_data(priv_comp);
@@ -1355,17 +1344,17 @@ void muxer_notif_iter_finalize(
 }
 
 BT_HIDDEN
-struct bt_notification_iterator_next_return muxer_notif_iter_next(
-               struct bt_private_notification_iterator *priv_notif_iter)
+struct bt_notification_iterator_next_method_return muxer_notif_iter_next(
+               struct bt_private_connection_private_notification_iterator *priv_notif_iter)
 {
-       struct bt_notification_iterator_next_return next_ret;
+       struct bt_notification_iterator_next_method_return next_ret;
        struct muxer_notif_iter *muxer_notif_iter =
-               bt_private_notification_iterator_get_user_data(priv_notif_iter);
+               bt_private_connection_private_notification_iterator_get_user_data(priv_notif_iter);
        struct bt_private_component *priv_comp = NULL;
        struct muxer_comp *muxer_comp = NULL;
 
        assert(muxer_notif_iter);
-       priv_comp = bt_private_notification_iterator_get_private_component(
+       priv_comp = bt_private_connection_private_notification_iterator_get_private_component(
                priv_notif_iter);
        assert(priv_comp);
        muxer_comp = bt_private_component_get_user_data(priv_comp);
@@ -1413,7 +1402,7 @@ void muxer_port_connected(
                struct bt_port *other_port)
 {
        struct bt_port *self_port =
-               bt_port_from_private_port(self_private_port);
+               bt_port_from_private(self_private_port);
        struct muxer_comp *muxer_comp =
                bt_private_component_get_user_data(priv_comp);
        size_t i;
@@ -1485,7 +1474,7 @@ BT_HIDDEN
 void muxer_port_disconnected(struct bt_private_component *priv_comp,
                struct bt_private_port *priv_port)
 {
-       struct bt_port *port = bt_port_from_private_port(priv_port);
+       struct bt_port *port = bt_port_from_private(priv_port);
        struct muxer_comp *muxer_comp =
                bt_private_component_get_user_data(priv_comp);
 
This page took 0.033779 seconds and 4 git commands to generate.