From: Mathieu Desnoyers Date: Fri, 23 Sep 2011 16:57:22 +0000 (-0400) Subject: Fix endianness and major/minor output X-Git-Url: https://git.lttng.org./?a=commitdiff_plain;h=8a98a75d15312b109a29c3dad982d534e2c116c9;p=ust.git Fix endianness and major/minor output Signed-off-by: Mathieu Desnoyers --- diff --git a/libust/ltt-events.c b/libust/ltt-events.c index 18fb859..c9a7773 100644 --- a/libust/ltt-events.c +++ b/libust/ltt-events.c @@ -10,6 +10,7 @@ #define _GNU_SOURCE #include +#include #include #include #include @@ -562,7 +563,7 @@ int _ltt_field_statedump(struct ltt_session *session, ? "UTF8" : "ASCII", field->type.u.basic.integer.base, -#ifdef __BIG_ENDIAN +#if (BYTE_ORDER == BIG_ENDIAN) field->type.u.basic.integer.reverse_byte_order ? " byte_order = le;" : "", #else field->type.u.basic.integer.reverse_byte_order ? " byte_order = be;" : "", @@ -571,11 +572,11 @@ int _ltt_field_statedump(struct ltt_session *session, break; case atype_float: ret = lttng_metadata_printf(session, - " floating_point { exp_dig = %u; mant_dig = %u; align = %u; } _%s;\n", + " floating_point { exp_dig = %u; mant_dig = %u; align = %u;%s } _%s;\n", field->type.u.basic._float.exp_dig, field->type.u.basic._float.mant_dig, field->type.u.basic._float.alignment, -#ifdef __BIG_ENDIAN +#if (BYTE_ORDER == BIG_ENDIAN) field->type.u.basic.integer.reverse_byte_order ? " byte_order = le;" : "", #else field->type.u.basic.integer.reverse_byte_order ? " byte_order = be;" : "", @@ -604,7 +605,7 @@ int _ltt_field_statedump(struct ltt_session *session, ? "UTF8" : "ASCII", elem_type->u.basic.integer.base, -#ifdef __BIG_ENDIAN +#if (BYTE_ORDER == BIG_ENDIAN) elem_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "", #else elem_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "", @@ -630,7 +631,7 @@ int _ltt_field_statedump(struct ltt_session *session, ? "UTF8" : "ASCII"), length_type->u.basic.integer.base, -#ifdef __BIG_ENDIAN +#if (BYTE_ORDER == BIG_ENDIAN) length_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "", #else length_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "", @@ -650,7 +651,7 @@ int _ltt_field_statedump(struct ltt_session *session, ? "UTF8" : "ASCII"), elem_type->u.basic.integer.base, -#ifdef __BIG_ENDIAN +#if (BYTE_ORDER == BIG_ENDIAN) elem_type->u.basic.integer.reverse_byte_order ? " byte_order = le;" : "", #else elem_type->u.basic.integer.reverse_byte_order ? " byte_order = be;" : "", @@ -941,7 +942,7 @@ int _ltt_session_metadata_statedump(struct ltt_session *session) CTF_VERSION_MAJOR, CTF_VERSION_MINOR, uuid_s, -#ifdef __BIG_ENDIAN +#if (BYTE_ORDER == BIG_ENDIAN) "be" #else "le" diff --git a/libust/ltt-ring-buffer-metadata-client.h b/libust/ltt-ring-buffer-metadata-client.h index 0102860..302e020 100644 --- a/libust/ltt-ring-buffer-metadata-client.h +++ b/libust/ltt-ring-buffer-metadata-client.h @@ -23,6 +23,8 @@ struct metadata_packet_header { uint8_t compression_scheme; /* 0 if unused */ uint8_t encryption_scheme; /* 0 if unused */ uint8_t checksum_scheme; /* 0 if unused */ + uint8_t major; /* CTF spec major version number */ + uint8_t minor; /* CTF spec minor version number */ uint8_t header_end[0]; }; @@ -96,6 +98,9 @@ static void client_buffer_begin(struct lib_ring_buffer *buf, u64 tsc, header->compression_scheme = 0; /* 0 if unused */ header->encryption_scheme = 0; /* 0 if unused */ header->checksum_scheme = 0; /* 0 if unused */ + header->major = CTF_SPEC_MAJOR; + header->minor = CTF_SPEC_MINOR; + } /* diff --git a/libust/ltt-tracer.h b/libust/ltt-tracer.h index f776839..45da9c5 100644 --- a/libust/ltt-tracer.h +++ b/libust/ltt-tracer.h @@ -37,6 +37,12 @@ /* Tracer properties */ #define CTF_MAGIC_NUMBER 0xC1FC1FC1 #define TSDL_MAGIC_NUMBER 0x75D11D57 + +/* CTF specification version followed */ +#define CTF_SPEC_MAJOR 1 +#define CTF_SPEC_MINOR 8 + +/* Tracer major/minor versions */ #define CTF_VERSION_MAJOR 0 #define CTF_VERSION_MINOR 1