X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Flibctfcopytrace%2Fctfcopytrace.c;h=0689ee380c8651261c65fdffd17da10d64ff5594;hb=ab80adac56044ab951e76eb818c4ca1140d2a0a2;hp=39c394bdc761b2398f920367cee927f36b19d420;hpb=f6f999a3509cbcdd6840b674a40c29d7095d3b1e;p=babeltrace.git diff --git a/plugins/libctfcopytrace/ctfcopytrace.c b/plugins/libctfcopytrace/ctfcopytrace.c index 39c394bd..0689ee38 100644 --- a/plugins/libctfcopytrace/ctfcopytrace.c +++ b/plugins/libctfcopytrace/ctfcopytrace.c @@ -39,6 +39,7 @@ #include "ctfcopytrace.h" #include "clock-fields.h" +BT_HIDDEN struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err, struct bt_ctf_clock_class *clock_class) { @@ -134,7 +135,7 @@ struct bt_ctf_clock_class *ctf_copy_clock_class(FILE *err, goto end_destroy; } - int_ret = bt_ctf_clock_class_get_is_absolute(clock_class); + int_ret = bt_ctf_clock_class_is_absolute(clock_class); if (int_ret == -1) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); @@ -156,6 +157,7 @@ end: return writer_clock_class; } +BT_HIDDEN enum bt_component_status ctf_copy_clock_classes(FILE *err, struct bt_ctf_trace *writer_trace, struct bt_ctf_stream_class *writer_stream_class, @@ -169,7 +171,7 @@ enum bt_component_status ctf_copy_clock_classes(FILE *err, for (i = 0; i < clock_class_count; i++) { struct bt_ctf_clock_class *writer_clock_class; struct bt_ctf_clock_class *clock_class = - bt_ctf_trace_get_clock_class(trace, i); + bt_ctf_trace_get_clock_class_by_index(trace, i); if (!clock_class) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, @@ -207,6 +209,7 @@ end: return ret; } +BT_HIDDEN struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, struct bt_ctf_event_class *event_class) { @@ -234,13 +237,15 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, struct bt_value *attr_value; int ret; - attr_name = bt_ctf_event_class_get_attribute_name(event_class, i); + attr_name = bt_ctf_event_class_get_attribute_name_by_index( + event_class, i); if (!attr_name) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; } - attr_value = bt_ctf_event_class_get_attribute_value(event_class, i); + attr_value = bt_ctf_event_class_get_attribute_value_by_index( + event_class, i); if (!attr_value) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); @@ -257,14 +262,14 @@ struct bt_ctf_event_class *ctf_copy_event_class(FILE *err, } } - count = bt_ctf_event_class_get_field_count(event_class); + count = bt_ctf_event_class_get_payload_type_field_count(event_class); for (i = 0; i < count; i++) { const char *field_name; struct bt_ctf_field_type *field_type; int ret; - ret = bt_ctf_event_class_get_field(event_class, &field_name, - &field_type, i); + ret = bt_ctf_event_class_get_payload_type_field_by_index( + event_class, &field_name, &field_type, i); if (ret < 0) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; @@ -288,6 +293,7 @@ end: return writer_event_class; } +BT_HIDDEN enum bt_component_status ctf_copy_event_classes(FILE *err, struct bt_ctf_stream_class *stream_class, struct bt_ctf_stream_class *writer_stream_class) @@ -307,7 +313,7 @@ enum bt_component_status ctf_copy_event_classes(FILE *err, struct bt_ctf_field_type *context; int int_ret; - event_class = bt_ctf_stream_class_get_event_class( + event_class = bt_ctf_stream_class_get_event_class_by_index( stream_class, i); if (!event_class) { fprintf(err, "[error] %s in %s:%d\n", __func__, @@ -360,6 +366,7 @@ end: return ret; } +BT_HIDDEN struct bt_ctf_stream_class *ctf_copy_stream_class(FILE *err, struct bt_ctf_stream_class *stream_class, struct bt_ctf_trace *writer_trace, @@ -454,6 +461,7 @@ end: return writer_stream_class; } +BT_HIDDEN enum bt_component_status ctf_copy_packet_context_field(FILE *err, struct bt_ctf_field *field, const char *field_name, struct bt_ctf_field *writer_packet_context, @@ -475,15 +483,15 @@ enum bt_component_status ctf_copy_packet_context_field(FILE *err, /* * Only support for integers for now. */ - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] Unsupported packet context field type\n"); ret = BT_COMPONENT_STATUS_ERROR; goto error; } BT_PUT(field_type); - writer_field = bt_ctf_field_structure_get_field(writer_packet_context, - field_name); + writer_field = bt_ctf_field_structure_get_field_by_name( + writer_packet_context, field_name); if (!writer_field) { ret = BT_COMPONENT_STATUS_ERROR; fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, @@ -519,9 +527,11 @@ end: return ret; } +BT_HIDDEN struct bt_ctf_field *ctf_copy_packet_context(FILE *err, struct bt_ctf_packet *packet, - struct bt_ctf_stream *writer_stream) + struct bt_ctf_stream *writer_stream, + int skip_content_size) { enum bt_component_status ret; struct bt_ctf_field *packet_context = NULL, *writer_packet_context = NULL; @@ -533,9 +543,7 @@ struct bt_ctf_field *ctf_copy_packet_context(FILE *err, packet_context = bt_ctf_packet_get_context(packet); if (!packet_context) { - fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, - __LINE__); - goto error; + goto end; } writer_stream_class = bt_ctf_stream_get_class(writer_stream); @@ -579,21 +587,21 @@ struct bt_ctf_field *ctf_copy_packet_context(FILE *err, __FILE__, __LINE__); goto error; } - if (bt_ctf_field_type_structure_get_field(struct_type, + if (bt_ctf_field_type_structure_get_field_by_index(struct_type, &field_name, &field_type, i) < 0) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); goto error; } - if (!strncmp(field_name, "content_size", strlen("content_size")) || - !strncmp(field_name, "packet_size", - strlen("packet_size"))) { + if (skip_content_size && + (!strncmp(field_name, "content_size", strlen("content_size")) || + !strncmp(field_name, "packet_size", strlen("packet_size")))) { BT_PUT(field_type); BT_PUT(field); continue; } - if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_TYPE_ID_INTEGER) { + if (bt_ctf_field_type_get_type_id(field_type) != BT_CTF_FIELD_TYPE_ID_INTEGER) { fprintf(err, "[error] Unexpected packet context field type\n"); goto error; } @@ -623,6 +631,7 @@ end: return writer_packet_context; } +BT_HIDDEN int ctf_copy_event_header(FILE *err, struct bt_ctf_event *event, struct bt_ctf_event_class *writer_event_class, struct bt_ctf_event *writer_event, @@ -706,6 +715,7 @@ end: return ret; } +BT_HIDDEN struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, struct bt_ctf_event_class *writer_event_class, bool override_ts64) @@ -788,7 +798,7 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, BT_PUT(field); BT_PUT(copy_field); - field = bt_ctf_event_get_payload_field(event); + field = bt_ctf_event_get_event_payload(event); if (!field) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); @@ -796,7 +806,7 @@ struct bt_ctf_event *ctf_copy_event(FILE *err, struct bt_ctf_event *event, } copy_field = bt_ctf_field_copy(field); if (copy_field) { - ret = bt_ctf_event_set_payload_field(writer_event, copy_field); + ret = bt_ctf_event_set_event_payload(writer_event, copy_field); if (ret < 0) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); @@ -816,6 +826,7 @@ end: return writer_event; } +BT_HIDDEN enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, struct bt_ctf_trace *writer_trace) { @@ -829,14 +840,16 @@ enum bt_component_status ctf_copy_trace(FILE *err, struct bt_ctf_trace *trace, const char *name; struct bt_value *value = NULL; - name = bt_ctf_trace_get_environment_field_name(trace, i); + name = bt_ctf_trace_get_environment_field_name_by_index( + trace, i); if (!name) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__); ret = BT_COMPONENT_STATUS_ERROR; goto end; } - value = bt_ctf_trace_get_environment_field_value(trace, i); + value = bt_ctf_trace_get_environment_field_value_by_index( + trace, i); if (!value) { fprintf(err, "[error] %s in %s:%d\n", __func__, __FILE__, __LINE__);