4 * Babeltrace library to create a copy of a CTF trace
6 * Copyright 2017 Julien Desfossez <jdesfossez@efficios.com>
8 * Author: Julien Desfossez <jdesfossez@efficios.com>
10 * Permission is hereby granted, free of charge, to any person obtaining a copy
11 * of this software and associated documentation files (the "Software"), to deal
12 * in the Software without restriction, including without limitation the rights
13 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
14 * copies of the Software, and to permit persons to whom the Software is
15 * furnished to do so, subject to the following conditions:
17 * The above copyright notice and this permission notice shall be included in
18 * all copies or substantial portions of the Software.
20 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
21 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
22 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
23 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
24 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
25 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29 #define BT_LOG_TAG "PLUGIN-CTFCOPYTRACE-LIB"
32 #include <babeltrace/babeltrace.h>
33 #include <babeltrace/assert-internal.h>
35 #include "ctfcopytrace.h"
36 #include "clock-fields.h"
39 struct bt_clock_class
*ctf_copy_clock_class(FILE *err
,
40 struct bt_clock_class
*clock_class
)
42 int64_t offset
, offset_s
;
45 const char *name
, *description
;
46 struct bt_clock_class
*writer_clock_class
= NULL
;
48 BT_ASSERT(err
&& clock_class
);
50 name
= bt_clock_class_get_name(clock_class
);
53 writer_clock_class
= bt_clock_class_create(name
,
54 bt_clock_class_get_frequency(clock_class
));
55 if (!writer_clock_class
) {
56 BT_LOGE_STR("Failed to create clock class.");
60 description
= bt_clock_class_get_description(clock_class
);
62 int_ret
= bt_clock_class_set_description(writer_clock_class
,
67 u64_ret
= bt_clock_class_get_precision(clock_class
);
68 BT_ASSERT(u64_ret
!= -1ULL);
70 int_ret
= bt_clock_class_set_precision(writer_clock_class
,
74 int_ret
= bt_clock_class_get_offset_s(clock_class
, &offset_s
);
77 int_ret
= bt_clock_class_set_offset_s(writer_clock_class
, offset_s
);
80 int_ret
= bt_clock_class_get_offset_cycles(clock_class
, &offset
);
83 int_ret
= bt_clock_class_set_offset_cycles(writer_clock_class
, offset
);
86 int_ret
= bt_clock_class_is_absolute(clock_class
);
87 BT_ASSERT(int_ret
>= 0);
89 int_ret
= bt_clock_class_set_is_absolute(writer_clock_class
, int_ret
);
93 return writer_clock_class
;
97 enum bt_component_status
ctf_copy_clock_classes(FILE *err
,
98 struct bt_trace
*writer_trace
,
99 struct bt_stream_class
*writer_stream_class
,
100 struct bt_trace
*trace
)
102 enum bt_component_status ret
;
103 int int_ret
, clock_class_count
, i
;
105 clock_class_count
= bt_trace_get_clock_class_count(trace
);
107 for (i
= 0; i
< clock_class_count
; i
++) {
108 struct bt_clock_class
*writer_clock_class
;
109 struct bt_clock_class
*clock_class
=
110 bt_trace_get_clock_class_by_index(trace
, i
);
112 BT_ASSERT(clock_class
);
114 writer_clock_class
= ctf_copy_clock_class(err
, clock_class
);
115 bt_object_put_ref(clock_class
);
116 if (!writer_clock_class
) {
117 BT_LOGE_STR("Failed to copy clock class.");
118 ret
= BT_COMPONENT_STATUS_ERROR
;
122 int_ret
= bt_trace_add_clock_class(writer_trace
, writer_clock_class
);
124 BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class
);
125 BT_LOGE_STR("Failed to add clock class.");
126 ret
= BT_COMPONENT_STATUS_ERROR
;
131 * Ownership transferred to the trace.
133 bt_object_put_ref(writer_clock_class
);
136 ret
= BT_COMPONENT_STATUS_OK
;
143 void replace_clock_classes(struct bt_trace
*trace_copy
,
144 struct bt_field_type
*field_type
)
148 BT_ASSERT(trace_copy
);
149 BT_ASSERT(field_type
);
151 switch (bt_field_type_get_type_id(field_type
)) {
152 case BT_FIELD_TYPE_ID_INTEGER
:
154 struct bt_clock_class
*mapped_clock_class
=
155 bt_field_type_integer_get_mapped_clock_class(field_type
);
156 struct bt_clock_class
*clock_class_copy
= NULL
;
159 if (!mapped_clock_class
) {
163 name
= bt_clock_class_get_name(mapped_clock_class
);
165 clock_class_copy
= bt_trace_get_clock_class_by_name(
167 BT_ASSERT(clock_class_copy
);
168 ret
= bt_field_type_integer_set_mapped_clock_class(
169 field_type
, clock_class_copy
);
171 bt_object_put_ref(mapped_clock_class
);
172 bt_object_put_ref(clock_class_copy
);
175 case BT_FIELD_TYPE_ID_ENUM
:
176 case BT_FIELD_TYPE_ID_ARRAY
:
177 case BT_FIELD_TYPE_ID_SEQUENCE
:
179 struct bt_field_type
*subtype
= NULL
;
181 switch (bt_field_type_get_type_id(field_type
)) {
182 case BT_FIELD_TYPE_ID_ENUM
:
183 subtype
= bt_field_type_enumeration_get_container_type(
186 case BT_FIELD_TYPE_ID_ARRAY
:
187 subtype
= bt_field_type_array_get_element_type(
190 case BT_FIELD_TYPE_ID_SEQUENCE
:
191 subtype
= bt_field_type_sequence_get_element_type(
195 BT_LOGF("Unexpected field type ID: id=%d",
196 bt_field_type_get_type_id(field_type
));
201 replace_clock_classes(trace_copy
, subtype
);
202 bt_object_put_ref(subtype
);
205 case BT_FIELD_TYPE_ID_STRUCT
:
208 int64_t count
= bt_field_type_structure_get_field_count(
211 for (i
= 0; i
< count
; i
++) {
213 struct bt_field_type
*member_type
;
215 ret
= bt_field_type_structure_get_field_by_index(
216 field_type
, &name
, &member_type
, i
);
218 replace_clock_classes(trace_copy
, member_type
);
219 bt_object_put_ref(member_type
);
224 case BT_FIELD_TYPE_ID_VARIANT
:
227 int64_t count
= bt_field_type_variant_get_field_count(
230 for (i
= 0; i
< count
; i
++) {
232 struct bt_field_type
*member_type
;
234 ret
= bt_field_type_variant_get_field_by_index(
235 field_type
, &name
, &member_type
, i
);
237 replace_clock_classes(trace_copy
, member_type
);
238 bt_object_put_ref(member_type
);
249 struct bt_event_class
*ctf_copy_event_class(FILE *err
,
250 struct bt_trace
*trace_copy
,
251 struct bt_event_class
*event_class
)
253 struct bt_event_class
*writer_event_class
= NULL
;
254 struct bt_field_type
*context
= NULL
, *payload_type
= NULL
;
258 enum bt_event_class_log_level log_level
;
261 name
= bt_event_class_get_name(event_class
);
263 writer_event_class
= bt_private_event_class_create(name
);
264 BT_ASSERT(writer_event_class
);
266 id
= bt_event_class_get_id(event_class
);
269 ret
= bt_event_class_set_id(writer_event_class
, id
);
271 BT_LOGE_STR("Failed to set event_class id.");
275 log_level
= bt_event_class_get_log_level(event_class
);
277 BT_LOGE_STR("Failed to get log_level.");
281 ret
= bt_private_event_class_set_log_level(writer_event_class
, log_level
);
283 BT_LOGE_STR("Failed to set log_level.");
287 emf_uri
= bt_event_class_get_emf_uri(event_class
);
289 ret
= bt_private_event_class_set_emf_uri(writer_event_class
,
292 BT_LOGE_STR("Failed to set emf uri.");
297 payload_type
= bt_event_class_get_payload_type(event_class
);
299 struct bt_field_type
*ft_copy
=
300 bt_field_type_copy(payload_type
);
303 BT_LOGE_STR("Cannot copy payload field type.");
306 replace_clock_classes(trace_copy
, ft_copy
);
307 ret
= bt_event_class_set_payload_type(writer_event_class
,
309 bt_object_put_ref(ft_copy
);
311 BT_LOGE_STR("Failed to set payload type.");
316 context
= bt_event_class_get_context_type(event_class
);
318 struct bt_field_type
*ft_copy
=
319 bt_field_type_copy(context
);
322 BT_LOGE_STR("Cannot copy context field type.");
325 ret
= bt_event_class_set_context_type(
326 writer_event_class
, ft_copy
);
327 bt_object_put_ref(ft_copy
);
329 BT_LOGE_STR("Failed to set context type.");
337 BT_OBJECT_PUT_REF_AND_RESET(writer_event_class
);
339 BT_OBJECT_PUT_REF_AND_RESET(context
);
340 BT_OBJECT_PUT_REF_AND_RESET(payload_type
);
341 return writer_event_class
;
345 enum bt_component_status
ctf_copy_event_classes(FILE *err
,
346 struct bt_stream_class
*stream_class
,
347 struct bt_stream_class
*writer_stream_class
)
349 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
350 struct bt_event_class
*event_class
= NULL
, *writer_event_class
= NULL
;
352 struct bt_trace
*writer_trace
=
353 bt_stream_class_get_trace(writer_stream_class
);
355 BT_ASSERT(writer_trace
);
356 count
= bt_stream_class_get_event_class_count(stream_class
);
357 BT_ASSERT(count
>= 0);
359 for (i
= 0; i
< count
; i
++) {
362 event_class
= bt_stream_class_get_event_class_by_index(
364 BT_ASSERT(event_class
);
366 if (i
< bt_stream_class_get_event_class_count(writer_stream_class
)) {
367 writer_event_class
= bt_stream_class_get_event_class_by_index(
368 writer_stream_class
, i
);
369 if (writer_event_class
) {
371 * If the writer_event_class already exists,
372 * just skip it. It can be used to resync the
373 * event_classes after a trace has become
376 BT_OBJECT_PUT_REF_AND_RESET(writer_event_class
);
377 BT_OBJECT_PUT_REF_AND_RESET(event_class
);
382 writer_event_class
= ctf_copy_event_class(err
, writer_trace
,
384 if (!writer_event_class
) {
385 BT_LOGE_STR("Failed to copy event_class.");
386 ret
= BT_COMPONENT_STATUS_ERROR
;
390 int_ret
= bt_stream_class_add_event_class(writer_stream_class
,
393 BT_LOGE_STR("Failed to add event class.");
394 ret
= BT_COMPONENT_STATUS_ERROR
;
397 BT_OBJECT_PUT_REF_AND_RESET(writer_event_class
);
398 BT_OBJECT_PUT_REF_AND_RESET(event_class
);
404 bt_object_put_ref(event_class
);
405 bt_object_put_ref(writer_event_class
);
407 bt_object_put_ref(writer_trace
);
412 struct bt_stream_class
*ctf_copy_stream_class(FILE *err
,
413 struct bt_stream_class
*stream_class
,
414 struct bt_trace
*writer_trace
,
417 struct bt_field_type
*type
= NULL
;
418 struct bt_field_type
*type_copy
= NULL
;
419 struct bt_stream_class
*writer_stream_class
= NULL
;
421 const char *name
= bt_stream_class_get_name(stream_class
);
423 writer_stream_class
= bt_stream_class_create_empty(name
);
424 BT_ASSERT(writer_stream_class
);
426 type
= bt_stream_class_get_packet_context_type(stream_class
);
428 type_copy
= bt_field_type_copy(type
);
430 BT_LOGE_STR("Cannot copy packet context field type.");
433 replace_clock_classes(writer_trace
, type_copy
);
434 ret_int
= bt_stream_class_set_packet_context_type(
435 writer_stream_class
, type_copy
);
436 BT_OBJECT_PUT_REF_AND_RESET(type_copy
);
438 BT_LOGE_STR("Failed to set packet_context type.");
441 BT_OBJECT_PUT_REF_AND_RESET(type
);
444 type
= bt_stream_class_get_event_header_type(stream_class
);
446 type_copy
= bt_field_type_copy(type
);
448 BT_LOGE_STR("Cannot copy event header field type.");
451 ret_int
= bt_trace_get_clock_class_count(writer_trace
);
452 BT_ASSERT(ret_int
>= 0);
453 if (override_ts64
&& ret_int
> 0) {
454 struct bt_field_type
*new_event_header_type
;
456 new_event_header_type
= override_header_type(err
, type_copy
,
458 if (!new_event_header_type
) {
459 BT_LOGE_STR("Failed to override header type.");
462 replace_clock_classes(writer_trace
, type_copy
);
463 ret_int
= bt_stream_class_set_event_header_type(
464 writer_stream_class
, new_event_header_type
);
465 BT_OBJECT_PUT_REF_AND_RESET(type_copy
);
466 BT_OBJECT_PUT_REF_AND_RESET(new_event_header_type
);
468 BT_LOGE_STR("Failed to set event_header type.");
472 replace_clock_classes(writer_trace
, type_copy
);
473 ret_int
= bt_stream_class_set_event_header_type(
474 writer_stream_class
, type_copy
);
475 BT_OBJECT_PUT_REF_AND_RESET(type_copy
);
477 BT_LOGE_STR("Failed to set event_header type.");
481 BT_OBJECT_PUT_REF_AND_RESET(type
);
484 type
= bt_stream_class_get_event_context_type(stream_class
);
486 type_copy
= bt_field_type_copy(type
);
488 BT_LOGE_STR("Cannot copy event context field type.");
491 replace_clock_classes(writer_trace
, type_copy
);
492 ret_int
= bt_stream_class_set_event_context_type(
493 writer_stream_class
, type_copy
);
494 BT_OBJECT_PUT_REF_AND_RESET(type_copy
);
496 BT_LOGE_STR("Failed to set event_contexttype.");
500 BT_OBJECT_PUT_REF_AND_RESET(type
);
505 BT_OBJECT_PUT_REF_AND_RESET(writer_stream_class
);
507 bt_object_put_ref(type
);
508 bt_object_put_ref(type_copy
);
509 return writer_stream_class
;
513 int ctf_stream_copy_packet_header(FILE *err
, struct bt_packet
*packet
,
514 struct bt_stream
*writer_stream
)
516 struct bt_field
*packet_header
= NULL
, *writer_packet_header
= NULL
;
519 packet_header
= bt_packet_get_header(packet
);
520 if (!packet_header
) {
524 writer_packet_header
= bt_field_copy(packet_header
);
525 if (!writer_packet_header
) {
526 BT_LOGE_STR("Failed to copy field from stream packet header.");
530 ret
= bt_stream_set_packet_header(writer_stream
,
531 writer_packet_header
);
533 BT_LOGE_STR("Failed to set stream packet header.");
542 bt_object_put_ref(writer_packet_header
);
543 bt_object_put_ref(packet_header
);
548 int ctf_packet_copy_header(FILE *err
, struct bt_packet
*packet
,
549 struct bt_packet
*writer_packet
)
551 struct bt_field
*packet_header
= NULL
, *writer_packet_header
= NULL
;
554 packet_header
= bt_packet_get_header(packet
);
555 if (!packet_header
) {
559 writer_packet_header
= bt_field_copy(packet_header
);
560 if (!writer_packet_header
) {
561 BT_LOGE_STR("Failed to copy field from packet header.");
565 ret
= bt_packet_set_header(writer_packet
, writer_packet_header
);
567 BT_LOGE_STR("Failed to set packet header.");
576 bt_object_put_ref(packet_header
);
577 bt_object_put_ref(writer_packet_header
);
582 int ctf_stream_copy_packet_context(FILE *err
, struct bt_packet
*packet
,
583 struct bt_stream
*writer_stream
)
585 struct bt_field
*packet_context
= NULL
, *writer_packet_context
= NULL
;
588 packet_context
= bt_packet_get_context(packet
);
589 if (!packet_context
) {
593 writer_packet_context
= bt_field_copy(packet_context
);
594 if (!writer_packet_context
) {
595 BT_LOGE_STR("Failed to copy field from stream packet context.");
599 ret
= bt_stream_set_packet_context(writer_stream
,
600 writer_packet_context
);
602 BT_LOGE_STR("Failed to set stream packet context.");
611 bt_object_put_ref(packet_context
);
612 bt_object_put_ref(writer_packet_context
);
617 int ctf_packet_copy_context(FILE *err
, struct bt_packet
*packet
,
618 struct bt_stream
*writer_stream
,
619 struct bt_packet
*writer_packet
)
621 struct bt_field
*packet_context
= NULL
, *writer_packet_context
= NULL
;
624 packet_context
= bt_packet_get_context(packet
);
625 if (!packet_context
) {
629 writer_packet_context
= bt_field_copy(packet_context
);
630 if (!writer_packet_context
) {
631 BT_LOGE_STR("Failed to copy field from packet context.");
635 ret
= bt_packet_set_context(writer_packet
, writer_packet_context
);
637 BT_LOGE_STR("Failed to set packet context.");
646 bt_object_put_ref(writer_packet_context
);
647 bt_object_put_ref(packet_context
);
652 int ctf_copy_event_header(FILE *err
, struct bt_event
*event
,
653 struct bt_event_class
*writer_event_class
,
654 struct bt_event
*writer_event
,
655 struct bt_field
*event_header
)
657 struct bt_clock_class
*clock_class
= NULL
, *writer_clock_class
= NULL
;
658 struct bt_clock_value
*clock_value
= NULL
, *writer_clock_value
= NULL
;
661 struct bt_field
*writer_event_header
= NULL
;
664 clock_class
= event_get_clock_class(err
, event
);
666 BT_LOGE_STR("Failed to get event clock_class.");
670 clock_value
= bt_event_get_clock_value(event
, clock_class
);
671 BT_OBJECT_PUT_REF_AND_RESET(clock_class
);
672 BT_ASSERT(clock_value
);
674 ret
= bt_clock_value_get_value(clock_value
, &value
);
675 BT_OBJECT_PUT_REF_AND_RESET(clock_value
);
677 BT_LOGE_STR("Failed to get clock value.");
681 writer_clock_class
= event_get_clock_class(err
, writer_event
);
682 if (!writer_clock_class
) {
683 BT_LOGE_STR("Failed to get event clock_class.");
687 writer_clock_value
= bt_clock_value_create(writer_clock_class
, value
);
688 BT_OBJECT_PUT_REF_AND_RESET(writer_clock_class
);
689 if (!writer_clock_value
) {
690 BT_LOGE_STR("Failed to create clock value.");
694 ret
= bt_event_set_clock_value(writer_event
, writer_clock_value
);
695 BT_OBJECT_PUT_REF_AND_RESET(writer_clock_value
);
697 BT_LOGE_STR("Failed to set clock value.");
701 writer_event_header
= bt_field_copy(event_header
);
702 if (!writer_event_header
) {
703 BT_LOGE_STR("Failed to copy event_header.");
707 ret
= bt_event_set_header(writer_event
, writer_event_header
);
708 BT_OBJECT_PUT_REF_AND_RESET(writer_event_header
);
710 BT_LOGE_STR("Failed to set event_header.");
725 struct bt_trace
*event_class_get_trace(FILE *err
,
726 struct bt_event_class
*event_class
)
728 struct bt_trace
*trace
= NULL
;
729 struct bt_stream_class
*stream_class
= NULL
;
731 stream_class
= bt_event_class_get_stream_class(event_class
);
732 BT_ASSERT(stream_class
);
734 trace
= bt_stream_class_get_trace(stream_class
);
737 bt_object_put_ref(stream_class
);
742 struct bt_event
*ctf_copy_event(FILE *err
, struct bt_event
*event
,
743 struct bt_event_class
*writer_event_class
,
746 struct bt_event
*writer_event
= NULL
;
747 struct bt_field
*field
= NULL
, *copy_field
= NULL
;
748 struct bt_trace
*writer_trace
= NULL
;
751 writer_event
= bt_event_create(writer_event_class
);
753 BT_LOGE_STR("Failed to create event.");
757 writer_trace
= event_class_get_trace(err
, writer_event_class
);
759 BT_LOGE_STR("Failed to get trace from event_class.");
763 field
= bt_event_get_header(event
);
766 * If override_ts64, we override all integer fields mapped to a
767 * clock to a uint64_t field type, otherwise, we just copy it as
770 ret
= bt_trace_get_clock_class_count(writer_trace
);
773 if (override_ts64
&& ret
> 0) {
774 copy_field
= bt_event_get_header(writer_event
);
775 BT_ASSERT(copy_field
);
777 ret
= copy_override_field(err
, event
, writer_event
, field
,
780 BT_LOGE_STR("Failed to copy and override field.");
783 BT_OBJECT_PUT_REF_AND_RESET(copy_field
);
785 ret
= ctf_copy_event_header(err
, event
, writer_event_class
,
786 writer_event
, field
);
788 BT_LOGE_STR("Failed to copy event_header.");
792 BT_OBJECT_PUT_REF_AND_RESET(field
);
795 /* Optional field, so it can fail silently. */
796 field
= bt_event_get_stream_event_context(event
);
798 copy_field
= bt_field_copy(field
);
800 BT_LOGE_STR("Failed to copy field.");
803 ret
= bt_event_set_stream_event_context(writer_event
,
806 BT_LOGE_STR("Failed to set stream_event_context.");
809 BT_OBJECT_PUT_REF_AND_RESET(field
);
810 BT_OBJECT_PUT_REF_AND_RESET(copy_field
);
813 /* Optional field, so it can fail silently. */
814 field
= bt_event_get_event_context(event
);
816 copy_field
= bt_field_copy(field
);
818 BT_LOGE_STR("Failed to copy field.");
821 ret
= bt_event_set_event_context(writer_event
, copy_field
);
823 BT_LOGE_STR("Failed to set event_context.");
826 BT_OBJECT_PUT_REF_AND_RESET(field
);
827 BT_OBJECT_PUT_REF_AND_RESET(copy_field
);
830 field
= bt_event_get_event_payload(event
);
832 copy_field
= bt_field_copy(field
);
834 BT_LOGE_STR("Failed to copy field.");
837 ret
= bt_event_set_event_payload(writer_event
, copy_field
);
839 BT_LOGE_STR("Failed to set event_payload.");
842 BT_OBJECT_PUT_REF_AND_RESET(field
);
843 BT_OBJECT_PUT_REF_AND_RESET(copy_field
);
849 BT_OBJECT_PUT_REF_AND_RESET(writer_event
);
851 bt_object_put_ref(field
);
852 bt_object_put_ref(copy_field
);
853 bt_object_put_ref(writer_trace
);
858 enum bt_component_status
ctf_copy_trace(FILE *err
, struct bt_trace
*trace
,
859 struct bt_trace
*writer_trace
)
861 enum bt_component_status ret
= BT_COMPONENT_STATUS_OK
;
862 int field_count
, i
, int_ret
;
863 struct bt_field_type
*header_type
= NULL
;
864 enum bt_byte_order order
;
865 const char *trace_name
;
866 const unsigned char *trace_uuid
;
868 field_count
= bt_trace_get_environment_field_count(trace
);
869 for (i
= 0; i
< field_count
; i
++) {
872 struct bt_value
*value
= NULL
;
874 name
= bt_trace_get_environment_field_name_by_index(
878 value
= bt_trace_get_environment_field_value_by_index(
882 ret_int
= bt_trace_set_environment_field(writer_trace
,
884 BT_OBJECT_PUT_REF_AND_RESET(value
);
886 BT_LOGE("Failed to set environment: field-name=\"%s\"",
888 ret
= BT_COMPONENT_STATUS_ERROR
;
893 order
= bt_trace_get_native_byte_order(trace
);
894 BT_ASSERT(order
!= BT_BYTE_ORDER_UNKNOWN
);
897 * Only explicitly set the writer trace's native byte order if
898 * the original trace has a specific one. Otherwise leave what
899 * the CTF writer object chooses, which is the machine's native
902 if (order
!= BT_BYTE_ORDER_UNSPECIFIED
) {
903 ret
= bt_trace_set_native_byte_order(writer_trace
, order
);
905 BT_LOGE_STR("Failed to set native byte order.");
906 ret
= BT_COMPONENT_STATUS_ERROR
;
911 header_type
= bt_trace_get_packet_header_type(trace
);
913 int_ret
= bt_trace_set_packet_header_type(writer_trace
, header_type
);
914 BT_OBJECT_PUT_REF_AND_RESET(header_type
);
916 BT_LOGE_STR("Failed to set packet header type.");
917 ret
= BT_COMPONENT_STATUS_ERROR
;
922 trace_name
= bt_trace_get_name(trace
);
924 int_ret
= bt_trace_set_name(writer_trace
, trace_name
);
926 BT_LOGE_STR("Failed to set trace name.");
927 ret
= BT_COMPONENT_STATUS_ERROR
;
932 trace_uuid
= bt_trace_get_uuid(trace
);
934 int_ret
= bt_trace_set_uuid(writer_trace
, trace_uuid
);
936 BT_LOGE_STR("Failed to set trace UUID.");
937 ret
= BT_COMPONENT_STATUS_ERROR
;