ctf: bt_ctf_notif_iter_get_next_notification(): require CC prio. map
[babeltrace.git] / lib / plugin / plugin.c
index 90f77cb5a7e7c475e9b82ba1b04ffe8211687c70..d85604afbd89a2e15ad15a5b402dbc19bcca72b0 100644 (file)
@@ -131,7 +131,7 @@ void free_plugins(struct bt_plugin **plugins) {
        }
 }
 
-struct bt_plugin *bt_plugin_create_from_name(const char *plugin_name)
+struct bt_plugin *bt_plugin_find(const char *plugin_name)
 {
        const char *system_plugin_dir;
        char *home_plugin_dir = NULL;
@@ -246,6 +246,30 @@ end:
        return plugin;
 }
 
+struct bt_component_class *bt_plugin_find_component_class(
+               const char *plugin_name, const char *comp_cls_name,
+               enum bt_component_class_type comp_cls_type)
+{
+       struct bt_plugin *plugin = NULL;
+       struct bt_component_class *comp_cls = NULL;
+
+       if (!plugin_name || !comp_cls_name) {
+               goto end;
+       }
+
+       plugin = bt_plugin_find(plugin_name);
+       if (!plugin) {
+               goto end;
+       }
+
+       comp_cls = bt_plugin_get_component_class_by_name_and_type(
+               plugin, comp_cls_name, comp_cls_type);
+
+end:
+       bt_put(plugin);
+       return comp_cls;
+}
+
 /* Allocate dirent as recommended by READDIR(3), NOTES on readdir_r */
 static
 struct dirent *alloc_dirent(const char *path)
@@ -305,7 +329,8 @@ enum bt_plugin_status bt_plugin_create_append_all_from_dir(
 
        directory = opendir(file_path);
        if (!directory) {
-               perror("Failed to open plug-in directory");
+               printf_verbose("Failed to open plugin directory \"%s\"\n",
+                       file_path);
                ret = BT_PLUGIN_STATUS_ERROR;
                goto end;
        }
@@ -530,7 +555,6 @@ enum bt_plugin_status bt_plugin_add_component_class(
 {
        enum bt_plugin_status status = BT_PLUGIN_STATUS_OK;
        struct bt_component_class *comp_class_dup = NULL;
-       int ret;
        int comp_class_index = -1;
 
        if (!plugin || !comp_class || plugin->frozen) {
@@ -555,10 +579,7 @@ enum bt_plugin_status bt_plugin_add_component_class(
 
        /* Special case for a shared object plugin */
        if (plugin->type == BT_PLUGIN_TYPE_SO) {
-               ret = bt_plugin_so_on_add_component_class(plugin, comp_class);
-               if (ret) {
-                       goto error;
-               }
+               bt_plugin_so_on_add_component_class(plugin, comp_class);
        }
 
        goto end;
This page took 0.026358 seconds and 4 git commands to generate.