X-Git-Url: http://git.efficios.com/?p=babeltrace.git;a=blobdiff_plain;f=src%2Fplugins%2Fctf%2Fcommon%2Fmsg-iter%2Fmsg-iter.c;h=fb87e7d3e0e37b1f29998cd830a8b01f8d5a73f3;hp=9edc55c80b77b3c96264625c17d8a83c1c8be81e;hb=148f02cb367caf23f134c1cb805f669706448649;hpb=c0def275351b9f938b27ab83d8cb5e4026fc57d5 diff --git a/src/plugins/ctf/common/msg-iter/msg-iter.c b/src/plugins/ctf/common/msg-iter/msg-iter.c index 9edc55c8..fb87e7d3 100644 --- a/src/plugins/ctf/common/msg-iter/msg-iter.c +++ b/src/plugins/ctf/common/msg-iter/msg-iter.c @@ -708,7 +708,7 @@ void release_all_dscopes(struct ctf_msg_iter *msg_it) static enum ctf_msg_iter_status switch_packet_state(struct ctf_msg_iter *msg_it) { - enum ctf_msg_iter_status status = CTF_MSG_ITER_STATUS_OK; + enum ctf_msg_iter_status status; bt_self_component *self_comp = msg_it->self_comp; /* @@ -732,6 +732,30 @@ enum ctf_msg_iter_status switch_packet_state(struct ctf_msg_iter *msg_it) release_all_dscopes(msg_it); msg_it->cur_dscope_field = NULL; + if (msg_it->medium.medops.switch_packet) { + enum ctf_msg_iter_medium_status medium_status; + + medium_status = msg_it->medium.medops.switch_packet(msg_it->medium.data); + if (medium_status == CTF_MSG_ITER_MEDIUM_STATUS_EOF) { + /* No more packets. */ + msg_it->state = STATE_CHECK_EMIT_MSG_STREAM_END; + status = CTF_MSG_ITER_STATUS_OK; + goto end; + } else if (medium_status != CTF_MSG_ITER_MEDIUM_STATUS_OK) { + status = (int) medium_status; + goto end; + } + + /* + * After the packet switch, the medium might want to give us a + * different buffer for the new packet. + */ + status = request_medium_bytes(msg_it); + if (status != CTF_MSG_ITER_STATUS_OK) { + goto end; + } + } + /* * Adjust current buffer so that addr points to the beginning of the new * packet. @@ -768,6 +792,7 @@ enum ctf_msg_iter_status switch_packet_state(struct ctf_msg_iter *msg_it) msg_it->snapshots.end_clock = UINT64_C(-1); msg_it->state = STATE_DSCOPE_TRACE_PACKET_HEADER_BEGIN; + status = CTF_MSG_ITER_STATUS_OK; end: return status; } @@ -3149,14 +3174,6 @@ end: return status; } -BT_HIDDEN -void ctf_msg_iter_set_medops_data(struct ctf_msg_iter *msg_it, - void *medops_data) -{ - BT_ASSERT(msg_it); - msg_it->medium.data = medops_data; -} - BT_HIDDEN enum ctf_msg_iter_status ctf_msg_iter_seek(struct ctf_msg_iter *msg_it, off_t offset)