}
}
- return 0;
+ return ret;
}
static
if (ret < 0) {
BT_LOGE("Cannot write whole metadata text to output stream: "
"ret=%d", ret);
+ goto end;
}
+ ret = 0;
+
goto end;
failed:
}
}
- return 0;
+ return ret;
}
struct port_id {
}
downstream_port_count = port_count_fn(downstream_comp);
- BT_ASSERT(downstream_port_count >= 0);
for (i = 0; i < downstream_port_count; i++) {
const bt_port_input *in_downstream_port =
}
static
-void graph_output_port_added_listener(struct cmd_run_ctx *ctx,
+bt_graph_listener_status
+graph_output_port_added_listener(struct cmd_run_ctx *ctx,
const bt_port_output *out_port)
{
const bt_component *comp;
const bt_port *port = bt_port_output_as_port_const(out_port);
+ bt_graph_listener_status ret = BT_GRAPH_LISTENER_STATUS_OK;
comp = bt_port_borrow_component_const(port);
BT_LOGI("Port added to a graph's component: comp-addr=%p, "
if (cmd_run_ctx_connect_upstream_port(ctx, out_port)) {
BT_LOGF_STR("Cannot connect upstream port.");
fprintf(stderr, "Added port could not be connected: aborting\n");
- abort();
+ ret = BT_GRAPH_LISTENER_STATUS_ERROR;
+ goto end;
}
end:
- return;
+ return ret;
}
static
-void graph_source_output_port_added_listener(
+bt_graph_listener_status graph_source_output_port_added_listener(
const bt_component_source *component,
const bt_port_output *port, void *data)
{
- graph_output_port_added_listener(data, port);
+ return graph_output_port_added_listener(data, port);
}
static
-void graph_filter_output_port_added_listener(
+bt_graph_listener_status graph_filter_output_port_added_listener(
const bt_component_filter *component,
const bt_port_output *port, void *data)
{
- graph_output_port_added_listener(data, port);
+ return graph_output_port_added_listener(data, port);
}
static
const bt_value *intersection_range = NULL;
const bt_value *intersection_begin = NULL;
const bt_value *intersection_end = NULL;
- const bt_value *stream_path_value = NULL;
- const bt_value *stream_paths = NULL;
const bt_value *stream_infos = NULL;
const bt_value *stream_info = NULL;
struct port_id *port_id = NULL;
goto error;
}
- /*
- * FIXME
- *
- * The first path of a stream's "paths" is currently used to
- * associate streams/ports to a given trace intersection.
- *
- * This is a fragile hack as it relies on the port names
- * being set to the various streams path.
- *
- * A stream name should be introduced as part of the trace-info
- * query result.
- */
for (stream_idx = 0; stream_idx < stream_count; stream_idx++) {
- const char *stream_path;
+ const bt_value *port_name;
port_id = g_new0(struct port_id, 1);
if (!port_id) {
goto error;
}
- stream_paths = bt_value_map_borrow_entry_value_const(stream_info,
- "paths");
- if (!stream_paths || !bt_value_is_array(stream_paths)) {
- ret = -1;
- BT_LOGD_STR("Cannot retrieve stream paths from trace in query result.");
- goto error;
- }
-
- stream_path_value =
- bt_value_array_borrow_element_by_index_const(
- stream_paths, 0);
- if (!stream_path_value ||
- !bt_value_is_string(stream_path_value)) {
+ port_name = bt_value_map_borrow_entry_value_const(stream_info, "port-name");
+ if (!port_name || !bt_value_is_string(port_name)) {
ret = -1;
- BT_LOGD_STR("Cannot retrieve stream path value from trace in query result.");
+ BT_LOGD_STR("Cannot retrieve port name in query result.");
goto error;
}
- stream_path = bt_value_string_get(stream_path_value);
- port_id->port_name = strdup(stream_path);
+ port_id->port_name = g_strdup(bt_value_string_get(port_name));
if (!port_id->port_name) {
ret = -1;
BT_LOGE_STR("Cannot allocate memory for port_id port_name.");
uint64_t i;
count = port_count_fn(comp);
- BT_ASSERT(count >= 0);
for (i = 0; i < count; i++) {
const bt_port_output *upstream_port = port_by_index_fn(comp, i);
return "BT_GRAPH_STATUS_CANCELED";
case BT_GRAPH_STATUS_ERROR:
return "BT_GRAPH_STATUS_ERROR";
- case BT_GRAPH_STATUS_NO_SINK:
- return "BT_GRAPH_STATUS_NO_SINK";
case BT_GRAPH_STATUS_NOMEM:
return "BT_GRAPH_STATUS_NOMEM";
default: