From 38d02a17cb959fe5cda3ef5c5522ebee3b9a50b3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=A9mie=20Galarneau?= Date: Thu, 21 May 2015 15:59:16 -0400 Subject: [PATCH] Build system: build reader plug-in stub MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérémie Galarneau --- configure.ac | 2 ++ include/babeltrace/plugin/plugin-internal.h | 1 + include/babeltrace/plugin/plugin-lib.h | 2 +- include/babeltrace/plugin/plugin.h | 2 +- plugins/Makefile.am | 3 +-- plugins/ctf/ctf-reader/reader.c | 18 ++---------------- plugins/plugin.c | 13 +++++++++++++ 7 files changed, 21 insertions(+), 20 deletions(-) diff --git a/configure.ac b/configure.ac index f680a8b4..30147db1 100644 --- a/configure.ac +++ b/configure.ac @@ -370,6 +370,8 @@ AC_CONFIG_FILES([ extras/Makefile extras/valgrind/Makefile plugins/Makefile + plugins/ctf/Makefile + plugins/ctf/ctf-reader/Makefile babeltrace.pc babeltrace-ctf.pc ]) diff --git a/include/babeltrace/plugin/plugin-internal.h b/include/babeltrace/plugin/plugin-internal.h index a0ed98d9..22d50abe 100644 --- a/include/babeltrace/plugin/plugin-internal.h +++ b/include/babeltrace/plugin/plugin-internal.h @@ -32,6 +32,7 @@ #include #include #include +#include #ifdef __cplusplus extern "C" { diff --git a/include/babeltrace/plugin/plugin-lib.h b/include/babeltrace/plugin/plugin-lib.h index dc0cde03..bea8665a 100644 --- a/include/babeltrace/plugin/plugin-lib.h +++ b/include/babeltrace/plugin/plugin-lib.h @@ -28,7 +28,7 @@ */ #include -#include +#include #include #ifdef __cplusplus diff --git a/include/babeltrace/plugin/plugin.h b/include/babeltrace/plugin/plugin.h index 77204d9d..d0816261 100644 --- a/include/babeltrace/plugin/plugin.h +++ b/include/babeltrace/plugin/plugin.h @@ -27,7 +27,7 @@ * SOFTWARE. */ -#include +#include #ifdef __cplusplus extern "C" { diff --git a/plugins/Makefile.am b/plugins/Makefile.am index 5ef531e1..271190b8 100644 --- a/plugins/Makefile.am +++ b/plugins/Makefile.am @@ -1,6 +1,6 @@ AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include -SUBDIRS = . +SUBDIRS = . ctf lib_LTLIBRARIES = libbabeltrace-plugin.la @@ -17,4 +17,3 @@ libbabeltrace_plugin_la_LDFLAGS = \ libbabeltrace_plugin_la_LIBADD = \ $(top_builddir)/lib/libbabeltrace.la - $(top_builddir)/ctf/ir/libctf-ir.la diff --git a/plugins/ctf/ctf-reader/reader.c b/plugins/ctf/ctf-reader/reader.c index f839f9b0..5802b8b0 100644 --- a/plugins/ctf/ctf-reader/reader.c +++ b/plugins/ctf/ctf-reader/reader.c @@ -28,6 +28,7 @@ #include #include +#include #include #include @@ -73,35 +74,20 @@ struct bt_notification_iterator *ctf_reader_iterator_create( 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; } diff --git a/plugins/plugin.c b/plugins/plugin.c index 15f55a7f..1f5a6bbd 100644 --- a/plugins/plugin.c +++ b/plugins/plugin.c @@ -135,6 +135,19 @@ 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) { -- 2.34.1