Add base plug-in skeletons
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 24 Feb 2016 00:49:04 +0000 (19:49 -0500)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 16:57:26 +0000 (12:57 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
21 files changed:
configure.ac
include/babeltrace/plugin/component-class.h
include/babeltrace/plugin/component.h
include/babeltrace/plugin/plugin-macros.h
include/babeltrace/plugin/plugin.h
include/babeltrace/plugin/sink.h
include/babeltrace/plugin/source.h
plugins/Makefile.am
plugins/ctf/Makefile.am
plugins/ctf/live/live.c [deleted file]
plugins/ctf/lttng-live/Makefile.am [new file with mode: 0644]
plugins/ctf/lttng-live/lttng-live-internal.h [new file with mode: 0644]
plugins/ctf/lttng-live/lttng-live.c [new file with mode: 0644]
plugins/ctf/reader/Makefile.am
plugins/ctf/reader/reader-internal.h
plugins/ctf/reader/reader.c
plugins/ctf/symbols.c [new file with mode: 0644]
plugins/ctf/text/Makefile.am [deleted file]
plugins/ctf/text/text.c [deleted file]
plugins/text/Makefile.am [new file with mode: 0644]
plugins/text/text.c [new file with mode: 0644]

index 6acf1deb6d24dcb76e170cb2f888d1c93e4984c9..d5aa005b1c9a9187bdbcfed1e004081e4b93bc1e 100644 (file)
@@ -372,7 +372,8 @@ AC_CONFIG_FILES([
        plugins/Makefile
        plugins/ctf/Makefile
        plugins/ctf/reader/Makefile
-       plugins/ctf/text/Makefile
+       plugins/ctf/lttng-live/Makefile
+       plugins/text/Makefile
        babeltrace.pc
        babeltrace-ctf.pc
 ])
index a882668120687f0314eddb9435e61264621b07e1..1526e4cb810042f63d0d24635780bd5739971041 100644 (file)
@@ -67,7 +67,7 @@ extern const char *bt_component_class_get_name(
  * @param component_class      Component class of which to get the description
  * @returns                    Description of the component class, or NULL.
  */
-extern const char *bt_component_class_get_name(
+extern const char *bt_component_class_get_description(
                struct bt_component_class *component_class);
 
 /**
index 53684dbd1924b9337bb922eb65ae56e5a55cda87..5dc0e3903ac5186f25590b63dadc9a04ad66165d 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <babeltrace/plugin/component-class.h>
+#include <babeltrace/values.h>
 #include <stdio.h>
 
 #ifdef __cplusplus
index 56916f7144c5eba5596a9bfa07276fce57214ea2..26c3ebc35e8e91341fe14ee3b65881c5a37c533b 100644 (file)
@@ -39,9 +39,9 @@
 #define BT_PLUGIN_INIT(_x)             bt_plugin_init_func __bt_plugin_init = (_x)
 #define BT_PLUGIN_EXIT(_x)             bt_plugin_exit_func __bt_plugin_exit = (_x)
 
-#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN                              \
-       enum bt_component_status __bt_plugin_register_component_classes(\
-               struct bt_component_factory *factory)                   \
+#define BT_PLUGIN_COMPONENT_CLASSES_BEGIN                                      \
+       static enum bt_component_status __bt_plugin_register_component_classes( \
+               struct bt_component_factory *factory)                           \
        {
 
 #define BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(_name, description, _init)      \
        bt_component_factory_register_sink_component_class(factory,             \
                        _name, _description, _init);
 
-#define BT_PLUGIN_COMPONENT_CLASSES_END\
-       \
-       return BT_COMPONENT_STATUS_OK;\
-}\
-       \
-       BT_PLUGIN_INIT(__bt_plugin_register_component_classes);\
+#define BT_PLUGIN_COMPONENT_CLASSES_END                                                \
+       return BT_COMPONENT_STATUS_OK;                                          \
+}                                                                              \
+                                                                               \
+       BT_PLUGIN_INIT(__bt_plugin_register_component_classes);                 \
 
 #endif /* BABELTRACE_PLUGIN_MACROS_H */
index e5c69eed941bca37bff90aeebfac93249686d468..8eec84e552e4fb92e456cd6befa33b8865efb6f7 100644 (file)
@@ -57,6 +57,14 @@ extern const char *bt_plugin_get_author(struct bt_plugin *plugin);
  */
 extern const char *bt_plugin_get_license(struct bt_plugin *plugin);
 
+/**
+ * Get the decription of a plug-in.
+ *
+ * @param plugin       An instance of a plug-in
+ * @returns            Plug-in description or NULL if none is available
+ */
+extern const char *bt_plugin_get_description(struct bt_plugin *plugin);
+
 /**
  * Get the path of a plug-in.
  *
index 5f188d33e80eff7a1c3411458a33c85e1c2dfc14..ae563f676e39f3bec83f890a1dcd95419ab04157 100644 (file)
@@ -27,6 +27,8 @@
  * SOFTWARE.
  */
 
+#include <babeltrace/plugin/component.h>
+
 #ifdef __cplusplus
 extern "C" {
 #endif
index 13faedd0a5ffd0266dcfe1f64a5040d807be3e40..7329eeebe9bd927d97923484df0eb6c2ba20dcc1 100644 (file)
@@ -28,6 +28,7 @@
  */
 
 #include <stdint.h>
+#include <babeltrace/plugin/component.h>
 
 #ifdef __cplusplus
 extern "C" {
index 29226a301ca4f1181674895571100c985cc45547..28bd175d3021df7dc9bfdfb7020da80e1a7df814 100644 (file)
@@ -1,6 +1,6 @@
 AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
 
-SUBDIRS = . ctf
+SUBDIRS = . ctf text
 
 lib_LTLIBRARIES = libbabeltrace-plugin.la
 
index b43d126e6728c083a62d4109b5f512d1fb8b629c..e916b160eba1416895f6051f406ca5690d10e2c6 100644 (file)
@@ -1,3 +1,20 @@
 AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
 
-SUBDIRS = text
+SUBDIRS = reader lttng-live
+
+lib_LTLIBRARIES = libbabeltrace-plugin-ctf.la
+
+# Plug-in system library
+libbabeltrace_plugin_ctf_la_SOURCES = symbols.c
+
+# Request that the linker keeps all static library objects.
+libbabeltrace_plugin_ctf_la_LDFLAGS = \
+       $(LD_NO_AS_NEEDED) -version-info $(BABELTRACE_LIBRARY_VERSION)
+#      -Wl,--whole-archive,reader/.libs/libbabeltrace-plugin-ctf-reader.a,--no-whole-archive
+
+libbabeltrace_plugin_ctf_la_LIBADD = \
+       $(top_builddir)/lib/libbabeltrace.la \
+       $(top_builddir)/formats/ctf/libbabeltrace-ctf.la \
+       $(top_builddir)/plugins/libbabeltrace-plugin.la \
+       $(top_builddir)/plugins/ctf/reader/libbabeltrace-plugin-ctf-reader.la \
+       $(top_builddir)/plugins/ctf/lttng-live/libbabeltrace-plugin-ctf-lttng-live.la
diff --git a/plugins/ctf/live/live.c b/plugins/ctf/live/live.c
deleted file mode 100644 (file)
index e69de29..0000000
diff --git a/plugins/ctf/lttng-live/Makefile.am b/plugins/ctf/lttng-live/Makefile.am
new file mode 100644 (file)
index 0000000..f1b9177
--- /dev/null
@@ -0,0 +1,15 @@
+AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
+
+libbabeltrace_plugin_ctf_lttng_live_la_SOURCES = lttng-live.c
+
+noinst_HEADERS = lttng-live-internal.h
+noinst_LTLIBRARIES = libbabeltrace-plugin-ctf-lttng-live.la
+
+# Request that the linker keeps all static library objects.
+libbabeltrace_plugin_ctf_lttng_live_la_LDFLAGS = \
+       $(LD_NO_AS_NEEDED)
+
+libbabeltrace_plugin_ctf_lttng_live_la_LIBADD = \
+       $(top_builddir)/lib/libbabeltrace.la \
+       $(top_builddir)/formats/ctf/libbabeltrace-ctf.la \
+       $(top_builddir)/plugins/libbabeltrace-plugin.la
diff --git a/plugins/ctf/lttng-live/lttng-live-internal.h b/plugins/ctf/lttng-live/lttng-live-internal.h
new file mode 100644 (file)
index 0000000..0cc5afb
--- /dev/null
@@ -0,0 +1,40 @@
+#ifndef BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_INTERNAL_H
+#define BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_INTERNAL_H
+
+/*
+ * BabelTrace - LTTng-live client Component
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/plugin/component.h>
+
+#define LTTNG_LIVE_COMPONENT_NAME "lttng-live"
+#define LTTNG_LIVE_COMPONENT_DESCRIPTION "Component implementing an LTTng-live client."
+
+BT_HIDDEN
+enum bt_component_status lttng_live_init(struct bt_component *source,
+               struct bt_value *params);
+
+#endif /* BABELTRACE_PLUGIN_CTF_LTTNG_LIVE_INTERNAL_H */
diff --git a/plugins/ctf/lttng-live/lttng-live.c b/plugins/ctf/lttng-live/lttng-live.c
new file mode 100644 (file)
index 0000000..4f28f48
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * lttng-live.c
+ *
+ * Babeltrace CTF LTTng-live Client Component
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include "lttng-live-internal.h"
+#include <babeltrace/plugin/source.h>
+
+BT_HIDDEN
+enum bt_component_status lttng_live_init(struct bt_component *component,
+               struct bt_value *params)
+{
+       return BT_COMPONENT_STATUS_OK;
+}
index 9d828a029adbc617c0a5f7c2e58813ff49b63a41..7e50953f7faa4895663e2e0694b9cf5fe7e22cdd 100644 (file)
@@ -1,8 +1,7 @@
 AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
 
-SUBDIRS = .
-
-lib_LTLIBRARIES = libbabeltrace-plugin-ctf-reader.la
+noinst_HEADERS = reader-internal.h
+noinst_LTLIBRARIES = libbabeltrace-plugin-ctf-reader.la
 
 # Plug-in system library
 libbabeltrace_plugin_ctf_reader_la_SOURCES = \
@@ -10,7 +9,7 @@ libbabeltrace_plugin_ctf_reader_la_SOURCES = \
 
 # Request that the linker keeps all static librarie objects.
 libbabeltrace_plugin_ctf_reader_la_LDFLAGS = \
-       -Wl,--no-as-needed -version-info $(BABELTRACE_LIBRARY_VERSION)
+       -Wl,--no-as-needed
 
 libbabeltrace_plugin_ctf_reader_la_LIBADD = \
        $(top_builddir)/lib/libbabeltrace.la \
index cab8edb2b42a1b43ce1ef6325051c7bf427772fb..1ebae604601f70c150c496034bd5c7aa7d4a4da6 100644 (file)
@@ -2,9 +2,9 @@
 #define BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H
 
 /*
- * BabelTrace - CTF Reader plug-in internal
+ * BabelTrace - CTF Reader Component
  *
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * SOFTWARE.
  */
 
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/plugin/component.h>
 
+#define READER_COMPONENT_NAME "ctf"
+#define READER_COMPONENT_DESCRIPTION "Component used to read on-disk CTF traces."
 
-
-#ifdef __cplusplus
-}
-#endif
+BT_HIDDEN
+enum bt_component_status ctf_init(struct bt_component *source,
+               struct bt_value *params);
 
 #endif /* BABELTRACE_PLUGIN_CTF_READER_INTERNAL_H */
index 5802b8b050b91db5c8ba193f7a251da941a9f53d..ccf860abd53dd295cf4ee8527cbe2871147388f0 100644 (file)
@@ -1,9 +1,9 @@
 /*
  * reader.c
  *
- * Babeltrace CTF Reader Plugin
+ * Babeltrace CTF Reader Component
  *
- * Copyright 2015 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
  *
  * SOFTWARE.
  */
 
-#include <babeltrace/plugin/plugin-lib.h>
-#include <babeltrace/plugin/plugin-system.h>
-#include <babeltrace/plugin/plugin.h>
-#include <glib.h>
-#include <stdio.h>
+#include "reader-internal.h"
+#include <babeltrace/plugin/source.h>
 
-const char *plugin_name = "ctf";
-
-struct ctf_reader {
-       int a;
-};
-
-enum bt_plugin_type bt_plugin_lib_get_type(void)
+BT_HIDDEN
+enum bt_component_status ctf_init(struct bt_component *component,
+               struct bt_value *params)
 {
-       return BT_PLUGIN_TYPE_SOURCE;
+       return BT_COMPONENT_STATUS_OK;
 }
 
-const char *bt_plugin_lib_get_format_name(void)
-{
-       return plugin_name;
-}
 
-static
-void ctf_reader_destroy(struct bt_plugin *plugin)
-{
-       struct ctf_reader *reader;
-
-       if (!plugin) {
-               return;
-       }
-
-       reader = bt_plugin_get_private_data(plugin);
-       if (!reader) {
-               return;
-       }
-
-       g_free(reader);
-}
-
-static
-struct bt_notification_iterator *ctf_reader_iterator_create(
-               struct bt_plugin *plugin)
-{
-       return NULL;
-}
-
-struct bt_plugin *bt_plugin_lib_create(struct bt_object *params)
-{
-       struct bt_plugin *plugin = NULL;
-       struct ctf_reader *reader = g_new0(struct ctf_reader, 1);
-
-       plugin = bt_plugin_source_create(plugin_name, reader,
-               ctf_reader_destroy, ctf_reader_iterator_create);
-       if (!plugin) {
-               goto error;
-       }
-
-end:
-       return plugin;
-error:
-       if (reader) {
-               g_free(reader);
-       }
-       goto end;
-}
diff --git a/plugins/ctf/symbols.c b/plugins/ctf/symbols.c
new file mode 100644 (file)
index 0000000..2cc423e
--- /dev/null
@@ -0,0 +1,45 @@
+/*
+ * symbols.c
+ *
+ * Babeltrace CTF Plug-in Registration Symbols
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/plugin-macros.h>
+#include "reader/reader-internal.h"
+#include "lttng-live/lttng-live-internal.h"
+
+/* Initialize plug-in entry points. */
+BT_PLUGIN_NAME("ctf");
+BT_PLUGIN_DESCRIPTION("Babeltrace CTF plug-in.");
+BT_PLUGIN_AUTHOR("Jérémie Galarneau");
+BT_PLUGIN_LICENSE("MIT");
+
+BT_PLUGIN_COMPONENT_CLASSES_BEGIN
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(READER_COMPONENT_NAME,
+               READER_COMPONENT_DESCRIPTION, ctf_init);
+BT_PLUGIN_SOURCE_COMPONENT_CLASS_ENTRY(LTTNG_LIVE_COMPONENT_NAME,
+               LTTNG_LIVE_COMPONENT_DESCRIPTION, lttng_live_init);
+BT_PLUGIN_COMPONENT_CLASSES_END
+
diff --git a/plugins/ctf/text/Makefile.am b/plugins/ctf/text/Makefile.am
deleted file mode 100644 (file)
index eb7cd19..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
-
-SUBDIRS = .
-
-lib_LTLIBRARIES = libbabeltrace-plugin-ctf-text.la
-
-# Plug-in system library
-libbabeltrace_plugin_ctf_text_la_SOURCES = \
-       text.c
-
-# Request that the linker keeps all static library objects.
-libbabeltrace_plugin_ctf_text_la_LDFLAGS = \
-       $(LD_NO_AS_NEEDED) -version-info $(BABELTRACE_LIBRARY_VERSION)
-
-libbabeltrace_plugin_ctf_text_la_LIBADD = \
-       $(top_builddir)/lib/libbabeltrace.la \
-       $(top_builddir)/formats/ctf/libbabeltrace-ctf.la \
-       $(top_builddir)/plugins/libbabeltrace-plugin.la
diff --git a/plugins/ctf/text/text.c b/plugins/ctf/text/text.c
deleted file mode 100644 (file)
index 7557497..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- * text.c
- *
- * Babeltrace CTF Text Output Plugin
- *
- * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
- */
-
-#include <babeltrace/plugin/plugin-macros.h>
-#include <babeltrace/plugin/component.h>
-#include <babeltrace/plugin/sink.h>
-#include <babeltrace/plugin/notification/notification.h>
-#include <glib.h>
-#include <stdio.h>
-#include <stdbool.h>
-
-static
-enum bt_component_status ctf_text_init(struct bt_component *,
-               struct bt_value *params);
-
-/* Initialize plug-in entry points. */
-BT_PLUGIN_NAME("ctf-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.", ctf_text_init)
-BT_PLUGIN_COMPONENT_CLASSES_END
-
-enum loglevel {
-        LOGLEVEL_EMERG                  = 0,
-        LOGLEVEL_ALERT                  = 1,
-        LOGLEVEL_CRIT                   = 2,
-        LOGLEVEL_ERR                    = 3,
-        LOGLEVEL_WARNING                = 4,
-        LOGLEVEL_NOTICE                 = 5,
-        LOGLEVEL_INFO                   = 6,
-        LOGLEVEL_DEBUG_SYSTEM           = 7,
-        LOGLEVEL_DEBUG_PROGRAM          = 8,
-        LOGLEVEL_DEBUG_PROCESS          = 9,
-        LOGLEVEL_DEBUG_MODULE           = 10,
-        LOGLEVEL_DEBUG_UNIT             = 11,
-        LOGLEVEL_DEBUG_FUNCTION         = 12,
-        LOGLEVEL_DEBUG_LINE             = 13,
-        LOGLEVEL_DEBUG                  = 14,
-};
-
-static
-const char *loglevel_str [] = {
-       [LOGLEVEL_EMERG] =              "TRACE_EMERG",
-       [LOGLEVEL_ALERT] =              "TRACE_ALERT",
-       [LOGLEVEL_CRIT] =               "TRACE_CRIT",
-       [LOGLEVEL_ERR] =                "TRACE_ERR",
-       [LOGLEVEL_WARNING] =            "TRACE_WARNING",
-       [LOGLEVEL_NOTICE] =             "TRACE_NOTICE",
-       [LOGLEVEL_INFO] =               "TRACE_INFO",
-       [LOGLEVEL_DEBUG_SYSTEM] =       "TRACE_DEBUG_SYSTEM",
-       [LOGLEVEL_DEBUG_PROGRAM] =      "TRACE_DEBUG_PROGRAM",
-       [LOGLEVEL_DEBUG_PROCESS] =      "TRACE_DEBUG_PROCESS",
-       [LOGLEVEL_DEBUG_MODULE] =       "TRACE_DEBUG_MODULE",
-       [LOGLEVEL_DEBUG_UNIT] =         "TRACE_DEBUG_UNIT",
-       [LOGLEVEL_DEBUG_FUNCTION] =     "TRACE_DEBUG_FUNCTION",
-       [LOGLEVEL_DEBUG_LINE] =         "TRACE_DEBUG_LINE",
-       [LOGLEVEL_DEBUG] =              "TRACE_DEBUG",
-};
-
-struct ctf_text_component {
-       bool opt_print_all_field_names : 1;
-       bool opt_print_scope_field_names : 1;
-       bool opt_print_header_field_names : 1;
-       bool opt_print_context_field_names : 1;
-       bool opt_print_payload_field_names : 1;
-       bool opt_print_all_fields : 1;
-       bool opt_print_trace_field : 1;
-       bool opt_print_trace_domain_field : 1;
-       bool opt_print_trace_procname_field : 1;
-       bool opt_print_trace_vpid_field : 1;
-       bool opt_print_trace_hostname_field : 1;
-       bool opt_print_trace_default_fields : 1;
-       bool opt_print_loglevel_field : 1;
-       bool opt_print_emf_field : 1;
-       bool opt_print_delta_field : 1;
-};
-
-static
-enum bt_component_status ctf_text_init(
-               struct bt_component *component, struct bt_value *params)
-{
-       printf("ctf_text_init\n");
-       return BT_COMPONENT_STATUS_OK;
-}
diff --git a/plugins/text/Makefile.am b/plugins/text/Makefile.am
new file mode 100644 (file)
index 0000000..eb7cd19
--- /dev/null
@@ -0,0 +1,18 @@
+AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
+
+SUBDIRS = .
+
+lib_LTLIBRARIES = libbabeltrace-plugin-ctf-text.la
+
+# Plug-in system library
+libbabeltrace_plugin_ctf_text_la_SOURCES = \
+       text.c
+
+# Request that the linker keeps all static library objects.
+libbabeltrace_plugin_ctf_text_la_LDFLAGS = \
+       $(LD_NO_AS_NEEDED) -version-info $(BABELTRACE_LIBRARY_VERSION)
+
+libbabeltrace_plugin_ctf_text_la_LIBADD = \
+       $(top_builddir)/lib/libbabeltrace.la \
+       $(top_builddir)/formats/ctf/libbabeltrace-ctf.la \
+       $(top_builddir)/plugins/libbabeltrace-plugin.la
diff --git a/plugins/text/text.c b/plugins/text/text.c
new file mode 100644 (file)
index 0000000..50d5a4b
--- /dev/null
@@ -0,0 +1,111 @@
+/*
+ * text.c
+ *
+ * Babeltrace CTF Text Output Plugin
+ *
+ * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
+ *
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
+ * of this software and associated documentation files (the "Software"), to deal
+ * in the Software without restriction, including without limitation the rights
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+ * copies of the Software, and to permit persons to whom the Software is
+ * furnished to do so, subject to the following conditions:
+ *
+ * The above copyright notice and this permission notice shall be included in
+ * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
+ */
+
+#include <babeltrace/plugin/plugin-macros.h>
+#include <babeltrace/plugin/component.h>
+#include <babeltrace/plugin/sink.h>
+#include <babeltrace/plugin/notification/notification.h>
+#include <stdio.h>
+#include <stdbool.h>
+
+static
+enum bt_component_status ctf_text_init(struct bt_component *,
+               struct bt_value *params);
+
+/* Initialize plug-in entry points. */
+BT_PLUGIN_NAME("ctf-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.", ctf_text_init)
+BT_PLUGIN_COMPONENT_CLASSES_END
+
+enum loglevel {
+        LOGLEVEL_EMERG                  = 0,
+        LOGLEVEL_ALERT                  = 1,
+        LOGLEVEL_CRIT                   = 2,
+        LOGLEVEL_ERR                    = 3,
+        LOGLEVEL_WARNING                = 4,
+        LOGLEVEL_NOTICE                 = 5,
+        LOGLEVEL_INFO                   = 6,
+        LOGLEVEL_DEBUG_SYSTEM           = 7,
+        LOGLEVEL_DEBUG_PROGRAM          = 8,
+        LOGLEVEL_DEBUG_PROCESS          = 9,
+        LOGLEVEL_DEBUG_MODULE           = 10,
+        LOGLEVEL_DEBUG_UNIT             = 11,
+        LOGLEVEL_DEBUG_FUNCTION         = 12,
+        LOGLEVEL_DEBUG_LINE             = 13,
+        LOGLEVEL_DEBUG                  = 14,
+};
+
+static
+const char *loglevel_str [] = {
+       [LOGLEVEL_EMERG] =              "TRACE_EMERG",
+       [LOGLEVEL_ALERT] =              "TRACE_ALERT",
+       [LOGLEVEL_CRIT] =               "TRACE_CRIT",
+       [LOGLEVEL_ERR] =                "TRACE_ERR",
+       [LOGLEVEL_WARNING] =            "TRACE_WARNING",
+       [LOGLEVEL_NOTICE] =             "TRACE_NOTICE",
+       [LOGLEVEL_INFO] =               "TRACE_INFO",
+       [LOGLEVEL_DEBUG_SYSTEM] =       "TRACE_DEBUG_SYSTEM",
+       [LOGLEVEL_DEBUG_PROGRAM] =      "TRACE_DEBUG_PROGRAM",
+       [LOGLEVEL_DEBUG_PROCESS] =      "TRACE_DEBUG_PROCESS",
+       [LOGLEVEL_DEBUG_MODULE] =       "TRACE_DEBUG_MODULE",
+       [LOGLEVEL_DEBUG_UNIT] =         "TRACE_DEBUG_UNIT",
+       [LOGLEVEL_DEBUG_FUNCTION] =     "TRACE_DEBUG_FUNCTION",
+       [LOGLEVEL_DEBUG_LINE] =         "TRACE_DEBUG_LINE",
+       [LOGLEVEL_DEBUG] =              "TRACE_DEBUG",
+};
+
+struct ctf_text_component {
+       bool opt_print_all_field_names : 1;
+       bool opt_print_scope_field_names : 1;
+       bool opt_print_header_field_names : 1;
+       bool opt_print_context_field_names : 1;
+       bool opt_print_payload_field_names : 1;
+       bool opt_print_all_fields : 1;
+       bool opt_print_trace_field : 1;
+       bool opt_print_trace_domain_field : 1;
+       bool opt_print_trace_procname_field : 1;
+       bool opt_print_trace_vpid_field : 1;
+       bool opt_print_trace_hostname_field : 1;
+       bool opt_print_trace_default_fields : 1;
+       bool opt_print_loglevel_field : 1;
+       bool opt_print_emf_field : 1;
+       bool opt_print_delta_field : 1;
+};
+
+static
+enum bt_component_status ctf_text_init(
+               struct bt_component *component, struct bt_value *params)
+{
+       printf("ctf_text_init\n");
+       return BT_COMPONENT_STATUS_OK;
+}
This page took 0.038681 seconds and 4 git commands to generate.