X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=lib%2Fgraph%2Fnotification%2Fpacket.c;h=6e4a5a1b4a5c3f0636a0fa66b68b296a54de5711;hb=40f4ba76dd6f9508ca51b6220eaed57632281a07;hp=6752bee05c3876355dd0d5ff6a4a803b5767893c;hpb=e5be10efe4d5543ba697c7e607ca0a5c33fa3ccb;p=babeltrace.git diff --git a/lib/graph/notification/packet.c b/lib/graph/notification/packet.c index 6752bee0..6e4a5a1b 100644 --- a/lib/graph/notification/packet.c +++ b/lib/graph/notification/packet.c @@ -34,7 +34,6 @@ #include #include #include -#include #include #include #include @@ -66,14 +65,14 @@ end: } struct bt_private_notification *bt_private_notification_packet_begin_create( - struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_private_packet *priv_packet) + struct bt_self_notification_iterator *self_notif_iter, + struct bt_packet *packet) { - struct bt_packet *packet = (void *) priv_packet; + struct bt_self_component_port_input_notification_iterator *notif_iter = + (void *) self_notif_iter; 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"); @@ -81,18 +80,11 @@ struct bt_private_notification *bt_private_notification_packet_begin_create( BT_ASSERT(stream); stream_class = bt_stream_borrow_class(stream); BT_ASSERT(stream_class); - BT_LOGD("Creating packet beginning notification object: " - "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " - "stream-class-addr=%p, stream-class-name=\"%s\", " - "stream-class-id=%" PRId64, - packet, stream, bt_stream_get_name(stream), - 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); + BT_LIB_LOGD("Creating packet beginning notification object: " + "%![packet-]+a, %![stream-]+s, %![sc-]+S", + packet, stream, stream_class); notification = (void *) bt_notification_create_from_pool( - &graph->packet_begin_notif_pool, graph); + ¬if_iter->graph->packet_begin_notif_pool, notif_iter->graph); if (!notification) { /* bt_notification_create_from_pool() logs errors */ goto end; @@ -103,14 +95,9 @@ struct bt_private_notification *bt_private_notification_packet_begin_create( 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\", " - "stream-class-id=%" PRId64 ", addr=%p", - packet, stream, bt_stream_get_name(stream), - stream_class, - bt_stream_class_get_name(stream_class), - bt_stream_class_get_id(stream_class), notification); + BT_LIB_LOGD("Created packet beginning notification object: " + "%![notif-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S", + notification, packet, stream, stream_class); goto end; end: @@ -122,8 +109,8 @@ void bt_notification_packet_begin_destroy(struct bt_notification *notif) { struct bt_notification_packet_begin *packet_begin_notif = (void *) notif; - BT_LOGD("Destroying packet beginning notification: addr=%p", notif); - BT_LOGD_STR("Putting packet."); + BT_LIB_LOGD("Destroying packet beginning notification: %!+n", notif); + BT_LIB_LOGD("Putting packet: %!+a", packet_begin_notif->packet); BT_OBJECT_PUT_REF_AND_RESET(packet_begin_notif->packet); g_free(notif); } @@ -141,7 +128,7 @@ void bt_notification_packet_begin_recycle(struct bt_notification *notif) return; } - BT_LOGD("Recycling packet beginning notification: addr=%p", notif); + BT_LIB_LOGD("Recycling packet beginning notification: %!+n", notif); bt_notification_reset(notif); bt_object_put_no_null_check(&packet_begin_notif->packet->base); packet_begin_notif->packet = NULL; @@ -150,24 +137,22 @@ void bt_notification_packet_begin_recycle(struct bt_notification *notif) bt_object_pool_recycle_object(&graph->packet_begin_notif_pool, notif); } -struct bt_packet *bt_notification_packet_begin_borrow_packet( - struct bt_notification *notification) +struct bt_packet *bt_private_notification_packet_begin_borrow_packet( + struct bt_private_notification *notification) { struct bt_notification_packet_begin *packet_begin; BT_ASSERT_PRE_NON_NULL(notification, "Notification"); BT_ASSERT_PRE_NOTIF_IS_TYPE(notification, BT_NOTIFICATION_TYPE_PACKET_BEGIN); - packet_begin = container_of(notification, - struct bt_notification_packet_begin, parent); + packet_begin = (void *) notification; return packet_begin->packet; } -struct bt_private_packet * -bt_private_notification_packet_begin_borrow_private_packet( - struct bt_private_notification *notification) +const struct bt_packet *bt_notification_packet_begin_borrow_packet( + struct bt_notification *notification) { - return (void *) bt_notification_packet_begin_borrow_packet( + return bt_private_notification_packet_begin_borrow_packet( (void *) notification); } @@ -196,14 +181,14 @@ end: } struct bt_private_notification *bt_private_notification_packet_end_create( - struct bt_private_connection_private_notification_iterator *notif_iter, - struct bt_private_packet *priv_packet) + struct bt_self_notification_iterator *self_notif_iter, + struct bt_packet *packet) { - struct bt_packet *packet = (void *) priv_packet; + struct bt_self_component_port_input_notification_iterator *notif_iter = + (void *) self_notif_iter; 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"); @@ -211,18 +196,11 @@ struct bt_private_notification *bt_private_notification_packet_end_create( BT_ASSERT(stream); stream_class = bt_stream_borrow_class(stream); BT_ASSERT(stream_class); - BT_LOGD("Creating packet end notification object: " - "packet-addr=%p, stream-addr=%p, stream-name=\"%s\", " - "stream-class-addr=%p, stream-class-name=\"%s\", " - "stream-class-id=%" PRId64, - packet, stream, bt_stream_get_name(stream), - 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); + BT_LIB_LOGD("Creating packet end notification object: " + "%![packet-]+a, %![stream-]+s, %![sc-]+S", + packet, stream, stream_class); notification = (void *) bt_notification_create_from_pool( - &graph->packet_end_notif_pool, graph); + ¬if_iter->graph->packet_end_notif_pool, notif_iter->graph); if (!notification) { /* bt_notification_create_from_pool() logs errors */ goto end; @@ -233,14 +211,9 @@ struct bt_private_notification *bt_private_notification_packet_end_create( 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\", " - "stream-class-id=%" PRId64 ", addr=%p", - packet, stream, bt_stream_get_name(stream), - stream_class, - bt_stream_class_get_name(stream_class), - bt_stream_class_get_id(stream_class), notification); + BT_LIB_LOGD("Created packet end notification object: " + "%![notif-]+n, %![packet-]+a, %![stream-]+s, %![sc-]+S", + notification, packet, stream, stream_class); goto end; end: @@ -252,8 +225,8 @@ void bt_notification_packet_end_destroy(struct bt_notification *notif) { struct bt_notification_packet_end *packet_end_notif = (void *) notif; - BT_LOGD("Destroying packet end notification: addr=%p", notif); - BT_LOGD_STR("Putting packet."); + BT_LIB_LOGD("Destroying packet end notification: %!+n", notif); + BT_LIB_LOGD("Putting packet: %!+a", packet_end_notif->packet); BT_OBJECT_PUT_REF_AND_RESET(packet_end_notif->packet); g_free(notif); } @@ -271,7 +244,7 @@ void bt_notification_packet_end_recycle(struct bt_notification *notif) return; } - BT_LOGD("Recycling packet end notification: addr=%p", notif); + BT_LIB_LOGD("Recycling packet end notification: %!+n", notif); bt_notification_reset(notif); BT_OBJECT_PUT_REF_AND_RESET(packet_end_notif->packet); graph = notif->graph; @@ -279,22 +252,21 @@ void bt_notification_packet_end_recycle(struct bt_notification *notif) bt_object_pool_recycle_object(&graph->packet_end_notif_pool, notif); } -struct bt_packet *bt_notification_packet_end_borrow_packet( - struct bt_notification *notification) +struct bt_packet *bt_private_notification_packet_end_borrow_packet( + struct bt_private_notification *notification) { struct bt_notification_packet_end *packet_end; BT_ASSERT_PRE_NON_NULL(notification, "Notification"); BT_ASSERT_PRE_NOTIF_IS_TYPE(notification, BT_NOTIFICATION_TYPE_PACKET_END); - packet_end = container_of(notification, - struct bt_notification_packet_end, parent); + packet_end = (void *) notification; return packet_end->packet; } -struct bt_private_packet *bt_private_notification_packet_end_borrow_packet( - struct bt_private_notification *notification) +const struct bt_packet *bt_notification_packet_end_borrow_packet( + struct bt_notification *notification) { - return (void *) bt_notification_packet_end_borrow_packet( + return bt_private_notification_packet_end_borrow_packet( (void *) notification); }