#endif
struct bt_notification;
+struct bt_private_connection_private_notification_iterator;
struct bt_event;
struct bt_event_class;
extern
-struct bt_notification *bt_notification_event_create(struct bt_graph *graph,
+struct bt_notification *bt_notification_event_create(
+ struct bt_private_connection_private_notification_iterator *notification_iterator,
struct bt_event_class *event_class, struct bt_packet *packet);
extern struct bt_event *bt_notification_event_borrow_event(
#endif
struct bt_notification;
+struct bt_private_connection_private_notification_iterator;
struct bt_clock_value;
struct bt_clock_class;
extern
struct bt_notification *bt_notification_inactivity_create(
- struct bt_graph *graph);
+ struct bt_private_connection_private_notification_iterator *notification_iterator);
extern int bt_notification_inactivity_set_clock_value(
struct bt_notification *notif,
#endif
struct bt_notification;
+struct bt_private_connection_private_notification_iterator;
struct bt_packet;
extern
struct bt_notification *bt_notification_packet_begin_create(
- struct bt_graph *graph, struct bt_packet *packet);
+ struct bt_private_connection_private_notification_iterator *notification_iterator,
+ struct bt_packet *packet);
extern
struct bt_notification *bt_notification_packet_end_create(
- struct bt_graph *graph, struct bt_packet *packet);
+ struct bt_private_connection_private_notification_iterator *notification_iterator,
+ struct bt_packet *packet);
extern struct bt_packet *bt_notification_packet_begin_borrow_packet(
#endif
struct bt_notification;
+struct bt_private_connection_private_notification_iterator;
struct bt_clock_class;
struct bt_clock_value;
struct bt_stream;
extern
struct bt_notification *bt_notification_stream_begin_create(
- struct bt_graph *graph,
+ struct bt_private_connection_private_notification_iterator *notification_iterator,
struct bt_stream *stream);
extern
struct bt_notification *bt_notification_stream_end_create(
- struct bt_graph *graph,
+ struct bt_private_connection_private_notification_iterator *notification_iterator,
struct bt_stream *stream);
extern struct bt_stream *bt_notification_stream_begin_borrow_stream(
#include <babeltrace/ctf-ir/trace.h>
#include <babeltrace/graph/graph-internal.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>
}
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;
}
struct bt_notification *bt_notification_event_create(
- struct bt_graph *graph,
+ struct bt_private_connection_private_notification_iterator *notif_iter,
struct bt_event_class *event_class,
struct bt_packet *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: "
* 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)) {
#include <babeltrace/ctf-ir/clock-value-internal.h>
#include <babeltrace/graph/notification-internal.h>
#include <babeltrace/graph/notification-inactivity-internal.h>
+#include <babeltrace/graph/private-connection-private-notification-iterator.h>
#include <babeltrace/assert-pre-internal.h>
static
}
struct bt_notification *bt_notification_inactivity_create(
- struct bt_graph *graph)
+ struct bt_private_connection_private_notification_iterator *notif_iter)
{
struct bt_notification_inactivity *notification;
struct bt_notification *ret_notif = NULL;
#include <babeltrace/ctf-ir/stream-internal.h>
#include <babeltrace/graph/graph-internal.h>
#include <babeltrace/graph/notification-packet-internal.h>
+#include <babeltrace/graph/private-connection-private-notification-iterator.h>
#include <babeltrace/assert-internal.h>
#include <babeltrace/assert-pre-internal.h>
#include <babeltrace/object-internal.h>
}
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_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);
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) {
}
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_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);
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) {
#include <babeltrace/ctf-ir/stream-internal.h>
#include <babeltrace/ctf-ir/stream-class.h>
#include <babeltrace/graph/notification-stream-internal.h>
+#include <babeltrace/graph/private-connection-private-notification-iterator.h>
#include <babeltrace/assert-internal.h>
#include <inttypes.h>
}
struct bt_notification *bt_notification_stream_end_create(
- struct bt_graph *graph, struct bt_stream *stream)
+ struct bt_private_connection_private_notification_iterator *notif_iter,
+ struct bt_stream *stream)
{
struct bt_notification_stream_end *notification;
struct bt_stream_class *stream_class;
}
struct bt_notification *bt_notification_stream_begin_create(
- struct bt_graph *graph, struct bt_stream *stream)
+ struct bt_private_connection_private_notification_iterator *notif_iter,
+ struct bt_stream *stream)
{
int ret;
struct bt_notification_stream_begin *notification;
/* Visit stack */
struct stack *stack;
- /* Current graph to create notifications (weak) */
- struct bt_graph *graph;
+ /* Current notification iterator to create notifications (weak) */
+ struct bt_private_connection_private_notification_iterator *notif_iter;
/*
* Current dynamic scope field pointer.
notit, notit->meta.event_class,
bt_event_class_get_name(notit->meta.event_class),
notit->packet);
- BT_ASSERT(notit->graph);
- notif = bt_notification_event_create(notit->graph,
+ BT_ASSERT(notit->notif_iter);
+ notif = bt_notification_event_create(notit->notif_iter,
notit->meta.event_class, notit->packet);
if (!notif) {
BT_LOGE("Cannot create event notification: "
}
BT_ASSERT(notit->stream);
- BT_ASSERT(notit->graph);
- ret = bt_notification_stream_begin_create(notit->graph, notit->stream);
+ BT_ASSERT(notit->notif_iter);
+ ret = bt_notification_stream_begin_create(notit->notif_iter,
+ notit->stream);
if (!ret) {
BT_LOGE("Cannot create stream beginning notification: "
"notit-addr=%p, stream-addr=%p",
return;
}
- BT_ASSERT(notit->graph);
- ret = bt_notification_stream_end_create(notit->graph, notit->stream);
+ BT_ASSERT(notit->notif_iter);
+ ret = bt_notification_stream_end_create(notit->notif_iter,
+ notit->stream);
if (!ret) {
BT_LOGE("Cannot create stream beginning notification: "
"notit-addr=%p, stream-addr=%p",
}
}
- BT_ASSERT(notit->graph);
- notif = bt_notification_packet_begin_create(notit->graph,
+ BT_ASSERT(notit->notif_iter);
+ notif = bt_notification_packet_begin_create(notit->notif_iter,
notit->packet);
if (!notif) {
BT_LOGE("Cannot create packet beginning notification: "
return;
}
- BT_ASSERT(notit->graph);
- notif = bt_notification_packet_end_create(notit->graph, notit->packet);
+ BT_ASSERT(notit->notif_iter);
+ notif = bt_notification_packet_end_create(notit->notif_iter,
+ notit->packet);
if (!notif) {
BT_LOGE("Cannot create packet end notification: "
"notit-addr=%p, packet-addr=%p",
enum bt_notif_iter_status bt_notif_iter_get_next_notification(
struct bt_notif_iter *notit,
- struct bt_graph *graph,
+ struct bt_private_connection_private_notification_iterator *notif_iter,
struct bt_notification **notification)
{
int ret;
goto end;
}
- notit->graph = graph;
+ notit->notif_iter = notif_iter;
BT_LOGV("Getting next notification: notit-addr=%p", notit);
BT_HIDDEN
enum bt_notif_iter_status bt_notif_iter_get_next_notification(
struct bt_notif_iter *notit,
- struct bt_graph *graph,
+ struct bt_private_connection_private_notification_iterator *notif_iter,
struct bt_notification **notification);
/**
BT_HIDDEN
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
- struct bt_graph *graph, struct bt_notif_iter *notif_iter,
+ struct bt_private_connection_private_notification_iterator *pc_notif_iter,
+ struct bt_notif_iter *notif_iter,
struct bt_stream *stream, const char *path)
{
int ret;
goto error;
}
- ds_file->graph = graph;
+ ds_file->pc_notif_iter = pc_notif_iter;
ds_file->file = ctf_fs_file_create();
if (!ds_file->file) {
goto error;
enum bt_notification_iterator_status status;
notif_iter_status = bt_notif_iter_get_next_notification(
- ds_file->notif_iter, ds_file->graph, notif);
+ ds_file->notif_iter, ds_file->pc_notif_iter, notif);
switch (notif_iter_status) {
case BT_NOTIF_ITER_STATUS_EOF:
struct ctf_fs_ds_file {
/* Weak */
- struct bt_graph *graph;
+ struct bt_private_connection_private_notification_iterator *pc_notif_iter;
/* Owned by this */
struct ctf_fs_file *file;
BT_HIDDEN
struct ctf_fs_ds_file *ctf_fs_ds_file_create(
struct ctf_fs_trace *ctf_fs_trace,
- struct bt_graph *graph,
+ struct bt_private_connection_private_notification_iterator *pc_notif_iter,
struct bt_notif_iter *notif_iter,
struct bt_stream *stream, const char *path);
ctf_fs_ds_file_destroy(notif_iter_data->ds_file);
notif_iter_data->ds_file = ctf_fs_ds_file_create(
notif_iter_data->ds_file_group->ctf_fs_trace,
- notif_iter_data->graph,
+ notif_iter_data->pc_notif_iter,
notif_iter_data->notif_iter,
notif_iter_data->ds_file_group->stream,
ds_file_info->path->str);
goto error;
}
- notif_iter_data->graph = bt_component_borrow_graph(
- bt_component_borrow_from_private(port_data->ctf_fs->priv_comp));
+ notif_iter_data->pc_notif_iter = it;
notif_iter_data->notif_iter = bt_notif_iter_create(
port_data->ds_file_group->ctf_fs_trace->metadata->trace,
bt_common_get_page_size() * 8,
goto error;
}
- ds_file = ctf_fs_ds_file_create(ctf_fs_trace, graph, notif_iter,
+ ds_file = ctf_fs_ds_file_create(ctf_fs_trace, NULL, notif_iter,
NULL, path);
if (!ds_file) {
goto error;
struct ctf_fs_notif_iter_data {
/* Weak */
- struct bt_graph *graph;
+ struct bt_private_connection_private_notification_iterator *pc_notif_iter;
/* Weak, belongs to ctf_fs_trace */
struct ctf_fs_ds_file_group *ds_file_group;
struct dmesg_notif_iter {
struct dmesg_component *dmesg_comp;
+ struct bt_private_connection_private_notification_iterator *pc_notif_iter; /* Weak */
char *linebuf;
size_t linebuf_len;
FILE *fp;
bt_bool no_timestamp;
} params;
- struct bt_graph *graph; /* Weak */
struct bt_trace *trace;
struct bt_stream_class *stream_class;
struct bt_event_class *event_class;
goto error;
}
- dmesg_comp->graph = bt_component_borrow_graph(
- bt_component_borrow_from_private(priv_comp));
- BT_ASSERT(dmesg_comp->graph);
dmesg_comp->params.path = g_string_new(NULL);
if (!dmesg_comp->params.path) {
BT_LOGE_STR("Failed to allocate a GString.");
static
struct bt_notification *create_init_event_notif_from_line(
- struct dmesg_component *dmesg_comp,
+ struct dmesg_notif_iter *notif_iter,
const char *line, const char **new_start)
{
struct bt_event *event;
struct bt_field *eh_field = NULL;
struct bt_field *ts_field = NULL;
int ret = 0;
+ struct dmesg_component *dmesg_comp = notif_iter->dmesg_comp;
*new_start = line;
goto error;
}
- notif = bt_notification_event_create(dmesg_comp->graph,
+ notif = bt_notification_event_create(notif_iter->pc_notif_iter,
dmesg_comp->event_class, dmesg_comp->packet);
if (!notif) {
BT_LOGE_STR("Cannot create event notification.");
}
static
-int fill_event_payload_from_line(struct dmesg_component *dmesg_comp,
- const char *line, struct bt_event *event)
+int fill_event_payload_from_line(const char *line, struct bt_event *event)
{
struct bt_field *ep_field = NULL;
struct bt_field *str_field = NULL;
static
struct bt_notification *create_notif_from_line(
- struct dmesg_component *dmesg_comp, const char *line)
+ struct dmesg_notif_iter *dmesg_notif_iter, const char *line)
{
struct bt_event *event = NULL;
struct bt_notification *notif = NULL;
const char *new_start;
int ret;
- notif = create_init_event_notif_from_line(dmesg_comp, line, &new_start);
+ notif = create_init_event_notif_from_line(dmesg_notif_iter,
+ line, &new_start);
if (!notif) {
BT_LOGE_STR("Cannot create and initialize event notification from line.");
goto error;
event = bt_notification_event_borrow_event(notif);
BT_ASSERT(event);
- ret = fill_event_payload_from_line(dmesg_comp, new_start,
- event);
+ ret = fill_event_payload_from_line(new_start, event);
if (ret) {
BT_LOGE("Cannot fill event payload field from line: "
"ret=%d", ret);
dmesg_comp = bt_private_component_get_user_data(priv_comp);
BT_ASSERT(dmesg_comp);
dmesg_notif_iter->dmesg_comp = dmesg_comp;
+ dmesg_notif_iter->pc_notif_iter = priv_notif_iter;
if (dmesg_comp->params.read_from_stdin) {
dmesg_notif_iter->fp = stdin;
}
}
- dmesg_notif_iter->tmp_event_notif = create_notif_from_line(dmesg_comp,
- dmesg_notif_iter->linebuf);
+ dmesg_notif_iter->tmp_event_notif = create_notif_from_line(
+ dmesg_notif_iter, dmesg_notif_iter->linebuf);
if (!dmesg_notif_iter->tmp_event_notif) {
BT_LOGE("Cannot create event notification from line: "
"dmesg-comp-addr=%p, line=\"%s\"", dmesg_comp,
case STATE_EMIT_STREAM_BEGINNING:
BT_ASSERT(dmesg_notif_iter->tmp_event_notif);
*notif = bt_notification_stream_begin_create(
- dmesg_comp->graph, dmesg_comp->stream);
+ dmesg_notif_iter->pc_notif_iter, 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);
*notif = bt_notification_packet_begin_create(
- dmesg_comp->graph, dmesg_comp->packet);
+ dmesg_notif_iter->pc_notif_iter, dmesg_comp->packet);
dmesg_notif_iter->state = STATE_EMIT_EVENT;
break;
case STATE_EMIT_EVENT:
break;
case STATE_EMIT_PACKET_END:
*notif = bt_notification_packet_end_create(
- dmesg_comp->graph, dmesg_comp->packet);
+ dmesg_notif_iter->pc_notif_iter, dmesg_comp->packet);
dmesg_notif_iter->state = STATE_EMIT_STREAM_END;
break;
case STATE_EMIT_STREAM_END:
*notif = bt_notification_stream_end_create(
- dmesg_comp->graph, dmesg_comp->stream);
+ dmesg_notif_iter->pc_notif_iter, dmesg_comp->stream);
dmesg_notif_iter->state = STATE_DONE;
break;
default:
static enum test current_test;
static GArray *test_events;
static struct bt_graph *graph;
+static struct bt_private_connection_private_notification_iterator *cur_notif_iter;
static struct bt_stream_class *src_stream_class;
static struct bt_event_class *src_event_class;
static struct bt_stream *src_stream1;
switch (user_data->seq[user_data->at]) {
case SEQ_INACTIVITY:
- *notif = bt_notification_inactivity_create(graph);
+ *notif = bt_notification_inactivity_create(cur_notif_iter);
break;
case SEQ_STREAM1_BEGIN:
- *notif = bt_notification_stream_begin_create(graph,
+ *notif = bt_notification_stream_begin_create(cur_notif_iter,
src_stream1);
break;
case SEQ_STREAM2_BEGIN:
- *notif = bt_notification_stream_begin_create(graph,
+ *notif = bt_notification_stream_begin_create(cur_notif_iter,
src_stream2);
break;
case SEQ_STREAM1_END:
- *notif = bt_notification_stream_end_create(graph, src_stream1);
+ *notif = bt_notification_stream_end_create(cur_notif_iter,
+ src_stream1);
break;
case SEQ_STREAM2_END:
- *notif = bt_notification_stream_end_create(graph, src_stream2);
+ *notif = bt_notification_stream_end_create(cur_notif_iter,
+ src_stream2);
break;
case SEQ_STREAM1_PACKET1_BEGIN:
- *notif = bt_notification_packet_begin_create(graph,
+ *notif = bt_notification_packet_begin_create(cur_notif_iter,
src_stream1_packet1);
break;
case SEQ_STREAM1_PACKET2_BEGIN:
- *notif = bt_notification_packet_begin_create(graph,
+ *notif = bt_notification_packet_begin_create(cur_notif_iter,
src_stream1_packet2);
break;
case SEQ_STREAM2_PACKET1_BEGIN:
- *notif = bt_notification_packet_begin_create(graph,
+ *notif = bt_notification_packet_begin_create(cur_notif_iter,
src_stream2_packet1);
break;
case SEQ_STREAM2_PACKET2_BEGIN:
- *notif = bt_notification_packet_begin_create(graph,
+ *notif = bt_notification_packet_begin_create(cur_notif_iter,
src_stream2_packet2);
break;
case SEQ_STREAM1_PACKET1_END:
- *notif = bt_notification_packet_end_create(graph,
+ *notif = bt_notification_packet_end_create(cur_notif_iter,
src_stream1_packet1);
break;
case SEQ_STREAM1_PACKET2_END:
- *notif = bt_notification_packet_end_create(graph,
+ *notif = bt_notification_packet_end_create(cur_notif_iter,
src_stream1_packet2);
break;
case SEQ_STREAM2_PACKET1_END:
- *notif = bt_notification_packet_end_create(graph,
+ *notif = bt_notification_packet_end_create(cur_notif_iter,
src_stream2_packet1);
break;
case SEQ_STREAM2_PACKET2_END:
- *notif = bt_notification_packet_end_create(graph,
+ *notif = bt_notification_packet_end_create(cur_notif_iter,
src_stream2_packet2);
break;
case SEQ_EVENT_STREAM1_PACKET1:
}
if (event_packet) {
- *notif = bt_notification_event_create(graph, src_event_class,
- event_packet);
+ *notif = bt_notification_event_create(cur_notif_iter,
+ src_event_class, event_packet);
}
BT_ASSERT(*notif);
bt_private_connection_private_notification_iterator_get_user_data(priv_iterator);
BT_ASSERT(user_data);
+ cur_notif_iter = priv_iterator;
return src_iter_next_seq(user_data, notifs, capacity, count);
}
static enum test current_test;
static GArray *test_events;
static struct bt_graph *graph;
+static struct bt_private_connection_private_notification_iterator *cur_notif_iter;
static struct bt_clock_class *src_clock_class;
static struct bt_stream_class *src_stream_class;
static struct bt_event_class *src_event_class;
struct bt_notification *notif;
struct bt_field *field;
- notif = bt_notification_event_create(graph, src_event_class, packet);
+ notif = bt_notification_event_create(cur_notif_iter,
+ src_event_class, packet);
BT_ASSERT(notif);
event = bt_notification_event_borrow_event(notif);
BT_ASSERT(event);
status = BT_NOTIFICATION_ITERATOR_STATUS_AGAIN;
break;
case SEQ_PACKET_BEGIN:
- notifs[0] = bt_notification_packet_begin_create(graph,
+ notifs[0] = bt_notification_packet_begin_create(cur_notif_iter,
user_data->packet);
BT_ASSERT(notifs[0]);
break;
case SEQ_PACKET_END:
- notifs[0] = bt_notification_packet_end_create(graph,
+ notifs[0] = bt_notification_packet_end_create(cur_notif_iter,
user_data->packet);
BT_ASSERT(notifs[0]);
break;
case SEQ_STREAM_BEGIN:
stream = bt_packet_get_stream(user_data->packet);
- notifs[0] = bt_notification_stream_begin_create(graph, stream);
+ notifs[0] = bt_notification_stream_begin_create(cur_notif_iter,
+ stream);
BT_ASSERT(notifs[0]);
bt_put(stream);
break;
case SEQ_STREAM_END:
stream = bt_packet_get_stream(user_data->packet);
- notifs[0] = bt_notification_stream_end_create(graph, stream);
+ notifs[0] = bt_notification_stream_end_create(cur_notif_iter,
+ stream);
BT_ASSERT(notifs[0]);
bt_put(stream);
break;
BT_ASSERT(user_data);
BT_ASSERT(private_component);
+ cur_notif_iter = priv_iterator;
/*
* We can always set it to 1: it's not going to be considered
stream = bt_packet_get_stream(user_data->packet);
notifs[0] =
bt_notification_stream_begin_create(
- graph, stream);
+ cur_notif_iter, stream);
bt_put(stream);
BT_ASSERT(notifs[0]);
} else if (user_data->at == 1) {
notifs[0] =
bt_notification_packet_begin_create(
- graph, user_data->packet);
+ cur_notif_iter,
+ user_data->packet);
BT_ASSERT(notifs[0]);
} else if (user_data->at < 7) {
notifs[0] =
} else if (user_data->at == 7) {
notifs[0] =
bt_notification_packet_end_create(
- graph, user_data->packet);
+ cur_notif_iter,
+ user_data->packet);
BT_ASSERT(notifs[0]);
} else if (user_data->at == 8) {
stream = bt_packet_get_stream(user_data->packet);
notifs[0] =
bt_notification_stream_end_create(
- graph, stream);
+ cur_notif_iter, stream);
bt_put(stream);
BT_ASSERT(notifs[0]);
} else {