X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=plugins%2Fctf%2Fcommon%2Fmetadata%2Fctf-meta-translate.c;h=93d61d2ed23c2c10841bb5a6c49b4cf9fbefaba2;hp=3603d177d4ab8b677ce9953946fef2f07769e82d;hb=40f4ba76dd6f9508ca51b6220eaed57632281a07;hpb=05e2128659970c32648a01255ed870449f05d518 diff --git a/plugins/ctf/common/metadata/ctf-meta-translate.c b/plugins/ctf/common/metadata/ctf-meta-translate.c index 3603d177..93d61d2e 100644 --- a/plugins/ctf/common/metadata/ctf-meta-translate.c +++ b/plugins/ctf/common/metadata/ctf-meta-translate.c @@ -26,31 +26,31 @@ #include "ctf-meta-visitors.h" static inline -struct bt_private_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, +struct bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec); static inline void ctf_field_class_int_set_props(struct ctf_field_class_int *fc, - struct bt_private_field_class *ir_fc) + struct bt_field_class *ir_fc) { - bt_private_field_class_integer_set_field_value_range(ir_fc, + bt_field_class_integer_set_field_value_range(ir_fc, fc->base.size); - bt_private_field_class_integer_set_preferred_display_base(ir_fc, + bt_field_class_integer_set_preferred_display_base(ir_fc, fc->disp_base); } static inline -struct bt_private_field_class *ctf_field_class_int_to_ir( +struct bt_field_class *ctf_field_class_int_to_ir( struct ctf_field_class_int *fc) { - struct bt_private_field_class *ir_fc; + struct bt_field_class *ir_fc; if (fc->is_signed) { - ir_fc = bt_private_field_class_signed_integer_create(); + ir_fc = bt_field_class_signed_integer_create(); } else { - ir_fc = bt_private_field_class_unsigned_integer_create(); + ir_fc = bt_field_class_unsigned_integer_create(); } BT_ASSERT(ir_fc); @@ -59,17 +59,17 @@ struct bt_private_field_class *ctf_field_class_int_to_ir( } static inline -struct bt_private_field_class *ctf_field_class_enum_to_ir( +struct bt_field_class *ctf_field_class_enum_to_ir( struct ctf_field_class_enum *fc) { int ret; - struct bt_private_field_class *ir_fc; + struct bt_field_class *ir_fc; uint64_t i; if (fc->base.is_signed) { - ir_fc = bt_private_field_class_signed_enumeration_create(); + ir_fc = bt_field_class_signed_enumeration_create(); } else { - ir_fc = bt_private_field_class_unsigned_enumeration_create(); + ir_fc = bt_field_class_unsigned_enumeration_create(); } BT_ASSERT(ir_fc); @@ -80,11 +80,11 @@ struct bt_private_field_class *ctf_field_class_enum_to_ir( ctf_field_class_enum_borrow_mapping_by_index(fc, i); if (fc->base.is_signed) { - ret = bt_private_field_class_signed_enumeration_map_range( + ret = bt_field_class_signed_enumeration_map_range( ir_fc, mapping->label->str, mapping->range.lower.i, mapping->range.upper.i); } else { - ret = bt_private_field_class_unsigned_enumeration_map_range( + ret = bt_field_class_unsigned_enumeration_map_range( ir_fc, mapping->label->str, mapping->range.lower.u, mapping->range.upper.u); } @@ -96,16 +96,16 @@ struct bt_private_field_class *ctf_field_class_enum_to_ir( } static inline -struct bt_private_field_class *ctf_field_class_float_to_ir( +struct bt_field_class *ctf_field_class_float_to_ir( struct ctf_field_class_float *fc) { - struct bt_private_field_class *ir_fc; + struct bt_field_class *ir_fc; - ir_fc = bt_private_field_class_real_create(); + ir_fc = bt_field_class_real_create(); BT_ASSERT(ir_fc); if (fc->base.size == 32) { - bt_private_field_class_real_set_is_single_precision(ir_fc, + bt_field_class_real_set_is_single_precision(ir_fc, BT_TRUE); } @@ -113,26 +113,26 @@ struct bt_private_field_class *ctf_field_class_float_to_ir( } static inline -struct bt_private_field_class *ctf_field_class_string_to_ir( +struct bt_field_class *ctf_field_class_string_to_ir( struct ctf_field_class_string *fc) { - struct bt_private_field_class *ir_fc = - bt_private_field_class_string_create(); + struct bt_field_class *ir_fc = + bt_field_class_string_create(); BT_ASSERT(ir_fc); return ir_fc; } static inline -struct bt_private_field_class *ctf_field_class_struct_to_ir( +struct bt_field_class *ctf_field_class_struct_to_ir( struct ctf_field_class_struct *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { int ret; - struct bt_private_field_class *ir_fc = - bt_private_field_class_structure_create(); + struct bt_field_class *ir_fc = + bt_field_class_structure_create(); uint64_t i; BT_ASSERT(ir_fc); @@ -140,7 +140,7 @@ struct bt_private_field_class *ctf_field_class_struct_to_ir( for (i = 0; i < fc->members->len; i++) { struct ctf_named_field_class *named_fc = ctf_field_class_struct_borrow_member_by_index(fc, i); - struct bt_private_field_class *member_ir_fc; + struct bt_field_class *member_ir_fc; if (!named_fc->fc->in_ir) { continue; @@ -148,7 +148,7 @@ struct bt_private_field_class *ctf_field_class_struct_to_ir( member_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec); BT_ASSERT(member_ir_fc); - ret = bt_private_field_class_structure_append_member( + ret = bt_field_class_structure_append_member( ir_fc, named_fc->name->str, member_ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(member_ir_fc); @@ -158,13 +158,13 @@ struct bt_private_field_class *ctf_field_class_struct_to_ir( } static inline -struct bt_private_field_class *borrow_ir_ft_from_field_path( +struct bt_field_class *borrow_ir_ft_from_field_path( struct ctf_field_path *field_path, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_private_field_class *ir_fc = NULL; + struct bt_field_class *ir_fc = NULL; struct ctf_field_class *fc = ctf_field_path_borrow_field_class( field_path, tc, sc, ec); @@ -178,31 +178,31 @@ struct bt_private_field_class *borrow_ir_ft_from_field_path( } static inline -struct bt_private_field_class *ctf_field_class_variant_to_ir( +struct bt_field_class *ctf_field_class_variant_to_ir( struct ctf_field_class_variant *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { int ret; - struct bt_private_field_class *ir_fc = - bt_private_field_class_variant_create(); + struct bt_field_class *ir_fc = + bt_field_class_variant_create(); uint64_t i; BT_ASSERT(ir_fc); - ret = bt_private_field_class_variant_set_selector_field_class( + ret = bt_field_class_variant_set_selector_field_class( ir_fc, borrow_ir_ft_from_field_path(&fc->tag_path, tc, sc, ec)); BT_ASSERT(ret == 0); for (i = 0; i < fc->options->len; i++) { struct ctf_named_field_class *named_fc = ctf_field_class_variant_borrow_option_by_index(fc, i); - struct bt_private_field_class *option_ir_fc; + struct bt_field_class *option_ir_fc; BT_ASSERT(named_fc->fc->in_ir); option_ir_fc = ctf_field_class_to_ir(named_fc->fc, tc, sc, ec); BT_ASSERT(option_ir_fc); - ret = bt_private_field_class_variant_append_private_option( + ret = bt_field_class_variant_append_option( ir_fc, named_fc->name->str, option_ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(option_ir_fc); @@ -212,24 +212,24 @@ struct bt_private_field_class *ctf_field_class_variant_to_ir( } static inline -struct bt_private_field_class *ctf_field_class_array_to_ir( +struct bt_field_class *ctf_field_class_array_to_ir( struct ctf_field_class_array *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_private_field_class *ir_fc; - struct bt_private_field_class *elem_ir_fc; + struct bt_field_class *ir_fc; + struct bt_field_class *elem_ir_fc; if (fc->base.is_text) { - ir_fc = bt_private_field_class_string_create(); + ir_fc = bt_field_class_string_create(); BT_ASSERT(ir_fc); goto end; } elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec); BT_ASSERT(elem_ir_fc); - ir_fc = bt_private_field_class_static_array_create(elem_ir_fc, + ir_fc = bt_field_class_static_array_create(elem_ir_fc, fc->length); BT_ASSERT(ir_fc); bt_object_put_ref(elem_ir_fc); @@ -239,29 +239,29 @@ end: } static inline -struct bt_private_field_class *ctf_field_class_sequence_to_ir( +struct bt_field_class *ctf_field_class_sequence_to_ir( struct ctf_field_class_sequence *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { int ret; - struct bt_private_field_class *ir_fc; - struct bt_private_field_class *elem_ir_fc; + struct bt_field_class *ir_fc; + struct bt_field_class *elem_ir_fc; if (fc->base.is_text) { - ir_fc = bt_private_field_class_string_create(); + ir_fc = bt_field_class_string_create(); BT_ASSERT(ir_fc); goto end; } elem_ir_fc = ctf_field_class_to_ir(fc->base.elem_fc, tc, sc, ec); BT_ASSERT(elem_ir_fc); - ir_fc = bt_private_field_class_dynamic_array_create(elem_ir_fc); + ir_fc = bt_field_class_dynamic_array_create(elem_ir_fc); BT_ASSERT(ir_fc); bt_object_put_ref(elem_ir_fc); BT_ASSERT(ir_fc); - ret = bt_private_field_class_dynamic_array_set_length_field_class( + ret = bt_field_class_dynamic_array_set_length_field_class( ir_fc, borrow_ir_ft_from_field_path(&fc->length_path, tc, sc, ec)); BT_ASSERT(ret == 0); @@ -271,12 +271,12 @@ end: } static inline -struct bt_private_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, +struct bt_field_class *ctf_field_class_to_ir(struct ctf_field_class *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_private_field_class *ir_fc = NULL; + struct bt_field_class *ir_fc = NULL; BT_ASSERT(fc); BT_ASSERT(fc->in_ir); @@ -336,12 +336,12 @@ end: } static inline -struct bt_private_field_class *scope_ctf_field_class_to_ir(struct ctf_field_class *fc, +struct bt_field_class *scope_ctf_field_class_to_ir(struct ctf_field_class *fc, struct ctf_trace_class *tc, struct ctf_stream_class *sc, struct ctf_event_class *ec) { - struct bt_private_field_class *ir_fc = NULL; + struct bt_field_class *ir_fc = NULL; if (!fc) { goto end; @@ -391,30 +391,30 @@ end: } static inline -struct bt_private_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, - struct bt_private_stream_class *ir_sc, struct ctf_trace_class *tc, +struct bt_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, + struct bt_stream_class *ir_sc, struct ctf_trace_class *tc, struct ctf_stream_class *sc) { int ret; - struct bt_private_event_class *ir_ec = NULL; + struct bt_event_class *ir_ec = NULL; if (ec->is_translated) { - ir_ec = bt_private_stream_class_borrow_event_class_by_id( + ir_ec = bt_stream_class_borrow_event_class_by_id( ir_sc, ec->id); BT_ASSERT(ir_ec); goto end; } - ir_ec = bt_private_event_class_create_with_id(ir_sc, ec->id); + ir_ec = bt_event_class_create_with_id(ir_sc, ec->id); BT_ASSERT(ir_ec); bt_object_put_ref(ir_ec); if (ec->spec_context_fc) { - struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( ec->spec_context_fc, tc, sc, ec); if (ir_fc) { - ret = bt_private_event_class_set_specific_context_field_class( + ret = bt_event_class_set_specific_context_field_class( ir_ec, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -422,11 +422,11 @@ struct bt_private_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, } if (ec->payload_fc) { - struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( ec->payload_fc, tc, sc, ec); if (ir_fc) { - ret = bt_private_event_class_set_payload_field_class(ir_ec, + ret = bt_event_class_set_payload_field_class(ir_ec, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -434,17 +434,17 @@ struct bt_private_event_class *ctf_event_class_to_ir(struct ctf_event_class *ec, } if (ec->name->len > 0) { - ret = bt_private_event_class_set_name(ir_ec, ec->name->str); + ret = bt_event_class_set_name(ir_ec, ec->name->str); BT_ASSERT(ret == 0); } if (ec->emf_uri->len > 0) { - ret = bt_private_event_class_set_emf_uri(ir_ec, ec->emf_uri->str); + ret = bt_event_class_set_emf_uri(ir_ec, ec->emf_uri->str); BT_ASSERT(ret == 0); } if (ec->log_level != -1) { - bt_private_event_class_set_log_level(ir_ec, ec->log_level); + bt_event_class_set_log_level(ir_ec, ec->log_level); } ec->is_translated = true; @@ -456,30 +456,30 @@ end: static inline -struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, - struct bt_private_trace *ir_trace, struct ctf_trace_class *tc) +struct bt_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class *sc, + struct bt_trace *ir_trace, struct ctf_trace_class *tc) { int ret; - struct bt_private_stream_class *ir_sc = NULL; + struct bt_stream_class *ir_sc = NULL; struct ctf_field_class_int *int_fc; if (sc->is_translated) { - ir_sc = bt_private_trace_borrow_stream_class_by_id( + ir_sc = bt_trace_borrow_stream_class_by_id( ir_trace, sc->id); BT_ASSERT(ir_sc); goto end; } - ir_sc = bt_private_stream_class_create_with_id(ir_trace, sc->id); + ir_sc = bt_stream_class_create_with_id(ir_trace, sc->id); BT_ASSERT(ir_sc); bt_object_put_ref(ir_sc); if (sc->packet_context_fc) { - struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( sc->packet_context_fc, tc, sc, NULL); if (ir_fc) { - ret = bt_private_stream_class_set_packet_context_field_class( + ret = bt_stream_class_set_packet_context_field_class( ir_sc, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -487,11 +487,11 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * } if (sc->event_header_fc) { - struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( sc->event_header_fc, tc, sc, NULL); if (ir_fc) { - ret = bt_private_stream_class_set_event_header_field_class( + ret = bt_stream_class_set_event_header_field_class( ir_sc, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -499,24 +499,24 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * } if (sc->event_common_context_fc) { - struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( sc->event_common_context_fc, tc, sc, NULL); if (ir_fc) { - ret = bt_private_stream_class_set_event_common_context_field_class( + ret = bt_stream_class_set_event_common_context_field_class( ir_sc, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); } } - bt_private_stream_class_set_assigns_automatic_event_class_id(ir_sc, + bt_stream_class_set_assigns_automatic_event_class_id(ir_sc, BT_FALSE); - bt_private_stream_class_set_assigns_automatic_stream_id(ir_sc, BT_FALSE); + bt_stream_class_set_assigns_automatic_stream_id(ir_sc, BT_FALSE); if (sc->default_clock_class) { - ret = bt_private_stream_class_set_default_clock_class(ir_sc, - bt_private_clock_class_as_clock_class(sc->default_clock_class)); + ret = bt_stream_class_set_default_clock_class(ir_sc, + sc->default_clock_class); BT_ASSERT(ret == 0); } @@ -524,7 +524,7 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * "events_discarded"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_DISC_EV_REC_COUNTER_SNAPSHOT) { - bt_private_stream_class_set_packets_have_discarded_event_counter_snapshot( + bt_stream_class_set_packets_have_discarded_event_counter_snapshot( ir_sc, BT_TRUE); } } @@ -533,7 +533,7 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * "packet_seq_num"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_COUNTER_SNAPSHOT) { - bt_private_stream_class_set_packets_have_packet_counter_snapshot( + bt_stream_class_set_packets_have_packet_counter_snapshot( ir_sc, BT_TRUE); } } @@ -542,7 +542,7 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * "timestamp_begin"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_BEGINNING_TIME) { - bt_private_stream_class_set_packets_have_default_beginning_clock_value( + bt_stream_class_set_packets_have_default_beginning_clock_value( ir_sc, BT_TRUE); } } @@ -551,7 +551,7 @@ struct bt_private_stream_class *ctf_stream_class_to_ir(struct ctf_stream_class * "timestamp_end"); if (int_fc) { if (int_fc->meaning == CTF_FIELD_CLASS_MEANING_PACKET_END_TIME) { - bt_private_stream_class_set_packets_have_default_end_clock_value( + bt_stream_class_set_packets_have_default_end_clock_value( ir_sc, BT_TRUE); } } @@ -564,7 +564,7 @@ end: } static inline -int ctf_trace_class_to_ir(struct bt_private_trace *ir_trace, +int ctf_trace_class_to_ir(struct bt_trace *ir_trace, struct ctf_trace_class *tc) { int ret = 0; @@ -575,11 +575,11 @@ int ctf_trace_class_to_ir(struct bt_private_trace *ir_trace, } if (tc->packet_header_fc) { - struct bt_private_field_class *ir_fc = scope_ctf_field_class_to_ir( + struct bt_field_class *ir_fc = scope_ctf_field_class_to_ir( tc->packet_header_fc, tc, NULL, NULL); if (ir_fc) { - ret = bt_private_trace_set_packet_header_field_class( + ret = bt_trace_set_packet_header_field_class( ir_trace, ir_fc); BT_ASSERT(ret == 0); bt_object_put_ref(ir_fc); @@ -587,14 +587,14 @@ int ctf_trace_class_to_ir(struct bt_private_trace *ir_trace, } if (tc->name->len > 0) { - ret = bt_private_trace_set_name(ir_trace, tc->name->str); + ret = bt_trace_set_name(ir_trace, tc->name->str); if (ret) { goto end; } } if (tc->is_uuid_set) { - bt_private_trace_set_uuid(ir_trace, tc->uuid); + bt_trace_set_uuid(ir_trace, tc->uuid); } for (i = 0; i < tc->env_entries->len; i++) { @@ -603,12 +603,12 @@ int ctf_trace_class_to_ir(struct bt_private_trace *ir_trace, switch (env_entry->type) { case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_INT: - ret = bt_private_trace_set_environment_entry_integer( + ret = bt_trace_set_environment_entry_integer( ir_trace, env_entry->name->str, env_entry->value.i); break; case CTF_TRACE_CLASS_ENV_ENTRY_TYPE_STR: - ret = bt_private_trace_set_environment_entry_string( + ret = bt_trace_set_environment_entry_string( ir_trace, env_entry->name->str, env_entry->value.str->str); break; @@ -621,7 +621,7 @@ int ctf_trace_class_to_ir(struct bt_private_trace *ir_trace, } } - bt_private_trace_set_assigns_automatic_stream_class_id(ir_trace, + bt_trace_set_assigns_automatic_stream_class_id(ir_trace, BT_FALSE); tc->is_translated = true; tc->ir_tc = ir_trace; @@ -631,7 +631,7 @@ end: } BT_HIDDEN -int ctf_trace_class_translate(struct bt_private_trace *ir_trace, +int ctf_trace_class_translate(struct bt_trace *ir_trace, struct ctf_trace_class *tc) { int ret = 0; @@ -645,7 +645,7 @@ int ctf_trace_class_translate(struct bt_private_trace *ir_trace, for (i = 0; i < tc->stream_classes->len; i++) { uint64_t j; struct ctf_stream_class *sc = tc->stream_classes->pdata[i]; - struct bt_private_stream_class *ir_sc; + struct bt_stream_class *ir_sc; ir_sc = ctf_stream_class_to_ir(sc, ir_trace, tc); if (!ir_sc) { @@ -655,7 +655,7 @@ int ctf_trace_class_translate(struct bt_private_trace *ir_trace, for (j = 0; j < sc->event_classes->len; j++) { struct ctf_event_class *ec = sc->event_classes->pdata[j]; - struct bt_private_event_class *ir_ec; + struct bt_event_class *ir_ec; ir_ec = ctf_event_class_to_ir(ec, ir_sc, tc, sc); if (!ir_ec) {