Error stream is now an attribute of the base plugin class
authorJérémie Galarneau <jeremie.galarneau@efficios.com>
Wed, 20 May 2015 17:54:01 +0000 (13:54 -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>
include/babeltrace/plugin/plugin-internal.h
include/babeltrace/plugin/plugin-system.h
plugins/ctf/reader.c

index a05053182705d082892159443b5ebe635c5a8b58..91f3621915c8b8033fd61fdfaffc5a331661260f 100644 (file)
@@ -41,10 +41,11 @@ struct bt_plugin {
        struct bt_ctf_ref ref_count;
        GString *name;
        enum bt_plugin_type type;
+       /** No ownership taken */
+       FILE *error_stream;
 
        /* Plug-in implementation callbacks */
        bt_plugin_destroy_cb destroy;
-       bt_plugin_set_error_stream_cb set_error_stream;
 };
 
 #ifdef __cplusplus
index a606a459d45df767708fce3bffb6a665e36824a9..7b955f4dac5494760f95ca9a230263b65b08494e 100644 (file)
@@ -43,16 +43,6 @@ extern "C" {
  */
 typedef void (*bt_plugin_destroy_cb)(struct bt_plugin *plugin);
 
-/**
- * Plug-in error stream registration function type.
- *
- * @param plugin       Plug-in instance
- * @param error_stream Error stream, ownership is not transferred
- * @returns            One of #bt_plugin_status values
- */
-typedef enum bt_plugin_status (*bt_plugin_set_error_stream_cb)(
-               struct bt_plugin *plugin, FILE *error_stream);
-
 /**
  * Get a plug-in's private (implementation) data.
  *
@@ -61,15 +51,7 @@ typedef enum bt_plugin_status (*bt_plugin_set_error_stream_cb)(
  */
 extern void *bt_plugin_get_private_data(struct bt_plugin *plugin);
 
-/**
- * Set a callback permiting the registration of an error stream.
- *
- * @param plugin       Plug-in to which the callback should be registered
- * @param cb           Error stream registration callback
- */
-extern int bt_plugin_set_error_stream_cb(struct bt_plugin *plugin,
-               bt_plugin_set_error_stream_cb cb);
-
+       
 /* Plug-in initialization functions */
 /**
  * Allocate a source plug-in.
@@ -97,6 +79,7 @@ extern struct bt_plugin *bt_plugin_sink_create(const char *name,
                void *private_data, bt_plugin_destroy_func destroy_func,
                bt_plugin_sink_handle_notification_cb notification_cb);
 
+
 /* Notification iterator functions */
 /**
  * Allocate a notification iterator.
index 181d400ab1afadbbde114c45466a4c124ffed79d..437de62ff7052df0700166e2f9d913042f575a54 100644 (file)
@@ -1,3 +1,31 @@
+/*
+ * reader.c
+ *
+ * Babeltrace CTF Reader Plugin
+ *
+ * Copyright 2015 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-lib.h>
 #include <babeltrace/plugin/plugin-system.h>
 #include <glib.h>
@@ -6,7 +34,7 @@
 const char *plugin_name = "ctf";
 
 struct ctf_reader {
-        FILE *err;
+       int a;
 };
 
 enum bt_plugin_type bt_plugin_lib_get_type(void)
@@ -43,29 +71,6 @@ struct bt_notification_iterator *ctf_reader_iterator_create(
        return NULL;
 }
 
-/* Move this to bt_plugin */
-static
-enum bt_plugin_status ctf_reader_set_error_stream(
-               struct bt_plugin *plugin, FILE *stream)
-{
-       struct ctf_reader *reader;
-       enum bt_plugin_status ret = BT_PLUGIN_STATUS_OK;
-
-       if (!plugin) {
-               ret = BT_PLUGIN_STATUS_INVAL;
-               goto end;
-       }
-
-       reader = bt_plugin_get_private_data(plugin);
-       if (!reader) {
-               ret = BT_PLUGIN_STATUS_ERROR;
-               goto end;
-       }
-
-       reader->stream = stream;
-end:
-       return ret;
-}
 
 struct bt_plugin *bt_plugin_lib_create(struct bt_object *params)
 {
This page took 0.026654 seconds and 4 git commands to generate.