}
}
-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;
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)
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;
}
{
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) {
/* 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;