return "BT_COMPONENT_STATUS_NOMEM";
case BT_COMPONENT_STATUS_NOT_FOUND:
return "BT_COMPONENT_STATUS_NOT_FOUND";
+ case BT_COMPONENT_STATUS_GRAPH_IS_CANCELED:
+ return "BT_COMPONENT_STATUS_GRAPH_IS_CANCELED";
default:
return "(unknown)";
}
BT_COMPONENT_STATUS_NOMEM = -12,
/** Element not found. */
BT_COMPONENT_STATUS_NOT_FOUND = -19,
+ BT_COMPONENT_STATUS_GRAPH_IS_CANCELED = 125,
};
#ifdef __cplusplus
#include <babeltrace/graph/component-class-internal.h>
#include <babeltrace/graph/notification.h>
#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/graph.h>
BT_HIDDEN
void bt_component_filter_destroy(struct bt_component *component)
struct bt_port *port = NULL;
struct bt_component *component =
bt_component_from_private(private_component);
+ struct bt_graph *graph;
if (!component) {
BT_LOGW_STR("Invalid parameter: component is NULL.");
goto end;
}
+ graph = bt_component_borrow_graph(component);
+
+ if (graph && bt_graph_is_canceled(graph)) {
+ BT_LOGW("Cannot add output port to filter component: graph is canceled: "
+ "comp-addr=%p, comp-name=\"%s\", graph-addr=%p",
+ component, bt_component_get_name(component),
+ bt_component_borrow_graph(component));
+ status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED;
+ goto end;
+ }
+
/* bt_component_add_input_port() logs details/errors */
port = bt_component_add_input_port(component, name, user_data);
if (!port) {
struct bt_port *port = NULL;
struct bt_component *component =
bt_component_from_private(private_component);
+ struct bt_graph *graph;
if (!component) {
BT_LOGW_STR("Invalid parameter: component is NULL.");
goto end;
}
+ graph = bt_component_borrow_graph(component);
+
+ if (graph && bt_graph_is_canceled(graph)) {
+ BT_LOGW("Cannot add output port to filter component: graph is canceled: "
+ "comp-addr=%p, comp-name=\"%s\", graph-addr=%p",
+ component, bt_component_get_name(component),
+ bt_component_borrow_graph(component));
+ status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED;
+ goto end;
+ }
+
/* bt_component_add_output_port() logs details/errors */
port = bt_component_add_output_port(component, name, user_data);
if (!port) {
#include <babeltrace/graph/component-sink-internal.h>
#include <babeltrace/graph/component-internal.h>
#include <babeltrace/graph/notification.h>
+#include <babeltrace/graph/graph.h>
BT_HIDDEN
void bt_component_sink_destroy(struct bt_component *component)
struct bt_port *port = NULL;
struct bt_component *component =
bt_component_from_private(private_component);
+ struct bt_graph *graph;
if (!component) {
BT_LOGW_STR("Invalid parameter: component is NULL.");
goto end;
}
+ graph = bt_component_borrow_graph(component);
+
+ if (graph && bt_graph_is_canceled(graph)) {
+ BT_LOGW("Cannot add output port to filter component: graph is canceled: "
+ "comp-addr=%p, comp-name=\"%s\", graph-addr=%p",
+ component, bt_component_get_name(component),
+ bt_component_borrow_graph(component));
+ status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED;
+ goto end;
+ }
+
/* bt_component_add_input_port() logs details/errors */
port = bt_component_add_input_port(component, name, user_data);
if (!port) {
#include <babeltrace/graph/port-internal.h>
#include <babeltrace/graph/notification-iterator.h>
#include <babeltrace/graph/notification-iterator-internal.h>
+#include <babeltrace/graph/graph.h>
BT_HIDDEN
void bt_component_source_destroy(struct bt_component *component)
struct bt_port *port = NULL;
struct bt_component *component =
bt_component_from_private(private_component);
+ struct bt_graph *graph;
if (!component) {
BT_LOGW_STR("Invalid parameter: component is NULL.");
goto end;
}
+ graph = bt_component_borrow_graph(component);
+
+ if (graph && bt_graph_is_canceled(graph)) {
+ BT_LOGW("Cannot add output port to filter component: graph is canceled: "
+ "comp-addr=%p, comp-name=\"%s\", graph-addr=%p",
+ component, bt_component_get_name(component),
+ bt_component_borrow_graph(component));
+ status = BT_COMPONENT_STATUS_GRAPH_IS_CANCELED;
+ goto end;
+ }
+
/* bt_component_add_output_port() logs details and errors */
port = bt_component_add_output_port(component, name, user_data);
if (!port) {