+struct bt_plugin *bt_plugin_lib_create(struct bt_object *params)
+{
+ enum bt_plugin_status ret;
+ struct bt_plugin *plugin = NULL;
+ struct ctf_reader *reader = g_new0(struct ctf_reader, 1);
+
+ if (!reader) {
+ goto error;
+ }
+
+ plugin = bt_plugin_source_create(plugin_name, reader,
+ ctf_reader_destroy, ctf_reader_iterator_create);
+ if (!plugin) {
+ goto error;
+ }
+ reader = NULL;
+
+ ret = bt_plugin_set_error_stream_cb(plugin,
+ ctf_reader_set_error_stream);
+ if (ret != BT_PLUGIN_STATUS_OK) {
+ goto error;
+ }
+end:
+ return plugin;
+error:
+ if (reader) {
+ ctf_reader_destroy(reader);
+ }
+ if (plugin) {
+ bt_plugin_put(plugin);
+ plugin = NULL;
+ }
+ goto end;
+}