- unsigned char *uuid = trace->uuid;
- int ret = 0;
-
- if (trace->native_byte_order == BT_CTF_BYTE_ORDER_NATIVE) {
- BT_LOGW("Invalid parameter: trace's byte order cannot be BT_CTF_BYTE_ORDER_NATIVE at this point; "
- "set it with bt_ctf_trace_set_native_byte_order(): "
- "addr=%p, name=\"%s\"",
- trace, bt_ctf_trace_get_name(trace));
- ret = -1;
- goto end;
- }
-
- g_string_append(context->string, "trace {\n");
- g_string_append(context->string, "\tmajor = 1;\n");
- g_string_append(context->string, "\tminor = 8;\n");
- assert(trace->native_byte_order == BT_CTF_BYTE_ORDER_LITTLE_ENDIAN ||
- trace->native_byte_order == BT_CTF_BYTE_ORDER_BIG_ENDIAN ||
- trace->native_byte_order == BT_CTF_BYTE_ORDER_NETWORK);
-
- if (trace->uuid_set) {
- g_string_append_printf(context->string,
- "\tuuid = \"%02x%02x%02x%02x-%02x%02x-%02x%02x-%02x%02x-%02x%02x%02x%02x%02x%02x\";\n",
- uuid[0], uuid[1], uuid[2], uuid[3],
- uuid[4], uuid[5], uuid[6], uuid[7],
- uuid[8], uuid[9], uuid[10], uuid[11],
- uuid[12], uuid[13], uuid[14], uuid[15]);
- }
-
- g_string_append_printf(context->string, "\tbyte_order = %s;\n",
- get_byte_order_string(trace->native_byte_order));
-
- if (trace->packet_header_type) {
- g_string_append(context->string, "\tpacket.header := ");
- context->current_indentation_level++;
- g_string_assign(context->field_name, "");
- BT_LOGD_STR("Serializing trace's packet header field type's metadata.");
- ret = bt_ctf_field_type_serialize(trace->packet_header_type,
- context);
- if (ret) {
- goto end;
- }
- context->current_indentation_level--;
- }
-
- g_string_append(context->string, ";\n};\n\n");
-end:
- return ret;