+ goto end;
+ }
+
+handle_state:
+ BT_ASSERT(dmesg_comp->trace);
+
+ switch (dmesg_notif_iter->state) {
+ case STATE_EMIT_STREAM_BEGINNING:
+ BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
+ next_ret.notification = bt_notification_stream_begin_create(
+ dmesg_comp->stream);
+ dmesg_notif_iter->state = STATE_EMIT_PACKET_BEGINNING;
+ break;
+ case STATE_EMIT_PACKET_BEGINNING:
+ BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
+ next_ret.notification = bt_notification_packet_begin_create(
+ dmesg_comp->packet);
+ dmesg_notif_iter->state = STATE_EMIT_EVENT;
+ break;
+ case STATE_EMIT_EVENT:
+ BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
+ BT_MOVE(next_ret.notification,
+ dmesg_notif_iter->tmp_event_notif);
+ break;
+ case STATE_EMIT_PACKET_END:
+ next_ret.notification = bt_notification_packet_end_create(
+ dmesg_comp->packet);
+ dmesg_notif_iter->state = STATE_EMIT_STREAM_END;
+ break;
+ case STATE_EMIT_STREAM_END:
+ next_ret.notification = bt_notification_stream_end_create(
+ dmesg_comp->stream);
+ dmesg_notif_iter->state = STATE_DONE;
+ break;
+ default:
+ break;
+ }
+
+ if (!next_ret.notification) {
+ BT_LOGE("Cannot create notification: dmesg-comp-addr=%p",
+ dmesg_comp);
+ next_ret.status = BT_NOTIFICATION_ITERATOR_STATUS_ERROR;