X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Fnotification%2Fpacket.c;h=acf0ce5f1b8eb2b5235445f7eb4479cb6121c62d;hb=65300d60e4b4f167e5fc8f584677757ce09a3844;hp=316eb61380a2a2486b01fb01986440f9ad8a3b02;hpb=6c677fb54f458456e3b5a15cffa6774bd7a86f54;p=babeltrace.git diff --git a/lib/graph/notification/packet.c b/lib/graph/notification/packet.c index 316eb613..acf0ce5f 100644 --- a/lib/graph/notification/packet.c +++ b/lib/graph/notification/packet.c @@ -28,13 +28,14 @@ #include #include -#include -#include -#include -#include -#include +#include +#include +#include +#include +#include #include #include +#include #include #include #include @@ -58,19 +59,22 @@ struct bt_notification *bt_notification_packet_begin_new(struct bt_graph *graph) goto end; error: - BT_PUT(notification); + BT_OBJECT_PUT_REF_AND_RESET(notification); end: return (void *) notification; } struct bt_notification *bt_notification_packet_begin_create( - struct bt_graph *graph, struct bt_packet *packet) + struct bt_private_connection_private_notification_iterator *notif_iter, + struct bt_packet *packet) { - struct bt_notification_packet_begin *notification; + struct bt_notification_packet_begin *notification = NULL; struct bt_stream *stream; struct bt_stream_class *stream_class; + struct bt_graph *graph; + BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator"); BT_ASSERT_PRE_NON_NULL(packet, "Packet"); stream = bt_packet_borrow_stream(packet); BT_ASSERT(stream); @@ -84,6 +88,8 @@ struct bt_notification *bt_notification_packet_begin_create( stream_class, bt_stream_class_get_name(stream_class), bt_stream_class_get_id(stream_class)); + graph = bt_private_connection_private_notification_iterator_borrow_graph( + notif_iter); notification = (void *) bt_notification_create_from_pool( &graph->packet_begin_notif_pool, graph); if (!notification) { @@ -95,6 +101,7 @@ struct bt_notification *bt_notification_packet_begin_create( notification->packet = packet; bt_object_get_no_null_check_no_parent_check( ¬ification->packet->base); + bt_packet_set_is_frozen(packet, true); BT_LOGD("Created packet beginning notification object: " "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " @@ -116,7 +123,7 @@ void bt_notification_packet_begin_destroy(struct bt_notification *notif) BT_LOGD("Destroying packet beginning notification: addr=%p", notif); BT_LOGD_STR("Putting packet."); - BT_PUT(packet_begin_notif->packet); + BT_OBJECT_PUT_REF_AND_RESET(packet_begin_notif->packet); g_free(notif); } @@ -173,19 +180,22 @@ struct bt_notification *bt_notification_packet_end_new(struct bt_graph *graph) goto end; error: - BT_PUT(notification); + BT_OBJECT_PUT_REF_AND_RESET(notification); end: return (void *) notification; } struct bt_notification *bt_notification_packet_end_create( - struct bt_graph *graph, struct bt_packet *packet) + struct bt_private_connection_private_notification_iterator *notif_iter, + struct bt_packet *packet) { - struct bt_notification_packet_end *notification; + struct bt_notification_packet_end *notification = NULL; struct bt_stream *stream; struct bt_stream_class *stream_class; + struct bt_graph *graph; + BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator"); BT_ASSERT_PRE_NON_NULL(packet, "Packet"); stream = bt_packet_borrow_stream(packet); BT_ASSERT(stream); @@ -199,6 +209,8 @@ struct bt_notification *bt_notification_packet_end_create( stream_class, bt_stream_class_get_name(stream_class), bt_stream_class_get_id(stream_class)); + graph = bt_private_connection_private_notification_iterator_borrow_graph( + notif_iter); notification = (void *) bt_notification_create_from_pool( &graph->packet_end_notif_pool, graph); if (!notification) { @@ -210,6 +222,7 @@ struct bt_notification *bt_notification_packet_end_create( notification->packet = packet; bt_object_get_no_null_check_no_parent_check( ¬ification->packet->base); + bt_packet_set_is_frozen(packet, true); BT_LOGD("Created packet end notification object: " "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " "stream-class-addr=%p, stream-class-name=\"%s\", " @@ -231,7 +244,7 @@ void bt_notification_packet_end_destroy(struct bt_notification *notif) BT_LOGD("Destroying packet end notification: addr=%p", notif); BT_LOGD_STR("Putting packet."); - BT_PUT(packet_end_notif->packet); + BT_OBJECT_PUT_REF_AND_RESET(packet_end_notif->packet); g_free(notif); } @@ -250,7 +263,7 @@ void bt_notification_packet_end_recycle(struct bt_notification *notif) BT_LOGD("Recycling packet end notification: addr=%p", notif); bt_notification_reset(notif); - BT_PUT(packet_end_notif->packet); + BT_OBJECT_PUT_REF_AND_RESET(packet_end_notif->packet); graph = notif->graph; notif->graph = NULL; bt_object_pool_recycle_object(&graph->packet_end_notif_pool, notif);