X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Fport.c;h=f119d60b6dfb5414ac805cc90b3b1550c4296f2b;hb=3fadfbc0c91f82c46bd36e6e0657ea93570c9db1;hp=01ee3944fc62bc83d101545da44266055e966399;hpb=e2f7325d1e58710ee928373592adcee466f93d06;p=babeltrace.git diff --git a/lib/graph/port.c b/lib/graph/port.c index 01ee3944..f119d60b 100644 --- a/lib/graph/port.c +++ b/lib/graph/port.c @@ -22,22 +22,21 @@ */ #define BT_LOG_TAG "PORT" -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include static void destroy_port(struct bt_object *obj) @@ -138,36 +137,44 @@ void bt_port_set_connection(struct bt_port *port, connection); } -enum bt_self_component_port_status bt_self_component_port_remove_from_component( - struct bt_self_component_port *self_port) +bt_bool bt_port_is_connected(const struct bt_port *port) { - struct bt_port *port = (void *) self_port; - struct bt_component *comp = NULL; + BT_ASSERT_PRE_NON_NULL(port, "Port"); + return port->connection ? BT_TRUE : BT_FALSE; +} +void *bt_self_component_port_get_data(const struct bt_self_component_port *port) +{ BT_ASSERT_PRE_NON_NULL(port, "Port"); + return ((struct bt_port *) port)->user_data; +} - comp = (void *) bt_object_borrow_parent(&port->base); - if (!comp) { - BT_LIB_LOGV("Port already removed from its component: %!+p", - port); - goto end; - } +void bt_port_get_ref(const struct bt_port *port) +{ + bt_object_get_ref(port); +} - /* bt_component_remove_port() logs details */ - bt_component_remove_port(comp, port); +void bt_port_put_ref(const struct bt_port *port) +{ + bt_object_put_ref(port); +} -end: - return BT_SELF_PORT_STATUS_OK; +void bt_port_input_get_ref(const struct bt_port_input *port_input) +{ + bt_object_get_ref(port_input); } -bt_bool bt_port_is_connected(const struct bt_port *port) +void bt_port_input_put_ref(const struct bt_port_input *port_input) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); - return port->connection ? BT_TRUE : BT_FALSE; + bt_object_put_ref(port_input); } -void *bt_self_component_port_get_data(const struct bt_self_component_port *port) +void bt_port_output_get_ref(const struct bt_port_output *port_output) { - BT_ASSERT_PRE_NON_NULL(port, "Port"); - return ((struct bt_port *) port)->user_data; + bt_object_get_ref(port_output); +} + +void bt_port_output_put_ref(const struct bt_port_output *port_output) +{ + bt_object_put_ref(port_output); }