*/
#include <babeltrace/plugin/plugin-dev.h>
-#include <babeltrace/component/component.h>
-#include <babeltrace/component/component-filter.h>
-#include <babeltrace/component/notification/notification.h>
-#include <babeltrace/component/notification/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_component *component)
+void finalize_trimmer(struct bt_private_component *component)
{
- void *data = bt_component_get_private_data(component);
+ void *data = bt_private_component_get_user_data(component);
destroy_trimmer_data(data);
}
}
static
-enum bt_component_status init_from_params(struct trimmer *trimmer, struct bt_value *params)
+enum bt_component_status init_from_params(struct trimmer *trimmer,
+ struct bt_value *params)
{
struct bt_value *value = NULL;
bool gmt = false;
}
enum bt_component_status trimmer_component_init(
- struct bt_component *component, struct bt_value *params,
+ struct bt_private_component *component, struct bt_value *params,
UNUSED_VAR void *init_method_data)
{
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;
}
- ret = bt_component_set_private_data(component, trimmer);
+ /* 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;
}