*/
#include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/component/component.h>
-#include <babeltrace/component/private-component.h>
-#include <babeltrace/component/component-filter.h>
-#include <babeltrace/component/notification/notification.h>
-#include <babeltrace/component/notification/iterator.h>
-#include <babeltrace/component/notification/private-iterator.h>
-#include <babeltrace/component/notification/event.h>
+#include <babeltrace/graph/component.h>
+#include <babeltrace/graph/private-component.h>
+#include <babeltrace/graph/component-filter.h>
+#include <babeltrace/graph/notification.h>
+#include <babeltrace/graph/notification-iterator.h>
+#include <babeltrace/graph/private-notification-iterator.h>
+#include <babeltrace/graph/private-component-filter.h>
+#include <babeltrace/graph/notification-event.h>
#include <plugins-common.h>
#include "trimmer.h"
#include "iterator.h"
return trimmer;
}
-void destroy_trimmer(struct bt_private_component *component)
+void finalize_trimmer(struct bt_private_component *component)
{
void *data = bt_private_component_get_user_data(component);
{
enum bt_component_status ret;
struct trimmer *trimmer = create_trimmer_data();
+ struct bt_private_port *priv_port = NULL;
if (!trimmer) {
ret = BT_COMPONENT_STATUS_NOMEM;
goto end;
}
+ /* Create input and output ports */
+ priv_port = bt_private_component_filter_add_input_private_port(
+ component, "in", NULL);
+ if (!priv_port) {
+ goto error;
+ }
+
+ bt_put(priv_port);
+ priv_port = bt_private_component_filter_add_output_private_port(
+ component, "out", NULL);
+ if (!priv_port) {
+ goto error;
+ }
+
ret = bt_private_component_set_user_data(component, trimmer);
if (ret != BT_COMPONENT_STATUS_OK) {
goto error;
ret = init_from_params(trimmer, params);
end:
+ bt_put(priv_port);
return ret;
error:
destroy_trimmer_data(trimmer);
+ ret = BT_COMPONENT_STATUS_ERROR;
return ret;
}