AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
-SUBDIRS = .
+SUBDIRS = . ctf
lib_LTLIBRARIES = libbabeltrace-plugin.la
libbabeltrace_plugin_la_LIBADD = \
$(top_builddir)/lib/libbabeltrace.la
- $(top_builddir)/ctf/ir/libctf-ir.la
#include <babeltrace/plugin/plugin-lib.h>
#include <babeltrace/plugin/plugin-system.h>
+#include <babeltrace/plugin/plugin.h>
#include <glib.h>
#include <stdio.h>
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;
+ g_free(reader);
}
goto end;
}
return ret;
}
+void *bt_plugin_get_private_data(struct bt_plugin *plugin)
+{
+ void *ret = NULL;
+
+ if (!plugin) {
+ goto end;
+ }
+
+ ret = plugin->user_data;
+end:
+ return ret;
+}
+
static
void bt_plugin_destroy(struct bt_ctf_ref *ref)
{