From 43e34335c78d923564d369e9af46b634ce9ad55f Mon Sep 17 00:00:00 2001 From: Mathieu Desnoyers Date: Thu, 1 Mar 2012 18:36:07 -0500 Subject: [PATCH 1/1] Babeltrace wrapper update Signed-off-by: Mathieu Desnoyers --- converter/babeltrace-log.c | 13 ++++++------- formats/bt-dummy/bt-dummy.c | 1 - formats/ctf-text/ctf-text.c | 1 - formats/ctf/ctf.c | 15 +++++++-------- formats/ctf/metadata/ctf-parser-test.c | 2 +- 5 files changed, 14 insertions(+), 18 deletions(-) diff --git a/converter/babeltrace-log.c b/converter/babeltrace-log.c index ac66a8b0..d3470774 100644 --- a/converter/babeltrace-log.c +++ b/converter/babeltrace-log.c @@ -31,13 +31,12 @@ #include #include #include -#include #include -#include #include #include #include +#include #define USEC_PER_SEC 1000000UL @@ -46,7 +45,7 @@ int babeltrace_debug, babeltrace_verbose; static char *s_outputname; static int s_timestamp; static int s_help; -static uuid_t s_uuid; +static unsigned char s_uuid[BABELTRACE_UUID_LEN]; /* Metadata format string */ static const char metadata_fmt[] = @@ -104,7 +103,7 @@ void print_metadata(FILE *fp) } static -void write_packet_header(struct ctf_stream_pos *pos, uuid_t uuid) +void write_packet_header(struct ctf_stream_pos *pos, unsigned char *uuid) { struct ctf_stream_pos dummy; @@ -125,8 +124,8 @@ void write_packet_header(struct ctf_stream_pos *pos, uuid_t uuid) assert(!ctf_pos_packet(&dummy)); ctf_align_pos(pos, sizeof(uint8_t) * CHAR_BIT); - memcpy(ctf_get_pos_addr(pos), uuid, 16); - ctf_move_pos(pos, 16 * CHAR_BIT); + memcpy(ctf_get_pos_addr(pos), uuid, BABELTRACE_UUID_LEN); + ctf_move_pos(pos, BABELTRACE_UUID_LEN * CHAR_BIT); } static @@ -337,7 +336,7 @@ int main(int argc, char **argv) goto error_closemetadatafd; } - uuid_generate(s_uuid); + babeltrace_uuid_generate(s_uuid); print_metadata(metadata_fp); trace_text(stdin, fd); diff --git a/formats/bt-dummy/bt-dummy.c b/formats/bt-dummy/bt-dummy.c index e0a10c90..5f7a1a5a 100644 --- a/formats/bt-dummy/bt-dummy.c +++ b/formats/bt-dummy/bt-dummy.c @@ -20,7 +20,6 @@ #include #include #include -#include #include #include #include diff --git a/formats/ctf-text/ctf-text.c b/formats/ctf-text/ctf-text.c index bf028615..273c9b72 100644 --- a/formats/ctf-text/ctf-text.c +++ b/formats/ctf-text/ctf-text.c @@ -24,7 +24,6 @@ #include #include #include -#include #include #include #include diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 7c3df128..4f14d7a0 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -23,12 +23,12 @@ #include #include #include +#include +#include #include #include -#include #include #include -#include #include #include #include @@ -48,7 +48,6 @@ */ #define MAX_PACKET_HEADER_LEN (getpagesize() * CHAR_BIT) #define WRITE_PACKET_LEN (getpagesize() * 8 * CHAR_BIT) -#define UUID_LEN 16 /* uuid by value len */ #ifndef min #define min(a, b) (((a) < (b)) ? (a) : (b)) @@ -689,7 +688,7 @@ int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in, memcpy(td->uuid, header.uuid, sizeof(header.uuid)); CTF_TRACE_SET_FIELD(td, uuid); } else { - if (uuid_compare(header.uuid, td->uuid)) + if (babeltrace_uuid_compare(header.uuid, td->uuid)) return -EINVAL; } @@ -1077,20 +1076,20 @@ int create_stream_packet_index(struct ctf_trace *td, struct definition_array *defarray; struct definition *field; uint64_t i; - uint8_t uuidval[UUID_LEN]; + uint8_t uuidval[BABELTRACE_UUID_LEN]; field = struct_definition_get_field_from_index(file_stream->parent.trace_packet_header, len_index); assert(field->declaration->id == CTF_TYPE_ARRAY); defarray = container_of(field, struct definition_array, p); - assert(array_len(defarray) == UUID_LEN); + assert(array_len(defarray) == BABELTRACE_UUID_LEN); - for (i = 0; i < UUID_LEN; i++) { + for (i = 0; i < BABELTRACE_UUID_LEN; i++) { struct definition *elem; elem = array_index(defarray, i); uuidval[i] = get_unsigned_int(elem); } - ret = uuid_compare(td->uuid, uuidval); + ret = babeltrace_uuid_compare(td->uuid, uuidval); if (ret) { fprintf(stderr, "[error] Unique Universal Identifiers do not match.\n"); return -EINVAL; diff --git a/formats/ctf/metadata/ctf-parser-test.c b/formats/ctf/metadata/ctf-parser-test.c index 7cddbf84..72c45885 100644 --- a/formats/ctf/metadata/ctf-parser-test.c +++ b/formats/ctf/metadata/ctf-parser-test.c @@ -20,7 +20,7 @@ #include #include #include -#include +#include #include #include #include "ctf-scanner.h" -- 2.34.1