+
+static
+enum bt_component_status text_component_init(
+ struct bt_component *component, struct bt_value *params)
+{
+ enum bt_component_status ret;
+ struct text_component *text = create_text();
+
+ if (!text) {
+ ret = BT_COMPONENT_STATUS_NOMEM;
+ goto end;
+ }
+
+ ret = bt_component_set_destroy_cb(component,
+ destroy_text);
+ if (ret != BT_COMPONENT_STATUS_OK) {
+ goto error;
+ }
+
+ ret = bt_component_set_private_data(component, text);
+ if (ret != BT_COMPONENT_STATUS_OK) {
+ goto error;
+ }
+
+ ret = bt_component_sink_set_consume_cb(component,
+ run);
+ if (ret != BT_COMPONENT_STATUS_OK) {
+ goto error;
+ }
+
+ text->out = stdout;
+ text->err = stderr;
+end:
+ return ret;
+error:
+ destroy_text_data(text);
+ return ret;
+}
+
+/* Initialize plug-in entry points. */
+BT_PLUGIN_NAME("text");
+BT_PLUGIN_DESCRIPTION("Babeltrace text output plug-in.");
+BT_PLUGIN_AUTHOR("Jérémie Galarneau");
+BT_PLUGIN_LICENSE("MIT");
+
+BT_PLUGIN_COMPONENT_CLASSES_BEGIN
+BT_PLUGIN_SINK_COMPONENT_CLASS_ENTRY("text",
+ "Formats CTF-IR to text. Formerly known as ctf-text.",
+ text_component_init)
+BT_PLUGIN_COMPONENT_CLASSES_END