X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=src%2Flib%2Fplugin%2Fplugin.h;h=417d116c436fe609ddb3e78a0708da60f4867eee;hb=2ce06c9e12da671dd1098ed4174a070af95cb406;hp=d62bfb55f0812de59d7575c7f172908ef7cf2cf1;hpb=3f7d4d90b0456de9d34fac337350818ef06163bd;p=babeltrace.git diff --git a/src/lib/plugin/plugin.h b/src/lib/plugin/plugin.h index d62bfb55..417d116c 100644 --- a/src/lib/plugin/plugin.h +++ b/src/lib/plugin/plugin.h @@ -31,22 +31,21 @@ #include "lib/object.h" #include #include "common/assert.h" -#include "lib/lib-logging.h" #include #include "plugin-so.h" +#include "lib/func-status.h" + +/* Protection: this file uses BT_LIB_LOG*() macros directly */ +#ifndef BT_LIB_LOG_SUPPORTED +# error Please include "lib/logging.h" before including this file. +#endif enum bt_plugin_type { BT_PLUGIN_TYPE_SO = 0, BT_PLUGIN_TYPE_PYTHON = 1, }; -enum bt_plugin_status { - BT_PLUGIN_STATUS_OK = 0, - BT_PLUGIN_STATUS_ERROR = -1, - BT_PLUGIN_STATUS_NOMEM = -12, -}; - struct bt_plugin { struct bt_object base; enum bt_plugin_type type; @@ -89,21 +88,6 @@ struct bt_plugin_set { GPtrArray *plugins; }; -static inline -const char *bt_plugin_status_string(enum bt_plugin_status status) -{ - switch (status) { - case BT_PLUGIN_STATUS_OK: - return "BT_PLUGIN_STATUS_OK"; - case BT_PLUGIN_STATUS_ERROR: - return "BT_PLUGIN_STATUS_ERROR"; - case BT_PLUGIN_STATUS_NOMEM: - return "BT_PLUGIN_STATUS_NOMEM"; - default: - return "(unknown)"; - } -} - static inline const char *bt_plugin_type_string(enum bt_plugin_type type) { @@ -345,7 +329,7 @@ void bt_plugin_set_version(struct bt_plugin *plugin, unsigned int major, } static inline -enum bt_plugin_status bt_plugin_add_component_class( +int bt_plugin_add_component_class( struct bt_plugin *plugin, struct bt_component_class *comp_class) { GPtrArray *comp_classes; @@ -367,6 +351,11 @@ enum bt_plugin_status bt_plugin_add_component_class( abort(); } + /* Set component class's original plugin name */ + BT_ASSERT(comp_class->plugin_name); + BT_ASSERT(plugin->info.name); + g_string_assign(comp_class->plugin_name, plugin->info.name->str); + /* Add new component class */ bt_object_get_ref(comp_class); g_ptr_array_add(comp_classes, comp_class); @@ -378,7 +367,7 @@ enum bt_plugin_status bt_plugin_add_component_class( BT_LIB_LOGD("Added component class to plugin: " "%![plugin-]+l, %![cc-]+C", plugin, comp_class); - return BT_PLUGIN_STATUS_OK; + return BT_FUNC_STATUS_OK; } static