lib: private functions: do not repeat `private` word
[babeltrace.git] / lib / graph / notification / event.c
index a6c7b0ae2fa3e2fd8ec5da5a16f5e6ce6d484761..bd0d077b50258204051c04c1fea11bd1017113ea 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * Babeltrace Plug-in Event Notification
- *
  * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
 
 #include <babeltrace/compiler-internal.h>
 #include <babeltrace/object-internal.h>
-#include <babeltrace/ctf-ir/event.h>
-#include <babeltrace/ctf-ir/event-internal.h>
-#include <babeltrace/ctf-ir/event-class-internal.h>
-#include <babeltrace/ctf-ir/stream-class-internal.h>
-#include <babeltrace/ctf-ir/trace.h>
+#include <babeltrace/trace-ir/event.h>
+#include <babeltrace/trace-ir/event-internal.h>
+#include <babeltrace/trace-ir/event-class-internal.h>
+#include <babeltrace/trace-ir/stream-class-internal.h>
+#include <babeltrace/trace-ir/trace.h>
 #include <babeltrace/graph/graph-internal.h>
+#include <babeltrace/graph/private-notification-event.h>
 #include <babeltrace/graph/notification-event-internal.h>
+#include <babeltrace/graph/private-connection-private-notification-iterator.h>
 #include <babeltrace/types.h>
 #include <babeltrace/assert-internal.h>
 #include <babeltrace/assert-pre-internal.h>
+#include <babeltrace/object.h>
 #include <stdbool.h>
 #include <inttypes.h>
 
@@ -53,7 +54,8 @@ static inline bool event_class_has_trace(struct bt_event_class *event_class)
 }
 
 BT_HIDDEN
-struct bt_notification *bt_notification_event_new(struct bt_graph *graph)
+struct bt_notification *bt_notification_event_new(
+               struct bt_graph *graph)
 {
        struct bt_notification_event *notification = NULL;
 
@@ -68,20 +70,24 @@ struct bt_notification *bt_notification_event_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_event_create(
-               struct bt_graph *graph,
-               struct bt_event_class *event_class,
-               struct bt_packet *packet)
+struct bt_private_notification *bt_private_notification_event_create(
+               struct bt_private_connection_private_notification_iterator *notif_iter,
+               struct bt_private_event_class *priv_event_class,
+               struct bt_private_packet *priv_packet)
 {
+       struct bt_event_class *event_class = (void *) priv_event_class;
+       struct bt_packet *packet = (void *) priv_packet;
        struct bt_notification_event *notification = NULL;
        struct bt_event *event;
+       struct bt_graph *graph;
 
+       BT_ASSERT_PRE_NON_NULL(notif_iter, "Notification iterator");
        BT_ASSERT_PRE_NON_NULL(event_class, "Event class");
        BT_ASSERT_PRE_NON_NULL(packet, "Packet");
        BT_LOGD("Creating event notification object: "
@@ -114,6 +120,8 @@ struct bt_notification *bt_notification_event_create(
         *   to notify the graph (pool owner) so that it removes the
         *   notification from its notification array.
         */
+       graph = bt_private_connection_private_notification_iterator_borrow_graph(
+               notif_iter);
        notification = (void *) bt_notification_create_from_pool(
                &graph->event_notif_pool, graph);
        if (unlikely(!notification)) {
@@ -123,6 +131,8 @@ struct bt_notification *bt_notification_event_create(
 
        BT_ASSERT(!notification->event);
        notification->event = event;
+       bt_packet_set_is_frozen(packet, true);
+       bt_event_class_freeze(event_class);
        BT_LOGD("Created event notification object: "
                "event-addr=%p, event-class-addr=%p, "
                "event-class-name=\"%s\", event-class-id=%" PRId64 ", "
@@ -191,3 +201,10 @@ struct bt_event *bt_notification_event_borrow_event(
                        struct bt_notification_event, parent);
        return event_notification->event;
 }
+
+struct bt_private_event *bt_private_notification_event_borrow_event(
+               struct bt_private_notification *notification)
+{
+       return (void *) bt_notification_event_borrow_event(
+               (void *) notification);
+}
This page took 0.041562 seconds and 4 git commands to generate.