From: Philippe Proulx Date: Tue, 2 May 2017 16:33:19 +0000 (-0400) Subject: Rename bt_ctf_trace_get_byte_order() -> bt_ctf_trace_get_native_byte_order() X-Git-Tag: v2.0.0-pre1~330 X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=commitdiff_plain;h=8a716c8d896187b1fa202e925955302b5569b2f5 Rename bt_ctf_trace_get_byte_order() -> bt_ctf_trace_get_native_byte_order() Also fix associated API doc. Signed-off-by: Philippe Proulx Signed-off-by: Jérémie Galarneau --- diff --git a/include/babeltrace/ctf-ir/trace.h b/include/babeltrace/ctf-ir/trace.h index df5d34b7..33a86f0b 100644 --- a/include/babeltrace/ctf-ir/trace.h +++ b/include/babeltrace/ctf-ir/trace.h @@ -62,7 +62,7 @@ You can obtain a trace class in two different modes: A trace class has the following properties: - A \b name. -- A default byte order: all the +- A native byte order: all the \link ctfirfieldtypes field types\endlink eventually part of the trace class with a byte order set to #BT_CTF_BYTE_ORDER_NATIVE have this "real" byte order. @@ -175,9 +175,9 @@ The created trace class has the following initial properties: - Name: none. You can set a name with bt_ctf_trace_set_name(). - Default byte order: #BT_CTF_BYTE_ORDER_NATIVE. You - can set a default byte order with bt_ctf_trace_set_native_byte_order(). + can set a native byte order with bt_ctf_trace_set_native_byte_order(). - Note that you \em must set the default byte order if any field type + Note that you \em must set the native byte order if any field type contained in the created trace class, in its stream classes, or in its event classes, has a byte order set to #BT_CTF_BYTE_ORDER_NATIVE. - Environment: empty. You can add environment entries @@ -236,25 +236,25 @@ extern int bt_ctf_trace_set_name(struct bt_ctf_trace *trace_class, const char *name); /** -@brief Returns the default byte order of the CTF IR trace class +@brief Returns the native byte order of the CTF IR trace class \p trace_class. @param[in] trace_class Trace class of which to get the default byte order. -@returns Default byte order of trace class - \p trace_class, or #BT_CTF_BYTE_ORDER_UNKNOWN - on error. +@returns Default byte order of \p trace_class, + or #BT_CTF_BYTE_ORDER_UNKNOWN on error. @prenotnull{trace_class} @postrefcountsame{trace_class} -@sa bt_ctf_trace_set_name(): Sets the name of a given trace class. +@sa bt_ctf_trace_set_native_byte_order(): Sets the native byte order of + a given trace class. */ -extern enum bt_ctf_byte_order bt_ctf_trace_get_byte_order( +extern enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( struct bt_ctf_trace *trace_class); /** -@brief Sets the default byte order of the CTF IR trace class +@brief Sets the native byte order of the CTF IR trace class \p trace_class to \p native_byte_order. \p native_byte_order \em must be one of: @@ -263,20 +263,20 @@ extern enum bt_ctf_byte_order bt_ctf_trace_get_byte_order( - #BT_CTF_BYTE_ORDER_BIG_ENDIAN - #BT_CTF_BYTE_ORDER_NETWORK -@param[in] trace_class Trace class of which to set the default byte +@param[in] trace_class Trace class of which to set the native byte order. @param[in] native_byte_order Default byte order of the trace class. @returns 0 on success, or a negative value on error. @prenotnull{trace_class} -@prenotnull{name} @prehot{trace_class} @pre \p native_byte_order is either #BT_CTF_BYTE_ORDER_LITTLE_ENDIAN, #BT_CTF_BYTE_ORDER_BIG_ENDIAN, or #BT_CTF_BYTE_ORDER_NETWORK. @postrefcountsame{trace_class} -@sa bt_ctf_trace_get_name(): Returns the name of a given trace class. +@sa bt_ctf_trace_get_native_byte_order(): Returns the native byte order of a + given trace class. */ extern int bt_ctf_trace_set_native_byte_order(struct bt_ctf_trace *trace_class, enum bt_ctf_byte_order native_byte_order); diff --git a/lib/ctf-ir/stream.c b/lib/ctf-ir/stream.c index 98fa25ad..84d7c684 100644 --- a/lib/ctf-ir/stream.c +++ b/lib/ctf-ir/stream.c @@ -949,7 +949,7 @@ int bt_ctf_stream_flush(struct bt_ctf_stream *stream) trace = bt_ctf_stream_class_borrow_trace(stream->stream_class); assert(trace); - native_byte_order = bt_ctf_trace_get_byte_order(trace); + native_byte_order = bt_ctf_trace_get_native_byte_order(trace); empty_packet = (stream->events->len == 0); /* mmap the next packet */ diff --git a/lib/ctf-ir/trace.c b/lib/ctf-ir/trace.c index 8737bfd3..a4bc9906 100644 --- a/lib/ctf-ir/trace.c +++ b/lib/ctf-ir/trace.c @@ -1069,7 +1069,8 @@ end: return metadata; } -enum bt_ctf_byte_order bt_ctf_trace_get_byte_order(struct bt_ctf_trace *trace) +enum bt_ctf_byte_order bt_ctf_trace_get_native_byte_order( + struct bt_ctf_trace *trace) { enum bt_ctf_byte_order ret = BT_CTF_BYTE_ORDER_UNKNOWN; diff --git a/plugins/ctf/common/metadata/visitor-generate-ir.c b/plugins/ctf/common/metadata/visitor-generate-ir.c index 1572206c..c4e3cc9f 100644 --- a/plugins/ctf/common/metadata/visitor-generate-ir.c +++ b/plugins/ctf/common/metadata/visitor-generate-ir.c @@ -1044,7 +1044,7 @@ enum bt_ctf_byte_order get_real_byte_order(struct ctx *ctx, enum bt_ctf_byte_order bo = byte_order_from_unary_expr(ctx->efd, uexpr); if (bo == BT_CTF_BYTE_ORDER_NATIVE) { - bo = bt_ctf_trace_get_byte_order(ctx->trace); + bo = bt_ctf_trace_get_native_byte_order(ctx->trace); } return bo; @@ -2267,7 +2267,7 @@ int visit_integer_decl(struct ctx *ctx, enum bt_ctf_string_encoding encoding = BT_CTF_STRING_ENCODING_NONE; enum bt_ctf_integer_base base = BT_CTF_INTEGER_BASE_DECIMAL; enum bt_ctf_byte_order byte_order = - bt_ctf_trace_get_byte_order(ctx->trace); + bt_ctf_trace_get_native_byte_order(ctx->trace); *integer_decl = NULL; @@ -2613,7 +2613,7 @@ int visit_floating_point_number_decl(struct ctx *ctx, struct ctf_node *expression; uint64_t alignment = 1, exp_dig = 0, mant_dig = 0; enum bt_ctf_byte_order byte_order = - bt_ctf_trace_get_byte_order(ctx->trace); + bt_ctf_trace_get_native_byte_order(ctx->trace); *float_decl = NULL; diff --git a/tests/lib/test_ctf_writer.c b/tests/lib/test_ctf_writer.c index f6224f5c..0d2b5839 100644 --- a/tests/lib/test_ctf_writer.c +++ b/tests/lib/test_ctf_writer.c @@ -2903,8 +2903,8 @@ int main(int argc, char **argv) "bt_ctf_writer_get_trace returns a bt_ctf_trace object"); ok(bt_ctf_trace_set_native_byte_order(trace, BT_CTF_BYTE_ORDER_BIG_ENDIAN) == 0, "Set a trace's byte order to big endian"); - ok(bt_ctf_trace_get_byte_order(trace) == BT_CTF_BYTE_ORDER_BIG_ENDIAN, - "bt_ctf_trace_get_byte_order returns a correct endianness"); + ok(bt_ctf_trace_get_native_byte_order(trace) == BT_CTF_BYTE_ORDER_BIG_ENDIAN, + "bt_ctf_trace_get_native_byte_order returns a correct endianness"); /* Add environment context to the trace */ ret = gethostname(hostname, sizeof(hostname));