X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=formats%2Fctf%2Fctf.c;h=22a55e64b50c813fa02827a31cf5c322075cd784;hp=8608b5a1b68c95115b4d499215baed1076ea441e;hb=c716f83b53677d5f2e6a15463408f464006eafb7;hpb=f8370579c39fce61e32be29bd3c6ba8e3b762211 diff --git a/formats/ctf/ctf.c b/formats/ctf/ctf.c index 8608b5a1..22a55e64 100644 --- a/formats/ctf/ctf.c +++ b/formats/ctf/ctf.c @@ -23,6 +23,8 @@ #include #include #include +#include +#include #include #include #include @@ -76,6 +78,12 @@ struct trace_descriptor *ctf_open_mmap_trace( void (*packet_seek)(struct stream_pos *pos, size_t index, int whence), FILE *metadata_fp); +static +void ctf_set_context(struct trace_descriptor *descriptor, + struct bt_context *ctx); +static +void ctf_set_handle(struct trace_descriptor *descriptor, + struct bt_trace_handle *handle); static void ctf_close_trace(struct trace_descriptor *descriptor); @@ -109,6 +117,8 @@ struct format ctf_format = { .open_trace = ctf_open_trace, .open_mmap_trace = ctf_open_mmap_trace, .close_trace = ctf_close_trace, + .set_context = ctf_set_context, + .set_handle = ctf_set_handle, }; /* @@ -215,8 +225,8 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream *stream) { struct ctf_stream_pos *pos = container_of(ppos, struct ctf_stream_pos, parent); - struct ctf_stream_class *stream_class = stream->stream_class; - struct ctf_stream_event *event; + struct ctf_stream_declaration *stream_class = stream->stream_class; + struct ctf_event_definition *event; uint64_t id = 0; int ret; @@ -327,8 +337,8 @@ error: static int ctf_write_event(struct stream_pos *pos, struct ctf_stream *stream) { - struct ctf_stream_class *stream_class = stream->stream_class; - struct ctf_stream_event *event; + struct ctf_stream_declaration *stream_class = stream->stream_class; + struct ctf_event_definition *event; uint64_t id; int ret; @@ -888,11 +898,11 @@ end_stream: } static -struct ctf_stream_event *create_event_definitions(struct ctf_trace *td, +struct ctf_event_definition *create_event_definitions(struct ctf_trace *td, struct ctf_stream *stream, struct ctf_event *event) { - struct ctf_stream_event *stream_event = g_new0(struct ctf_stream_event, 1); + struct ctf_event_definition *stream_event = g_new0(struct ctf_event_definition, 1); if (event->context_decl) { struct definition *definition = @@ -929,7 +939,7 @@ error: static int create_stream_definitions(struct ctf_trace *td, struct ctf_stream *stream) { - struct ctf_stream_class *stream_class; + struct ctf_stream_declaration *stream_class; int ret; int i; @@ -978,7 +988,7 @@ int create_stream_definitions(struct ctf_trace *td, struct ctf_stream *stream) g_ptr_array_set_size(stream->events_by_id, stream_class->events_by_id->len); for (i = 0; i < stream->events_by_id->len; i++) { struct ctf_event *event = g_ptr_array_index(stream_class->events_by_id, i); - struct ctf_stream_event *stream_event; + struct ctf_event_definition *stream_event; if (!event) continue; @@ -991,7 +1001,7 @@ int create_stream_definitions(struct ctf_trace *td, struct ctf_stream *stream) error_event: for (i = 0; i < stream->events_by_id->len; i++) { - struct ctf_stream_event *stream_event = g_ptr_array_index(stream->events_by_id, i); + struct ctf_event_definition *stream_event = g_ptr_array_index(stream->events_by_id, i); if (stream_event) g_free(stream_event); } @@ -1011,7 +1021,7 @@ static int create_stream_packet_index(struct ctf_trace *td, struct ctf_file_stream *file_stream) { - struct ctf_stream_class *stream; + struct ctf_stream_declaration *stream; int len_index; struct ctf_stream_pos *pos; struct stat filestats; @@ -1452,7 +1462,7 @@ static int prepare_mmap_stream_definition(struct ctf_trace *td, struct ctf_file_stream *file_stream) { - struct ctf_stream_class *stream; + struct ctf_stream_declaration *stream; uint64_t stream_id = 0; int ret; @@ -1591,7 +1601,7 @@ void ctf_close_trace(struct trace_descriptor *tdp) if (td->streams) { for (i = 0; i < td->streams->len; i++) { - struct ctf_stream_class *stream; + struct ctf_stream_declaration *stream; int j; stream = g_ptr_array_index(td->streams, i); @@ -1610,6 +1620,26 @@ void ctf_close_trace(struct trace_descriptor *tdp) g_free(td); } +static +void ctf_set_context(struct trace_descriptor *descriptor, + struct bt_context *ctx) +{ + struct ctf_trace *td = container_of(descriptor, struct ctf_trace, + parent); + + td->ctx = ctx; +} + +static +void ctf_set_handle(struct trace_descriptor *descriptor, + struct bt_trace_handle *handle) +{ + struct ctf_trace *td = container_of(descriptor, struct ctf_trace, + parent); + + td->handle = handle; +} + void __attribute__((constructor)) ctf_init(void) { int ret;