Fix endianness and major/minor output
authorMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 23 Sep 2011 16:57:22 +0000 (12:57 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 23 Sep 2011 16:57:22 +0000 (12:57 -0400)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
libust/ltt-events.c
libust/ltt-ring-buffer-metadata-client.h
libust/ltt-tracer.h

index 18fb8599ee09a5e87b5f529cbe4c4750d57185bf..c9a7773fa744959c0633750d56f7e06dbd5af5d3 100644 (file)
@@ -10,6 +10,7 @@
 
 #define _GNU_SOURCE
 #include <stdio.h>
+#include <endian.h>
 #include <urcu/list.h>
 #include <urcu/hlist.h>
 #include <pthread.h>
@@ -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"
index 0102860ed64b8d6af3a1b49f6251b2c21e353839..302e020ef579604380e3f004d22d40f76227b610 100644 (file)
@@ -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;
+
 }
 
 /*
index f77683937e28b088fcc941d14a33660fc50cda94..45da9c59ed2432134bb741fae15275c1eeacecd8 100644 (file)
 /* 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
 
This page took 0.02624 seconds and 4 git commands to generate.