API fix/breakage : reexporting bt_ctf_event
authorJulien Desfossez <julien.desfossez@efficios.com>
Mon, 2 Apr 2012 22:02:00 +0000 (18:02 -0400)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Mon, 2 Apr 2012 22:02:00 +0000 (18:02 -0400)
Replaces the ctf_event_definition to keep the bt_ namespace.

Signed-off-by: Julien Desfossez <julien.desfossez@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
converter/babeltrace.c
formats/ctf/callbacks.c
formats/ctf/events.c
formats/ctf/iterator.c
include/babeltrace/context.h
include/babeltrace/ctf/callbacks-internal.h
include/babeltrace/ctf/callbacks.h
include/babeltrace/ctf/events-internal.h
include/babeltrace/ctf/events.h
include/babeltrace/ctf/iterator.h
include/babeltrace/trace-handle.h

index fc590ecc50134b10a30ccde0d36c008d1b6aa2b3..a6c1f548677127f44691c2dd28e68982222a74a2 100644 (file)
@@ -407,7 +407,7 @@ int convert_trace(struct trace_descriptor *td_write,
        struct bt_ctf_iter *iter;
        struct ctf_text_stream_pos *sout;
        struct bt_iter_pos begin_pos;
-       struct ctf_event_definition *ctf_event;
+       struct bt_ctf_event *ctf_event;
        int ret;
 
        sout = container_of(td_write, struct ctf_text_stream_pos,
@@ -420,7 +420,7 @@ int convert_trace(struct trace_descriptor *td_write,
                goto error_iter;
        }
        while ((ctf_event = bt_ctf_iter_read_event(iter))) {
-               ret = sout->parent.event_cb(&sout->parent, ctf_event->stream);
+               ret = sout->parent.event_cb(&sout->parent, ctf_event->parent->stream);
                if (ret) {
                        fprintf(stderr, "[error] Writing event failed.\n");
                        goto end;
index 8e0d61e62e36d2c2de9ff451ace8ebcc91cf7551..05ddf499a76c915bf2332106d9edbe8d179e7405 100644 (file)
@@ -64,7 +64,7 @@ struct bt_dependencies *babeltrace_dependencies_create(const char *first, ...)
  */
 int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,
                bt_intern_str event, void *private_data, int flags,
-               enum bt_cb_ret (*callback)(struct ctf_event_definition *ctf_data,
+               enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
                                           void *private_data),
                struct bt_dependencies *depends,
                struct bt_dependencies *weak_depends,
@@ -146,29 +146,29 @@ int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,
 }
 
 static
-struct ctf_event_definition *extract_ctf_stream_event(struct ctf_stream_definition *stream)
+int extract_ctf_stream_event(struct ctf_stream_definition *stream,
+               struct bt_ctf_event *event)
 {
        struct ctf_stream_declaration *stream_class = stream->stream_class;
        struct ctf_event_declaration *event_class;
-       struct ctf_event_definition *event;
        uint64_t id = stream->event_id;
 
        if (id >= stream_class->events_by_id->len) {
                fprintf(stderr, "[error] Event id %" PRIu64 " is outside range.\n", id);
-               return NULL;
+               return -1;
        }
-       event = g_ptr_array_index(stream->events_by_id, id);
-       if (!event) {
+       event->parent = g_ptr_array_index(stream->events_by_id, id);
+       if (!event->parent) {
                fprintf(stderr, "[error] Event id %" PRIu64 " is unknown.\n", id);
-               return NULL;
+               return -1;
        }
        event_class = g_ptr_array_index(stream_class->events_by_id, id);
        if (!event_class) {
                fprintf(stderr, "[error] Event id %" PRIu64 " is unknown.\n", id);
-               return NULL;
+               return -1;
        }
 
-       return event;
+       return 0;
 }
 
 void process_callbacks(struct bt_ctf_iter *iter,
@@ -179,9 +179,9 @@ void process_callbacks(struct bt_ctf_iter *iter,
        struct bt_callback *cb;
        int i;
        enum bt_cb_ret ret;
-       struct ctf_event_definition *ctf_data;
+       struct bt_ctf_event ctf_data;
 
-       ctf_data = extract_ctf_stream_event(stream);
+       ret = extract_ctf_stream_event(stream, &ctf_data);
 
        /* process all events callback first */
        if (iter->main_callbacks.callback) {
@@ -189,7 +189,7 @@ void process_callbacks(struct bt_ctf_iter *iter,
                        cb = &g_array_index(iter->main_callbacks.callback, struct bt_callback, i);
                        if (!cb)
                                goto end;
-                       ret = cb->callback(ctf_data, cb->private_data);
+                       ret = cb->callback(&ctf_data, cb->private_data);
                        switch (ret) {
                        case BT_CB_OK_STOP:
                        case BT_CB_ERROR_STOP:
@@ -217,7 +217,7 @@ void process_callbacks(struct bt_ctf_iter *iter,
                cb = &g_array_index(bt_chain->callback, struct bt_callback, i);
                if (!cb)
                        goto end;
-               ret = cb->callback(ctf_data, cb->private_data);
+               ret = cb->callback(&ctf_data, cb->private_data);
                switch (ret) {
                case BT_CB_OK_STOP:
                case BT_CB_ERROR_STOP:
index 714216f3a66ff608ea11799e832388214f544feb..b33796bc2dfbc9580e46b57d88848de266445862 100644 (file)
  */
 __thread int bt_ctf_last_field_error = 0;
 
-const struct definition *bt_ctf_get_top_level_scope(const struct ctf_event_definition *event,
+const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *ctf_event,
                enum bt_ctf_scope scope)
 {
        struct definition *tmp = NULL;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        switch (scope) {
        case BT_TRACE_PACKET_HEADER:
@@ -83,7 +84,7 @@ error:
        return NULL;
 }
 
-const struct definition *bt_ctf_get_field(const struct ctf_event_definition *event,
+const struct definition *bt_ctf_get_field(const struct bt_ctf_event *ctf_event,
                const struct definition *scope,
                const char *field)
 {
@@ -114,7 +115,7 @@ const struct definition *bt_ctf_get_field(const struct ctf_event_definition *eve
        return NULL;
 }
 
-const struct definition *bt_ctf_get_index(const struct ctf_event_definition *event,
+const struct definition *bt_ctf_get_index(const struct bt_ctf_event *ctf_event,
                const struct definition *field,
                unsigned int index)
 {
@@ -134,10 +135,11 @@ const struct definition *bt_ctf_get_index(const struct ctf_event_definition *eve
        return ret;
 }
 
-const char *bt_ctf_event_name(const struct ctf_event_definition *event)
+const char *bt_ctf_event_name(const struct bt_ctf_event *ctf_event)
 {
        struct ctf_event_declaration *event_class;
        struct ctf_stream_declaration *stream_class;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        if (!event)
                return NULL;
@@ -161,7 +163,7 @@ enum ctf_type_id bt_ctf_field_type(const struct definition *def)
        return CTF_TYPE_UNKNOWN;
 }
 
-int bt_ctf_get_field_list(const struct ctf_event_definition *event,
+int bt_ctf_get_field_list(const struct bt_ctf_event *ctf_event,
                const struct definition *scope,
                struct definition const * const **list,
                unsigned int *count)
@@ -247,11 +249,12 @@ error:
        return -1;
 }
 
-struct bt_context *bt_ctf_event_get_context(const struct ctf_event_definition *event)
+struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *ctf_event)
 {
        struct bt_context *ret = NULL;
        struct ctf_file_stream *cfs;
        struct ctf_trace *trace;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        cfs = container_of(event->stream, struct ctf_file_stream,
                        parent);
@@ -262,11 +265,12 @@ struct bt_context *bt_ctf_event_get_context(const struct ctf_event_definition *e
        return ret;
 }
 
-int bt_ctf_event_get_handle_id(const struct ctf_event_definition *event)
+int bt_ctf_event_get_handle_id(const struct bt_ctf_event *ctf_event)
 {
        int ret = -1;
        struct ctf_file_stream *cfs;
        struct ctf_trace *trace;
+       struct ctf_event_definition *event = ctf_event->parent;
 
        cfs = container_of(event->stream, struct ctf_file_stream,
                        parent);
@@ -277,8 +281,9 @@ int bt_ctf_event_get_handle_id(const struct ctf_event_definition *event)
        return ret;
 }
 
-uint64_t bt_ctf_get_timestamp_raw(const struct ctf_event_definition *event)
+uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *ctf_event)
 {
+       struct ctf_event_definition *event = ctf_event->parent;
        if (event && event->stream->has_timestamp)
                return ctf_get_timestamp_raw(event->stream,
                                event->stream->timestamp);
@@ -286,8 +291,9 @@ uint64_t bt_ctf_get_timestamp_raw(const struct ctf_event_definition *event)
                return -1ULL;
 }
 
-uint64_t bt_ctf_get_timestamp(const struct ctf_event_definition *event)
+uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *ctf_event)
 {
+       struct ctf_event_definition *event = ctf_event->parent;
        if (event && event->stream->has_timestamp)
                return ctf_get_timestamp(event->stream,
                                event->stream->timestamp);
index 5cc7dbad14de5d79ae66ba0fcffefba055983b1e..f7b25f158884827459d7de0b8286832c60b3a33e 100644 (file)
@@ -86,10 +86,10 @@ struct bt_iter *bt_ctf_get_iter(struct bt_ctf_iter *iter)
        return &iter->parent;
 }
 
-struct ctf_event_definition *bt_ctf_iter_read_event(struct bt_ctf_iter *iter)
+struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter)
 {
        struct ctf_file_stream *file_stream;
-       struct ctf_event_definition *ret = &iter->current_ctf_event;
+       struct bt_ctf_event *ret = &iter->current_ctf_event;
        struct ctf_stream_definition *stream;
 
        file_stream = heap_maximum(iter->parent.stream_heap);
@@ -98,13 +98,13 @@ struct ctf_event_definition *bt_ctf_iter_read_event(struct bt_ctf_iter *iter)
                goto stop;
        }
        stream = &file_stream->parent;
-       ret = g_ptr_array_index(stream->events_by_id,
+       ret->parent = g_ptr_array_index(stream->events_by_id,
                        stream->event_id);
 
-       if (ret->stream->stream_id > iter->callbacks->len)
+       if (ret->parent->stream->stream_id > iter->callbacks->len)
                goto end;
 
-       process_callbacks(iter, ret->stream);
+       process_callbacks(iter, ret->parent->stream);
 
 end:
        return ret;
index 9fa22fbf447ecd4ad27ac491c66e2e7ab6b7d5af..4a85ff9966162aefa6c61b757ff510a62a659dec 100644 (file)
@@ -29,7 +29,7 @@
 /* struct bt_context is opaque to the user */
 struct bt_context;
 struct stream_pos;
-struct ctf_event_definition;
+struct bt_ctf_event;
 
 /*
  * bt_context_create : create a Babeltrace context
@@ -102,6 +102,6 @@ void bt_context_put(struct bt_context *ctx);
  *
  * Returns NULL on error
  */
-struct bt_context *bt_ctf_event_get_context(const struct ctf_event_definition *event);
+struct bt_context *bt_ctf_event_get_context(const struct bt_ctf_event *event);
 
 #endif /* _BABELTRACE_CONTEXT_H */
index e9528da5b61c690ba896626e792b251914580d90..b76f82e180ce8ea208ef0b0a7508470a3fcb6872 100644 (file)
@@ -31,7 +31,7 @@ struct bt_callback {
        struct bt_dependencies *depends;
        struct bt_dependencies *weak_depends;
        struct bt_dependencies *provides;
-       enum bt_cb_ret (*callback)(struct ctf_event_definition *ctf_data,
+       enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
                                   void *private_data);
 };
 
index 43d7af1caeeec9804bcb123ab64f843a7c21c7f3..328762ca14c3e968b10aa62a5c8a26ff202ad73d 100644 (file)
@@ -84,7 +84,7 @@ void babeltrace_dependencies_destroy(struct bt_dependencies *dep);
  */
 int bt_ctf_iter_add_callback(struct bt_ctf_iter *iter,
                bt_intern_str event, void *private_data, int flags,
-               enum bt_cb_ret (*callback)(struct ctf_event_definition *ctf_data,
+               enum bt_cb_ret (*callback)(struct bt_ctf_event *ctf_data,
                                           void *caller_data),
                struct bt_dependencies *depends,
                struct bt_dependencies *weak_depends,
index bd50100d0ea37a7fed53d116f335f3a5e66d2aaf..b01fda4bc199a483621aa9f6c428bc0c504eeb5a 100644 (file)
 
 struct ctf_stream_definition;
 
+/*
+ * These structures are public mappings to internal ctf_event structures.
+ */
+struct bt_ctf_event {
+       struct ctf_event_definition *parent;
+};
+
+struct bt_ctf_event_decl {
+       struct ctf_event_declaration *parent;
+};
+
 struct bt_ctf_iter {
        struct bt_iter parent;
-       struct ctf_event_definition current_ctf_event;  /* last read event */
+       struct bt_ctf_event current_ctf_event;  /* last read event */
        GArray *callbacks;                              /* Array of struct bt_stream_callbacks */
        struct bt_callback_chain main_callbacks;        /* For all events */
        /*
index 2fc82db26281fa72aa6ed2bb4866e277d663b215..80fbdcf2f5b634b9a720bec49c3aa8f69edd384e 100644 (file)
@@ -26,7 +26,7 @@
 #include <stdint.h>
 
 struct definition;
-struct ctf_event_definition;
+struct bt_ctf_event;
 
 /*
  * the top-level scopes in CTF
@@ -77,32 +77,32 @@ enum ctf_string_encoding {
  * between the enum and the actual definition of top-level scopes.
  * On error return NULL.
  */
-const struct definition *bt_ctf_get_top_level_scope(const struct ctf_event_definition *event,
+const struct definition *bt_ctf_get_top_level_scope(const struct bt_ctf_event *event,
                enum bt_ctf_scope scope);
 
 /*
  * bt_ctf_event_get_name: returns the name of the event or NULL on error
  */
-const char *bt_ctf_event_name(const struct ctf_event_definition *event);
+const char *bt_ctf_event_name(const struct bt_ctf_event *event);
 
 /*
  * bt_ctf_get_timestamp_raw: returns the timestamp of the event as written in
  * the packet or -1ULL on error
  */
-uint64_t bt_ctf_get_timestamp_raw(const struct ctf_event_definition *event);
+uint64_t bt_ctf_get_timestamp_raw(const struct bt_ctf_event *event);
 
 /*
  * bt_ctf_get_timestamp: returns the timestamp of the event offsetted with the
  * system clock source or -1ULL on error
  */
-uint64_t bt_ctf_get_timestamp(const struct ctf_event_definition *event);
+uint64_t bt_ctf_get_timestamp(const struct bt_ctf_event *event);
 
 /*
  * bt_ctf_get_field_list: set list pointer to an array of definition
  * pointers and set count to the number of elements in the array.
  * Return 0 on success and a negative value on error.
  */
-int bt_ctf_get_field_list(const struct ctf_event_definition *event,
+int bt_ctf_get_field_list(const struct bt_ctf_event *event,
                const struct definition *scope,
                struct definition const * const **list,
                unsigned int *count);
@@ -110,7 +110,7 @@ int bt_ctf_get_field_list(const struct ctf_event_definition *event,
 /*
  * bt_ctf_get_field: returns the definition of a specific field
  */
-const struct definition *bt_ctf_get_field(const struct ctf_event_definition *event,
+const struct definition *bt_ctf_get_field(const struct bt_ctf_event *event,
                const struct definition *scope,
                const char *field);
 
@@ -118,7 +118,7 @@ const struct definition *bt_ctf_get_field(const struct ctf_event_definition *eve
  * bt_ctf_get_index: if the field is an array or a sequence, return the element
  * at position index, otherwise return NULL;
  */
-const struct definition *bt_ctf_get_index(const struct ctf_event_definition *event,
+const struct definition *bt_ctf_get_index(const struct bt_ctf_event *event,
                const struct definition *field,
                unsigned int index);
 
index 7aeb032c81f23e506edcb9392b7574f85e0152f5..1071def852749d3a4abee44a346e2280dd2d7452 100644 (file)
@@ -26,7 +26,7 @@
 #include <babeltrace/iterator.h>
 
 struct bt_ctf_iter;
-struct ctf_event_definition;
+struct bt_ctf_event;
 
 /*
  * bt_ctf_iter_create - Allocate a CTF trace collection iterator.
@@ -68,6 +68,6 @@ void bt_ctf_iter_destroy(struct bt_ctf_iter *iter);
  *
  * Return current event on success, NULL on end of trace.
  */
-struct ctf_event_definition *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
+struct bt_ctf_event *bt_ctf_iter_read_event(struct bt_ctf_iter *iter);
 
 #endif /* _BABELTRACE_CTF_ITERATOR_H */
index 0c83bf744fe100fb840edbd92629898dbaaa36b5..31877ee1886a681165d25fdd9d2b2b94e9252af9 100644 (file)
@@ -31,7 +31,7 @@
  * It is a unique identifier representing a trace file.
  */
 struct bt_trace_handle;
-struct ctf_event_definition;
+struct bt_ctf_event;
 
 /*
  * bt_trace_handle_get_path : returns the path of a trace_handle.
@@ -55,6 +55,6 @@ uint64_t bt_trace_handle_get_timestamp_end(struct bt_context *ctx, int handle_id
  *
  * Returns -1 on error
  */
-int bt_ctf_event_get_handle_id(const struct ctf_event_definition *event);
+int bt_ctf_event_get_handle_id(const struct bt_ctf_event *event);
 
 #endif /* _BABELTRACE_TRACE_HANDLE_H */
This page took 0.03351 seconds and 4 git commands to generate.