[lttng-dev] [PATCH] Teach babeltrace understand "native" and "network" for byte_order

Yao Qi yao at codesourcery.com
Fri Mar 15 05:52:17 EDT 2013


Hi,
We wrote byte_order in metadata either "le" or "be", according to the
host endianness.  Today, when I check the ctf specification, I find
"native" fits our needs well.  However, after I replace "le" with
"native" in metadata, I got the following error message:

  [error] get_trace_byte_order: unexpected string "native". Should be "native", "network", "be" or "le".

This patch teaches babeltrace understand "native" and "network".  With
this patch applied, the output looks right now.  Let me know if I need
run testsuite, and how.

Signed-off-by: Yao Qi <yao at codesourcery.com>
---
 .../ctf/metadata/ctf-visitor-generate-io-struct.c  |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)

diff --git a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
index 9bcc170..cea2877 100644
--- a/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
+++ b/formats/ctf/metadata/ctf-visitor-generate-io-struct.c
@@ -1227,6 +1227,10 @@ int get_trace_byte_order(FILE *fd, int depth, struct ctf_node *unary_expression)
 		byte_order = BIG_ENDIAN;
 	else if (!strcmp(unary_expression->u.unary_expression.u.string, "le"))
 		byte_order = LITTLE_ENDIAN;
+	else if (!strcmp(unary_expression->u.unary_expression.u.string, "native"))
+		byte_order = BYTE_ORDER;
+	else if (!strcmp(unary_expression->u.unary_expression.u.string, "network"))
+		byte_order = BIG_ENDIAN;
 	else {
 		fprintf(fd, "[error] %s: unexpected string \"%s\". Should be \"be\" or \"le\".\n",
 			__func__, unary_expression->u.unary_expression.u.string);
-- 
1.7.7.6




More information about the lttng-dev mailing list