build fixes
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Thu, 21 May 2015 18:09:38 +0000 (14:09 -0400)
committerJérémie Galarneau <jeremie.galarneau@efficios.com>
Sat, 27 May 2017 16:54:31 +0000 (12:54 -0400)
Signed-off-by: Jérémie Galarneau <jeremie.galarneau@efficios.com>
Makefile.am
include/babeltrace/plugin/plugin-internal.h
include/babeltrace/plugin/plugin-system.h
include/babeltrace/plugin/plugin.h
include/babeltrace/plugin/source.h
plugins/Makefile.am
plugins/plugin.c

index 1709f95745a0dd03d64f7851969ea6106e6f091f..2cd22a5b5e71b63b099e784bfd77734f480c1ff6 100644 (file)
@@ -2,7 +2,7 @@ AM_CFLAGS = $(PACKAGE_CFLAGS) -I$(top_srcdir)/include
 
 ACLOCAL_AMFLAGS = -I m4
 
-SUBDIRS = include types compat lib formats converter bindings tests doc extras
+SUBDIRS = include types compat lib formats converter bindings tests doc extras plugins
 
 dist_doc_DATA = ChangeLog LICENSE mit-license.txt gpl-2.0.txt \
                std-ext-lib.txt README
index 2214dc96959f7ad5b70a80c2fff8f1c5f7d38fbb..a0ed98d9d00ee685f277e54e41445791ddb80edd 100644 (file)
@@ -28,6 +28,8 @@
  */
 
 #include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/plugin/plugin.h>
+#include <babeltrace/plugin/plugin-system.h>
 #include <babeltrace/ctf-writer/ref-internal.h>
 #include <glib.h>
 
@@ -51,9 +53,9 @@ struct bt_plugin {
 
 BT_HIDDEN
 enum bt_plugin_status bt_plugin_init(struct bt_plugin *plugin, const char *name,
-               void *user_data,bt_plugin_destroy_func destroy_func,
+               void *user_data,bt_plugin_destroy_cb destroy_func,
                enum bt_plugin_type plugin_type,
-               bt_plugin_destroy_func plugin_destroy);
+               bt_plugin_destroy_cb plugin_destroy);
 
 #ifdef __cplusplus
 }
index b8aa4a3b94da63ac4b5ab0889f92adcfedcd9b38..fea024fdd87f33d04ccc865ed0da7f991305f662 100644 (file)
  */
 
 #include <babeltrace/objects.h>
+#include <babeltrace/plugin/notification/iterator.h>
 
 #ifdef __cplusplus
 extern "C" {
 #endif
 
+struct bt_notification;
+
 /**
  * Plug-in private data deallocation function type.
  *
@@ -43,6 +46,33 @@ extern "C" {
  */
 typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
 
+/**
+ * Iterator creation function type.
+ *
+ * @param plugin       Plug-in instance
+ */
+typedef struct bt_notification_iterator *(
+               *bt_plugin_source_iterator_create_cb)(
+               struct bt_plugin *plugin);
+
+/**
+ * Notification handling function type.
+ *
+ * @param plugin       Plug-in instance
+ * @param notificattion        Notification to handle
+ */
+typedef int (*bt_plugin_sink_handle_notification_cb)(struct bt_plugin *,
+               struct bt_notification *);
+
+typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)(
+               struct bt_notification_iterator *);
+
+typedef struct bt_notification *(bt_notification_iterator_get_notification_cb)(
+               struct bt_notification_iterator *);
+
+typedef enum bt_notification_iterator_status (bt_notification_iterator_next_cb)(
+               struct bt_notification_iterator *);
+
 /**
  * Get a plug-in's private (implementation) data.
  *
@@ -51,7 +81,7 @@ typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
  */
 extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
 
-       
+
 /** Plug-in initialization functions */
 /**
  * Allocate a source plug-in.
@@ -63,7 +93,7 @@ extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
  * @returns                    A source plug-in instance
  */
 extern struct bt_plugin *bt_plugin_source_create(const char *name,
-               void *private_data, bt_plugin_destroy_func destroy_func,
+               void *private_data, bt_plugin_destroy_cb destroy_func,
                bt_plugin_source_iterator_create_cb iterator_create_cb);
 
 /**
@@ -76,7 +106,7 @@ extern struct bt_plugin *bt_plugin_source_create(const char *name,
  * @returns                    A sink plug-in instance
  */
 extern struct bt_plugin *bt_plugin_sink_create(const char *name,
-               void *private_data, bt_plugin_destroy_func destroy_func,
+               void *private_data, bt_plugin_destroy_cb destroy_func,
                bt_plugin_sink_handle_notification_cb notification_cb);
 
 
@@ -94,16 +124,6 @@ extern struct bt_notification_iterator *bt_notification_iterator_create(
                bt_notification_iterator_next_cb next_cb,
                bt_notification_iterator_get_notification_cb notification_cb);
 
-/**
- * Set an iterator's private data.
- *
- * @param plugin               Plug-in instance on which to iterate
- * @param data                 Iterator private data
- * @returns                    One of #bt_notification_iterator_status values
- */
-extern enum bt_notification_iterator_status *bt_notification_iterator_create(
-               struct bt_plugin *plugin, void *data);
-
 #ifdef __cplusplus
 }
 #endif
index bf9aaed11843afe5e7601cb08283d36455bfb044..77204d9d76e5647bc055c81e488f2ae620a40e76 100644 (file)
@@ -69,7 +69,9 @@ enum bt_plugin_status {
 
        /** No error, okay. */
        BT_PLUGIN_STATUS_OK =           0,
-}
+};
+
+struct bt_plugin;
 
 /**
  * Get plug-in instance name.
index 0e96529bba9578c19fbec016db07be0f647518f0..a333e392632f4fdfccc7e6fcef4c9d8d82dda5af 100644 (file)
@@ -36,15 +36,6 @@ extern "C" {
 struct bt_plugin;
 struct bt_notification_iterator;
 
-/**
- * Iterator creation function type.
- *
- * @param plugin       Plug-in instance
- */
-typedef struct bt_notification_iterator *(
-               *bt_plugin_source_iterator_create_func)(
-               struct bt_plugin *plugin);
-
 /**
  * Create an iterator on a plug-in instance.
  *
index d6523a745401521ce93edf172b77d4ecc6a126a8..55c866c824b9d2545a83e09bafed25b127cf1b6f 100644 (file)
@@ -4,13 +4,15 @@ SUBDIRS = .
 
 lib_LTLIBRARIES = libbabeltrace-plugin.la
 
+# Plug-in system library
 libbabeltrace_plugin_la_SOURCES = \
        plugin.c \
+       filter.c \
        source.c \
        sink.c \
        iterator.c
 
-# Request that the linker keeps all static libraries objects.
+# Request that the linker keeps all static librarie objects.
 libbabeltrace_plugin_la_LDFLAGS = \
        -Wl,--no-as-needed -version-info $(BABELTRACE_LIBRARY_VERSION)
 
index 8714d68981de98bac73dbf839530016a0940393d..15f55a7f4d640585ea9fa0563add873c082dc0d4 100644 (file)
  * SOFTWARE.
  */
 
+#include <babeltrace/plugin/plugin-internal.h>
+#include <babeltrace/babeltrace-internal.h>
+#include <babeltrace/compiler.h>
+
+static void bt_plugin_destroy(struct bt_ctf_ref *ref);
+
 const char *bt_plugin_get_name(struct bt_plugin *plugin)
 {
        const char *ret = NULL;
@@ -102,14 +108,14 @@ void bt_plugin_put(struct bt_plugin *plugin)
 
 BT_HIDDEN
 enum bt_plugin_status bt_plugin_init(struct bt_plugin *plugin, const char *name,
-               void *user_data, bt_plugin_destroy_func user_destroy_func,
+               void *user_data, bt_plugin_destroy_cb user_destroy_func,
                enum bt_plugin_type plugin_type,
-               bt_plugin_destroy_func plugin_destroy)
+               bt_plugin_destroy_cb plugin_destroy)
 {
        enum bt_plugin_status ret = BT_PLUGIN_STATUS_OK;
 
        if (!plugin || !name || name[0] == '\0' ||
-               !destroy_func || !private_data) {
+               !user_destroy_func || !user_data || !plugin_destroy) {
                ret = BT_PLUGIN_STATUS_INVAL;
                goto end;
        }
@@ -132,20 +138,20 @@ end:
 static
 void bt_plugin_destroy(struct bt_ctf_ref *ref)
 {
-       struct bt_ctf_plugin *plugin = NULL;
+       struct bt_plugin *plugin = NULL;
 
        if (!ref) {
                return;
        }
 
-       plugin = container_of(ref, struct bt_plugin, parent);
+       plugin = container_of(ref, struct bt_plugin, ref_count);
 
        /**
         * Destroy user data, base and source/filter/sink last since
         * it will deallocate the plugin.
         */
-       assert(plugin->user_destroy_func);
-       plugin->user_destroy_func(plugin->user_data);
+       assert(plugin->user_data_destroy);
+       plugin->user_data_destroy(plugin->user_data);
 
        g_string_free(plugin->name, TRUE);
 
This page took 0.029542 seconds and 4 git commands to generate.