/*
* Skip this if the directory does not exist because
- * bt_plugin_create_all_from_dir() expects an existing
+ * bt_plugin_find_all_from_dir() expects an existing
* directory.
*/
if (!g_file_test(plugin_path, G_FILE_TEST_IS_DIR)) {
continue;
}
- plugin_set = bt_plugin_create_all_from_dir(plugin_path, false);
+ plugin_set = bt_plugin_find_all_from_dir(plugin_path, false);
if (!plugin_set) {
BT_LOGD("Unable to load dynamic plugins: path=\"%s\"",
plugin_path);
const bt_plugin_set *plugin_set;
BT_LOGI("Loading static plugins.");
- plugin_set = bt_plugin_create_all_from_static();
+ plugin_set = bt_plugin_find_all_from_static();
if (!plugin_set) {
BT_LOGE("Unable to load static plugins.");
ret = -1;
extern const bt_plugin *bt_plugin_find(const char *plugin_name);
-extern const bt_plugin_set *bt_plugin_create_all_from_file(
+extern const bt_plugin_set *bt_plugin_find_all_from_file(
const char *path);
-extern const bt_plugin_set *bt_plugin_create_all_from_dir(
+extern const bt_plugin_set *bt_plugin_find_all_from_dir(
const char *path, bt_bool recurse);
-extern const bt_plugin_set *bt_plugin_create_all_from_static(void);
+extern const bt_plugin_set *bt_plugin_find_all_from_static(void);
extern const char *bt_plugin_get_name(const bt_plugin *plugin);
*
* It allows this use-case:
*
- * my_plugins = bt_plugin_create_all_from_file("/path/to/my-plugin.so");
+ * my_plugins = bt_plugin_find_all_from_file("/path/to/my-plugin.so");
* // instantiate components from a plugin's component classes
* // put plugins and free my_plugins here
* // user code of instantiated components still exists
* DEBUG-level logging because we're only _trying_ to
* open this file as a Babeltrace plugin: if it's not,
* it's not an error. And because this can be tried
- * during bt_plugin_create_all_from_dir(), it's not even
+ * during bt_plugin_find_all_from_dir(), it's not even
* a warning.
*/
BT_LOGD("Cannot open GModule: %s: path=\"%s\"",
* _trying_ to open this file as a compatible
* Babeltrace plugin: if it's not, it's not an
* error. And because this can be tried during
- * bt_plugin_create_all_from_dir(), it's not
+ * bt_plugin_find_all_from_dir(), it's not
* even a warning.
*/
BT_LOGD("Unknown ABI major version: abi-major=%d",
* _trying_ to open this file as a compatible
* Babeltrace plugin: if it's not, it's not an
* error. And because this can be tried during
- * bt_plugin_create_all_from_dir(), it's not
+ * bt_plugin_find_all_from_dir(), it's not
* even a warning.
*/
BT_LOGD_STR("Cannot initialize SO plugin object from sections.");
return g_ptr_array_index(plugin_set->plugins, index);
}
-const struct bt_plugin_set *bt_plugin_create_all_from_static(void)
+const struct bt_plugin_set *bt_plugin_find_all_from_static(void)
{
/* bt_plugin_so_create_all_from_static() logs errors */
return bt_plugin_so_create_all_from_static();
}
-const struct bt_plugin_set *bt_plugin_create_all_from_file(const char *path)
+const struct bt_plugin_set *bt_plugin_find_all_from_file(const char *path)
{
struct bt_plugin_set *plugin_set = NULL;
/*
* Skip this if the directory does not exist because
- * bt_plugin_create_all_from_dir() would log a warning.
+ * bt_plugin_find_all_from_dir() would log a warning.
*/
if (!g_file_test(dir->str, G_FILE_TEST_IS_DIR)) {
BT_LOGV("Skipping nonexistent directory path: "
continue;
}
- /* bt_plugin_create_all_from_dir() logs details/errors */
- plugin_set = bt_plugin_create_all_from_dir(dir->str, BT_FALSE);
+ /* bt_plugin_find_all_from_dir() logs details/errors */
+ plugin_set = bt_plugin_find_all_from_dir(dir->str, BT_FALSE);
if (!plugin_set) {
BT_LOGD("No plugins found in directory: path=\"%s\"",
dir->str);
}
bt_object_put_ref(plugin_set);
- plugin_set = bt_plugin_create_all_from_static();
+ plugin_set = bt_plugin_find_all_from_static();
if (plugin_set) {
for (j = 0; j < plugin_set->plugins->len; j++) {
const struct bt_plugin *candidate_plugin =
goto end;
}
- plugins_from_file = bt_plugin_create_all_from_file(file);
+ plugins_from_file = bt_plugin_find_all_from_file(file);
if (plugins_from_file) {
size_t j;
return ret;
}
-const struct bt_plugin_set *bt_plugin_create_all_from_dir(const char *path,
+const struct bt_plugin_set *bt_plugin_find_all_from_dir(const char *path,
bt_bool recurse)
{
struct bt_plugin_set *plugin_set;
diag("minimal plugin test below");
reset_test_plugin_env_vars();
- plugin_set = bt_plugin_create_all_from_file(minimal_path);
+ plugin_set = bt_plugin_find_all_from_file(minimal_path);
ok(plugin_set && bt_plugin_set_get_plugin_count(plugin_set) == 1,
- "bt_plugin_create_all_from_file() succeeds with a valid file");
+ "bt_plugin_find_all_from_file() succeeds with a valid file");
ok(check_env_var("BT_TEST_PLUGIN_INIT_CALLED") == 1,
- "plugin's initialization function is called during bt_plugin_create_all_from_file()");
+ "plugin's initialization function is called during bt_plugin_find_all_from_file()");
ok(bt_plugin_set_get_plugin_count(plugin_set) == 1,
- "bt_plugin_create_all_from_file() returns the expected number of plugins");
+ "bt_plugin_find_all_from_file() returns the expected number of plugins");
plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
ok(strcmp(bt_plugin_get_name(plugin), "test_minimal") == 0,
"bt_plugin_get_name() returns the expected name");
BT_ASSERT(sfs_path);
diag("sfs plugin test below");
- plugin_set = bt_plugin_create_all_from_file(sfs_path);
+ plugin_set = bt_plugin_find_all_from_file(sfs_path);
BT_ASSERT(plugin_set && bt_plugin_set_get_plugin_count(plugin_set) == 1);
plugin = bt_plugin_set_borrow_plugin_by_index_const(plugin_set, 0);
ok(bt_plugin_get_version(plugin, &major, &minor, &patch, &extra) ==
diag("create from all test below");
- plugin_set = bt_plugin_create_all_from_dir(NON_EXISTING_PATH, BT_FALSE);
+ plugin_set = bt_plugin_find_all_from_dir(NON_EXISTING_PATH, BT_FALSE);
ok(!plugin_set,
- "bt_plugin_create_all_from_dir() fails with an invalid path");
+ "bt_plugin_find_all_from_dir() fails with an invalid path");
- plugin_set = bt_plugin_create_all_from_dir(plugin_dir, BT_FALSE);
- ok(plugin_set, "bt_plugin_create_all_from_dir() succeeds with a valid path");
+ plugin_set = bt_plugin_find_all_from_dir(plugin_dir, BT_FALSE);
+ ok(plugin_set, "bt_plugin_find_all_from_dir() succeeds with a valid path");
/* 2 or 4, if `.la` files are considered or not */
ok(bt_plugin_set_get_plugin_count(plugin_set) == 2 ||
bt_plugin_set_get_plugin_count(plugin_set) == 4,
- "bt_plugin_create_all_from_dir() returns the expected number of plugin objects");
+ "bt_plugin_find_all_from_dir() returns the expected number of plugin objects");
bt_plugin_set_put_ref(plugin_set);
}