Rename bt_notification_packet_start to "begin"
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Sun, 11 Dec 2016 14:32:37 +0000 (09:32 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 18:09:08 +0000 (14:09 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
include/babeltrace/plugin/notification/notification.h
include/babeltrace/plugin/notification/packet-internal.h
include/babeltrace/plugin/notification/packet.h
lib/plugin-system/notification/packet.c
plugins/ctf/common/notif-iter/notif-iter.c
plugins/ctf/fs/fs.c
plugins/text/text.c
plugins/writer/writer.c

index 4636f229126f6f14386637aa7c38af0c1cc5a7b4..34a185a01f11a167226a3b2b25ea90b6dc08a699 100644 (file)
@@ -48,8 +48,8 @@ enum bt_notification_type {
        /** Event delivery notification, see event.h */
        BT_NOTIFICATION_TYPE_EVENT = 1,
 
-       /** Start of stream packet notification, see packet.h */
-       BT_NOTIFICATION_TYPE_PACKET_START = 2,
+       /** Beginning of stream packet notification, see packet.h */
+       BT_NOTIFICATION_TYPE_PACKET_BEGIN = 2,
 
        /** End of stream packet notification, see packet.h */
        BT_NOTIFICATION_TYPE_PACKET_END = 3,
index f1d1301ebf33b111b5df06bcdd947b7d040e28b1..e36bb6a1fedcb29943e854fc027384a38f245683 100644 (file)
@@ -30,7 +30,7 @@
 #include <babeltrace/ctf-ir/packet.h>
 #include <babeltrace/plugin/notification/notification-internal.h>
 
-struct bt_notification_packet_start {
+struct bt_notification_packet_begin {
        struct bt_notification parent;
        struct bt_ctf_packet *packet;
 };
index dd5bc9099592bcfb13e5fbc4a3cf46c94e0c816b..c90b4c99991ae2be2f3a4132f1ef0506f73eb8d9 100644 (file)
@@ -35,10 +35,10 @@ extern "C" {
 
 struct bt_ctf_packet;
 
-/*** BT_NOTIFICATION_TYPE_PACKET_START ***/
-struct bt_notification *bt_notification_packet_start_create(
+/*** BT_NOTIFICATION_TYPE_PACKET_BEGIN ***/
+struct bt_notification *bt_notification_packet_begin_create(
                struct bt_ctf_packet *packet);
-struct bt_ctf_packet *bt_notification_packet_start_get_packet(
+struct bt_ctf_packet *bt_notification_packet_begin_get_packet(
                struct bt_notification *notification);
 
 /*** BT_NOTIFICATION_TYPE_PACKET_END ***/
index 112f0f788d354bc78bc04d35a99f386bb1863bf0..a57310f1059bc70fb15b7c4ff06ccc3c4a1ceb8e 100644 (file)
 #include <babeltrace/plugin/notification/packet-internal.h>
 
 static
-void bt_notification_packet_start_destroy(struct bt_object *obj)
+void bt_notification_packet_begin_destroy(struct bt_object *obj)
 {
-       struct bt_notification_packet_start *notification =
-                       (struct bt_notification_packet_start *) obj;
+       struct bt_notification_packet_begin *notification =
+                       (struct bt_notification_packet_begin *) obj;
 
        BT_PUT(notification->packet);
        g_free(notification);
@@ -47,33 +47,40 @@ void bt_notification_packet_end_destroy(struct bt_object *obj)
        g_free(notification);
 }
 
-struct bt_notification *bt_notification_packet_start_create(
+struct bt_notification *bt_notification_packet_begin_create(
                struct bt_ctf_packet *packet)
 {
-       struct bt_notification_packet_start *notification;
+       struct bt_notification_packet_begin *notification;
 
        if (!packet) {
                goto error;
        }
 
-       notification = g_new0(struct bt_notification_packet_start, 1);
+       notification = g_new0(struct bt_notification_packet_begin, 1);
        bt_notification_init(&notification->parent,
-                       BT_NOTIFICATION_TYPE_PACKET_START,
-                       bt_notification_packet_start_destroy);
+                       BT_NOTIFICATION_TYPE_PACKET_BEGIN,
+                       bt_notification_packet_begin_destroy);
        notification->packet = bt_get(packet);
        return &notification->parent;
 error:
        return NULL;
 }
 
-struct bt_ctf_packet *bt_notification_packet_start_get_packet(
+struct bt_ctf_packet *bt_notification_packet_begin_get_packet(
                struct bt_notification *notification)
 {
-       struct bt_notification_packet_start *packet_start;
+       struct bt_ctf_packet *ret = NULL;
+       struct bt_notification_packet_begin *packet_begin;
 
-       packet_start = container_of(notification,
-                       struct bt_notification_packet_start, parent);
-       return bt_get(packet_start->packet);
+       if (notification->type != BT_NOTIFICATION_TYPE_PACKET_BEGIN) {
+               goto end;
+       }
+
+       packet_begin = container_of(notification,
+                       struct bt_notification_packet_begin, parent);
+       ret = bt_get(packet_begin->packet);
+end:
+       return ret;
 }
 
 struct bt_notification *bt_notification_packet_end_create(
@@ -98,9 +105,16 @@ error:
 struct bt_ctf_packet *bt_notification_packet_end_get_packet(
                struct bt_notification *notification)
 {
+       struct bt_ctf_packet *ret = NULL;
        struct bt_notification_packet_end *packet_end;
 
+       if (notification->type != BT_NOTIFICATION_TYPE_PACKET_END) {
+               goto end;
+       }
+
        packet_end = container_of(notification,
                        struct bt_notification_packet_end, parent);
-       return bt_get(packet_end->packet);
+       ret = bt_get(packet_end->packet);
+end:
+       return ret;
 }
index 692ed6a93bae231a4089f67a81001450d03c4cfb..106d20022019ccfd270ae53dd00a97a055360e3f 100644 (file)
@@ -1896,7 +1896,7 @@ void notify_new_packet(struct bt_ctf_notif_iter *notit,
                return;
        }
 
-       ret = bt_notification_packet_start_create(notit->packet);
+       ret = bt_notification_packet_begin_create(notit->packet);
        if (!ret) {
                return;
        }
index 71ae52b079cae414ef1c69ce20fcdefe8866a95a..6b80d04a3258755c80fd50dfcd2368d4934a0342 100644 (file)
@@ -144,11 +144,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;
@@ -428,7 +428,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 +457,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:
        {
index 6781b1b66e20237907c7dcd616643ba557f6c415..2712dd684db95d8de215cf24dc94a356e3faf71e 100644 (file)
@@ -119,7 +119,7 @@ enum bt_component_status handle_notification(struct text_component *text,
        }
 
        switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_START:
+       case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
                puts("<packet>");
                break;
        case BT_NOTIFICATION_TYPE_PACKET_END:
index 525f0d579fc80c9eff5e52ddc59c81991e8ccc2d..ad99ed8abd4691d3d2b8397f6c6a26a0373c0724 100644 (file)
@@ -126,10 +126,10 @@ enum bt_component_status handle_notification(
        }
 
        switch (bt_notification_get_type(notification)) {
-       case BT_NOTIFICATION_TYPE_PACKET_START:
+       case BT_NOTIFICATION_TYPE_PACKET_BEGIN:
        {
                struct bt_ctf_packet *packet =
-                       bt_notification_packet_start_get_packet(notification);
+                       bt_notification_packet_begin_get_packet(notification);
 
                if (!packet) {
                        ret = BT_COMPONENT_STATUS_ERROR;
@@ -143,7 +143,7 @@ enum bt_component_status handle_notification(
        case BT_NOTIFICATION_TYPE_PACKET_END:
        {
                struct bt_ctf_packet *packet =
-                       bt_notification_packet_start_get_packet(notification);
+                       bt_notification_packet_end_get_packet(notification);
 
                if (!packet) {
                        ret = BT_COMPONENT_STATUS_ERROR;
This page took 0.030366 seconds and 4 git commands to generate.