Accept port connection method: take other port as parameter
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Tue, 28 Mar 2017 23:09:31 +0000 (19:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 28 May 2017 16:57:39 +0000 (12:57 -0400)
This can be useful, as we already have it at this point when calling the
method, to inspect the other port and its component.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/component/component-class.h
include/babeltrace/component/component-internal.h
lib/component/component.c
lib/component/graph.c
plugins/text/text.c
plugins/utils/dummy/dummy.c
plugins/utils/dummy/dummy.h
plugins/writer/writer.c

index f4761bea5b3da6ae85d3847c58d0c702f3245c0f..774d80950d92a3fc052ada38110834067dcee6a1 100644 (file)
@@ -36,6 +36,7 @@ struct bt_component_class;
 struct bt_component;
 struct bt_private_component;
 struct bt_private_port;
+struct bt_port;
 struct bt_value;
 struct bt_private_notification_iterator;
 
@@ -88,7 +89,8 @@ typedef struct bt_value *(*bt_component_class_query_method)(
 
 typedef enum bt_component_status (*bt_component_class_accept_port_connection_method)(
                struct bt_private_component *private_component,
-               struct bt_private_port *private_port);
+               struct bt_private_port *self_private_port,
+               struct bt_port *other_port);
 
 typedef void (*bt_component_class_port_disconnected_method)(
                struct bt_private_component *private_component,
index c12b3b368a53fb90e080bc4f34025b9ca26bb658..744fb0d31ced6122c7f8b0a1228308fb82c026e1 100644 (file)
@@ -79,7 +79,8 @@ struct bt_private_component *bt_private_component_from_component(
 
 BT_HIDDEN
 enum bt_component_status bt_component_accept_port_connection(
-               struct bt_component *component, struct bt_port *self_port);
+               struct bt_component *component, struct bt_port *self_port,
+               struct bt_port *other_port);
 
 BT_HIDDEN
 void bt_component_port_disconnected(struct bt_component *comp,
index 9a2397545963e9c951a8de70394aeabe96973bd4..456175ff5d33eb8197e4d256173c09e5c91f4ef0 100644 (file)
@@ -534,17 +534,20 @@ end:
 
 BT_HIDDEN
 enum bt_component_status bt_component_accept_port_connection(
-               struct bt_component *comp, struct bt_port *port)
+               struct bt_component *comp, struct bt_port *self_port,
+               struct bt_port *other_port)
 {
        enum bt_component_status status = BT_COMPONENT_STATUS_OK;
 
        assert(comp);
-       assert(port);
+       assert(self_port);
+       assert(other_port);
 
        if (comp->class->methods.accept_port_connection) {
                status = comp->class->methods.accept_port_connection(
                        bt_private_component_from_component(comp),
-                       bt_private_port_from_port(port));
+                       bt_private_port_from_port(self_port),
+                       other_port);
        }
 
        return status;
index 8e21e1a3873cac9bd76a025d0d56a12664da7867..e16a1314260a3a063c71c0998fe1643f896cd0ce 100644 (file)
@@ -256,12 +256,12 @@ struct bt_connection *bt_graph_connect(struct bt_graph *graph,
         * invocation.
         */
        component_status = bt_component_accept_port_connection(
-               upstream_component, upstream_port);
+               upstream_component, upstream_port, downstream_port);
        if (component_status != BT_COMPONENT_STATUS_OK) {
                goto error_rollback;
        }
        component_status = bt_component_accept_port_connection(
-               downstream_component, downstream_port);
+               downstream_component, downstream_port, upstream_port);
        if (component_status != BT_COMPONENT_STATUS_OK) {
                goto error_rollback;
        }
index ecd6bbea65e54fc2a2336e5cc1896192a799ce68..5f833fe5ac22f091557d5d6ebfa57a2990361546 100644 (file)
@@ -163,7 +163,8 @@ end:
 static
 enum bt_component_status text_accept_port_connection(
                struct bt_private_component *component,
-               struct bt_private_port *self_port)
+               struct bt_private_port *self_port,
+               struct bt_port *other_port)
 {
        enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
        struct bt_private_connection *connection;
index 3487b6e7837c1a1d07e3e1b1f72caa2a1ba09e70..23db9d3283f559479c542dca671fed0598a308be 100644 (file)
@@ -24,6 +24,7 @@
 #include <babeltrace/component/component.h>
 #include <babeltrace/component/private-component.h>
 #include <babeltrace/component/private-port.h>
+#include <babeltrace/component/port.h>
 #include <babeltrace/component/private-connection.h>
 #include <babeltrace/component/component-sink.h>
 #include <babeltrace/component/notification/iterator.h>
@@ -82,7 +83,8 @@ error:
 
 enum bt_component_status dummy_accept_port_connection(
                struct bt_private_component *component,
-               struct bt_private_port *self_port)
+               struct bt_private_port *self_port,
+               struct bt_port *other_port)
 {
        enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
        struct dummy *dummy;
index 4800d4ff3066f909a1635dd55cd1d8fd7443dd95..f2133229317852781d7af2e3b698e695f3d9adb9 100644 (file)
@@ -26,6 +26,7 @@
 #include <glib.h>
 #include <babeltrace/component/private-component.h>
 #include <babeltrace/component/private-port.h>
+#include <babeltrace/component/port.h>
 
 struct dummy {
        GPtrArray *iterators;
@@ -36,7 +37,8 @@ enum bt_component_status dummy_init(struct bt_private_component *component,
 void dummy_destroy(struct bt_private_component *component);
 enum bt_component_status dummy_accept_port_connection(
                struct bt_private_component *component,
-               struct bt_private_port *own_port);
+               struct bt_private_port *self_port,
+               struct bt_port *other_port);
 enum bt_component_status dummy_consume(struct bt_private_component *component);
 
 #endif /* BABELTRACE_PLUGINS_UTILS_DUMMY_H */
index 360d0d685d12c171c6e792088636f5ce9e4bfade..6d06468f83f3fe84b29593590b3021d0fcc1cb00 100644 (file)
@@ -189,7 +189,8 @@ end:
 static
 enum bt_component_status writer_component_accept_port_connection(
                struct bt_private_component *component,
-               struct bt_private_port *self_port)
+               struct bt_private_port *self_port,
+               struct bt_port *other_port)
 {
        enum bt_component_status ret = BT_COMPONENT_STATUS_OK;
        struct bt_private_connection *connection;
This page took 0.035079 seconds and 4 git commands to generate.