X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Fctf%2Ffs%2Ffs.c;h=d3fcf0f0f735694ff273f44697970ddef3d8e79d;hb=d3e4dcd8e7a601e0aa063455147f29fbe051582b;hp=3a60b0d5e40d4dd632658c73fed9b30f7290bcb1;hpb=f48bc732c2d473f25e9719d9ee72717593c12ae8;p=babeltrace.git diff --git a/plugins/ctf/fs/fs.c b/plugins/ctf/fs/fs.c index 3a60b0d5..d3fcf0f0 100644 --- a/plugins/ctf/fs/fs.c +++ b/plugins/ctf/fs/fs.c @@ -26,14 +26,13 @@ * SOFTWARE. */ -#include #include -#include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -144,11 +143,11 @@ struct bt_ctf_stream *internal_bt_notification_get_stream( bt_put(event); break; } - case BT_NOTIFICATION_TYPE_PACKET_START: + case BT_NOTIFICATION_TYPE_PACKET_BEGIN: { struct bt_ctf_packet *packet; - packet = bt_notification_packet_start_get_packet(notification); + packet = bt_notification_packet_begin_get_packet(notification); stream = bt_ctf_packet_get_stream(packet); bt_put(packet); break; @@ -377,7 +376,7 @@ bool compare_event_notifications(struct bt_notification *a, struct bt_notification *b) { int ret; - struct bt_ctf_clock *clock; + struct bt_ctf_clock_class *clock_class; struct bt_ctf_clock_value *a_clock_value, *b_clock_value; struct bt_ctf_stream_class *a_stream_class; struct bt_ctf_stream *a_stream; @@ -398,9 +397,9 @@ bool compare_event_notifications(struct bt_notification *a, trace = bt_ctf_stream_class_get_trace(a_stream_class); assert(trace); - clock = bt_ctf_trace_get_clock(trace, 0); - a_clock_value = bt_ctf_event_get_clock_value(a_event, clock); - b_clock_value = bt_ctf_event_get_clock_value(b_event, clock); + clock_class = bt_ctf_trace_get_clock_class(trace, 0); + a_clock_value = bt_ctf_event_get_clock_value(a_event, clock_class); + b_clock_value = bt_ctf_event_get_clock_value(b_event, clock_class); assert(a_clock_value); assert(b_clock_value); @@ -415,7 +414,7 @@ bool compare_event_notifications(struct bt_notification *a, bt_put(b_clock_value); bt_put(a_stream); bt_put(a_stream_class); - bt_put(clock); + bt_put(clock_class); bt_put(trace); return a_ts < b_ts; } @@ -428,7 +427,7 @@ bool compare_notifications(struct bt_notification *a, struct bt_notification *b, [BT_NOTIFICATION_TYPE_NEW_TRACE] = 0, [BT_NOTIFICATION_TYPE_NEW_STREAM_CLASS] = 1, [BT_NOTIFICATION_TYPE_NEW_EVENT_CLASS] = 2, - [BT_NOTIFICATION_TYPE_PACKET_START] = 3, + [BT_NOTIFICATION_TYPE_PACKET_BEGIN] = 3, [BT_NOTIFICATION_TYPE_PACKET_END] = 4, [BT_NOTIFICATION_TYPE_EVENT] = 5, [BT_NOTIFICATION_TYPE_END_OF_TRACE] = 6, @@ -457,7 +456,7 @@ bool compare_notifications(struct bt_notification *a, struct bt_notification *b, /* Notification types are equal, but not of type "event". */ switch (a_type) { - case BT_NOTIFICATION_TYPE_PACKET_START: + case BT_NOTIFICATION_TYPE_PACKET_BEGIN: case BT_NOTIFICATION_TYPE_PACKET_END: case BT_NOTIFICATION_TYPE_STREAM_END: { @@ -554,6 +553,12 @@ int open_trace_streams(struct ctf_fs_component *ctf_fs, goto error; } + if (file->size == 0) { + /* Skip empty stream. */ + ctf_fs_file_destroy(file); + continue; + } + /* Create a private stream; file ownership is passed to it. */ stream = ctf_fs_stream_create(ctf_fs, file); if (!stream) { @@ -578,7 +583,6 @@ end: return ret; } -static enum bt_component_status ctf_fs_iterator_init(struct bt_component *source, struct bt_notification_iterator *it) { @@ -663,7 +667,6 @@ void ctf_fs_destroy_data(struct ctf_fs_component *ctf_fs) g_free(ctf_fs); } -static void ctf_fs_destroy(struct bt_component *component) { void *data = bt_component_get_private_data(component); @@ -733,21 +736,10 @@ enum bt_component_status ctf_fs_init(struct bt_component *source, goto end; } - ret = bt_component_set_destroy_cb(source, ctf_fs_destroy); - if (ret != BT_COMPONENT_STATUS_OK) { - goto error; - } - ret = bt_component_set_private_data(source, ctf_fs); if (ret != BT_COMPONENT_STATUS_OK) { goto error; } - - ret = bt_component_source_set_iterator_init_cb(source, - ctf_fs_iterator_init); - if (ret != BT_COMPONENT_STATUS_OK) { - goto error; - } end: return ret; error: