src.ctf.fs: add stream port name to trace-info query, use it for stream intersection
[babeltrace.git] / plugins / ctf / fs-src / query.c
index b56997c655bfa558c066061f3f8626902b62ef10..d666e1c4f6f9baab495027975ac29dacfc5a6a08 100644 (file)
@@ -211,14 +211,14 @@ int add_range(bt_value *info, struct range *range,
                goto end;
        }
 
-       status = bt_value_map_insert_integer_entry(range_map, "begin",
+       status = bt_value_map_insert_signed_integer_entry(range_map, "begin",
                        range->begin_ns);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
                goto end;
        }
 
-       status = bt_value_map_insert_integer_entry(range_map, "end",
+       status = bt_value_map_insert_signed_integer_entry(range_map, "end",
                        range->end_ns);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
@@ -244,16 +244,16 @@ int add_stream_ids(bt_value *info, struct ctf_fs_ds_file_group *ds_file_group)
        bt_value_status status;
 
        if (ds_file_group->stream_id != UINT64_C(-1)) {
-               status = bt_value_map_insert_integer_entry(info, "id",
-                       (int64_t) ds_file_group->stream_id);
+               status = bt_value_map_insert_unsigned_integer_entry(info, "id",
+                       ds_file_group->stream_id);
                if (status != BT_VALUE_STATUS_OK) {
                        ret = -1;
                        goto end;
                }
        }
 
-       status = bt_value_map_insert_integer_entry(info, "class-id",
-               (int64_t) ds_file_group->sc->id);
+       status = bt_value_map_insert_unsigned_integer_entry(info, "class-id",
+               ds_file_group->sc->id);
        if (status != BT_VALUE_STATUS_OK) {
                ret = -1;
                goto end;
@@ -273,6 +273,7 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
        bt_value *file_paths;
        struct ctf_fs_ds_file_info *first_file_info, *last_file_info;
        struct ctf_fs_ds_index_entry *first_ds_index_entry, *last_ds_index_entry;
+       gchar *port_name = NULL;
 
        file_paths = bt_value_array_create();
        if (!file_paths) {
@@ -285,13 +286,6 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
                        g_ptr_array_index(group->ds_file_infos,
                                file_idx);
 
-               if (!info->index || info->index->entries->len == 0) {
-                       BT_LOGW("Cannot determine range of unindexed stream file \'%s\'",
-                               info->path->str);
-                       ret = -1;
-                       goto end;
-               }
-
                status = bt_value_array_append_string_element(file_paths,
                                info->path->str);
                if (status != BT_VALUE_STATUS_OK) {
@@ -314,11 +308,15 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
        last_file_info = g_ptr_array_index(group->ds_file_infos,
                group->ds_file_infos->len - 1);
 
+       BT_ASSERT(first_file_info->index);
+       BT_ASSERT(first_file_info->index->entries);
        BT_ASSERT(first_file_info->index->entries->len > 0);
 
        first_ds_index_entry = (struct ctf_fs_ds_index_entry *) &g_array_index(
                first_file_info->index->entries, struct ctf_fs_ds_index_entry, 0);
 
+       BT_ASSERT(last_file_info->index);
+       BT_ASSERT(last_file_info->index->entries);
        BT_ASSERT(last_file_info->index->entries->len > 0);
 
        last_ds_index_entry = (struct ctf_fs_ds_index_entry *) &g_array_index(
@@ -347,6 +345,20 @@ int populate_stream_info(struct ctf_fs_ds_file_group *group,
        if (ret) {
                goto end;
        }
+
+       port_name = ctf_fs_make_port_name(group);
+       if (!port_name) {
+               ret = -1;
+               goto end;
+       }
+
+       status = bt_value_map_insert_string_entry(group_info, "port-name",
+               port_name);
+       if (status != BT_VALUE_STATUS_OK) {
+               ret = -1;
+               goto end;
+       }
+
 end:
        bt_value_put_ref(file_paths);
        return ret;
@@ -484,13 +496,13 @@ bt_query_status trace_info_query(
                goto error;
        }
 
-       paths_value = bt_value_map_borrow_entry_value_const(params, "paths");
-       if (!validate_paths_parameter(paths_value)) {
+       ctf_fs = ctf_fs_component_create();
+       if (!ctf_fs) {
                goto error;
        }
 
-       ctf_fs = ctf_fs_component_create();
-       if (!ctf_fs) {
+       if (!read_src_fs_parameters(params, &paths_value, ctf_fs)) {
+               status = BT_QUERY_STATUS_INVALID_PARAMS;
                goto error;
        }
 
This page took 0.04588 seconds and 4 git commands to generate.