X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=plugins%2Futils%2Fdummy%2Fdummy.c;h=59d851521ab5e4af8dc6cdc7b4b5c5749cea447e;hb=68b66a256a54d32992dfefeaad11eea88b7df234;hp=2c259156cee3ba736be8c185ecd30823594c178f;hpb=05e2128659970c32648a01255ed870449f05d518;p=babeltrace.git diff --git a/plugins/utils/dummy/dummy.c b/plugins/utils/dummy/dummy.c index 2c259156..59d85152 100644 --- a/plugins/utils/dummy/dummy.c +++ b/plugins/utils/dummy/dummy.c @@ -20,21 +20,24 @@ * SOFTWARE. */ -#include -#include +#include +#include #include -#include +#include #include "dummy.h" +static +const char * const in_port_name = "in"; + void destroy_private_dummy_data(struct dummy *dummy) { - bt_object_put_ref(dummy->notif_iter); + bt_self_component_port_input_message_iterator_put_ref(dummy->msg_iter); g_free(dummy); } BT_HIDDEN -void dummy_finalize(struct bt_self_component_sink *comp) +void dummy_finalize(bt_self_component_sink *comp) { struct dummy *dummy; @@ -46,12 +49,12 @@ void dummy_finalize(struct bt_self_component_sink *comp) } BT_HIDDEN -enum bt_self_component_status dummy_init( - struct bt_self_component_sink *component, - const struct bt_value *params, +bt_self_component_status dummy_init( + bt_self_component_sink *component, + const bt_value *params, UNUSED_VAR void *init_method_data) { - enum bt_self_component_status ret; + bt_self_component_status ret; struct dummy *dummy = g_new0(struct dummy, 1); if (!dummy) { @@ -77,73 +80,73 @@ end: } BT_HIDDEN -enum bt_self_component_status dummy_port_connected( - struct bt_self_component_sink *comp, - struct bt_self_component_port_input *self_port, - struct bt_port_output *other_port) +bt_self_component_status dummy_graph_is_configured( + bt_self_component_sink *comp) { - enum bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; + bt_self_component_status status = BT_SELF_COMPONENT_STATUS_OK; struct dummy *dummy; - struct bt_self_component_port_input_notification_iterator *iterator; + bt_self_component_port_input_message_iterator *iterator; dummy = bt_self_component_get_data( bt_self_component_sink_as_self_component(comp)); BT_ASSERT(dummy); - iterator = bt_self_component_port_input_notification_iterator_create( - self_port); + iterator = bt_self_component_port_input_message_iterator_create( + bt_self_component_sink_borrow_input_port_by_name(comp, + in_port_name)); if (!iterator) { status = BT_SELF_COMPONENT_STATUS_NOMEM; goto end; } - BT_OBJECT_MOVE_REF(dummy->notif_iter, iterator); + BT_SELF_COMPONENT_PORT_INPUT_MESSAGE_ITERATOR_MOVE_REF( + dummy->msg_iter, iterator); end: return status; } BT_HIDDEN -enum bt_self_component_status dummy_consume( - struct bt_self_component_sink *component) +bt_self_component_status dummy_consume( + bt_self_component_sink *component) { - enum bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK; - bt_notification_array notifs; + bt_self_component_status ret = BT_SELF_COMPONENT_STATUS_OK; + bt_message_array_const msgs; uint64_t count; struct dummy *dummy; - enum bt_notification_iterator_status it_ret; + bt_message_iterator_status it_ret; uint64_t i; dummy = bt_self_component_get_data( bt_self_component_sink_as_self_component(component)); BT_ASSERT(dummy); - if (unlikely(!dummy->notif_iter)) { + if (unlikely(!dummy->msg_iter)) { ret = BT_SELF_COMPONENT_STATUS_END; goto end; } - /* Consume one notification */ - it_ret = bt_self_component_port_input_notification_iterator_next( - dummy->notif_iter, ¬ifs, &count); + /* Consume one message */ + it_ret = bt_self_component_port_input_message_iterator_next( + dummy->msg_iter, &msgs, &count); switch (it_ret) { - case BT_NOTIFICATION_ITERATOR_STATUS_OK: + case BT_MESSAGE_ITERATOR_STATUS_OK: ret = BT_SELF_COMPONENT_STATUS_OK; for (i = 0; i < count; i++) { - bt_object_put_ref(notifs[i]); + bt_message_put_ref(msgs[i]); } break; - case BT_NOTIFICATION_ITERATOR_STATUS_AGAIN: + case BT_MESSAGE_ITERATOR_STATUS_AGAIN: ret = BT_SELF_COMPONENT_STATUS_AGAIN; goto end; - case BT_NOTIFICATION_ITERATOR_STATUS_END: + case BT_MESSAGE_ITERATOR_STATUS_END: ret = BT_SELF_COMPONENT_STATUS_END; goto end; - case BT_NOTIFICATION_ITERATOR_STATUS_ERROR: + case BT_MESSAGE_ITERATOR_STATUS_ERROR: ret = BT_SELF_COMPONENT_STATUS_ERROR; goto end; - case BT_NOTIFICATION_ITERATOR_STATUS_NOMEM: + case BT_MESSAGE_ITERATOR_STATUS_NOMEM: ret = BT_SELF_COMPONENT_STATUS_NOMEM; goto end; default: