lib: rename bt_plugin_create_all_*() -> bt_plugin_find_all_*()
authorPhilippe Proulx <eeppeliteloop@gmail.com>
Sat, 8 Dec 2018 17:44:10 +0000 (12:44 -0500)
committerFrancis Deslauriers <francis.deslauriers@efficios.com>
Thu, 2 May 2019 20:50:15 +0000 (20:50 +0000)
Those functions return a const plugin set anyway, so we're not really
creating private objects as other *_create() functions do.

Signed-off-by: Philippe Proulx <eeppeliteloop@gmail.com>
cli/babeltrace.c
include/babeltrace/plugin/plugin-const.h
lib/plugin/plugin-so.c
lib/plugin/plugin.c
tests/lib/test_plugin.c

index 0f3b05ca60a6b996788569e2e353a865f911b357..ae1a9263454e3030c9b031554163d973cf7fbd0d 100644 (file)
@@ -814,7 +814,7 @@ int load_dynamic_plugins(const bt_value *plugin_paths)
 
                /*
                 * 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)) {
@@ -823,7 +823,7 @@ int load_dynamic_plugins(const bt_value *plugin_paths)
                        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);
@@ -844,7 +844,7 @@ int load_static_plugins(void)
        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;
index fe581f4edc3e208510ca93301260e18c9dc77eef..fe51a8564324b373cad5b84dae30c12f6a039b17 100644 (file)
@@ -63,13 +63,13 @@ enum bt_plugin_status {
 
 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);
 
index b06a1b6b689538478ae7fd29e40b2552c6ae4c6a..cf0b66f1086bb877d9e2cd4c76da77cdd1d86522 100644 (file)
@@ -71,7 +71,7 @@ BT_PLUGIN_MODULE();
  *
  * 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
@@ -198,7 +198,7 @@ struct bt_plugin_so_shared_lib_handle *bt_plugin_so_shared_lib_handle_create(
                 * 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\"",
@@ -1223,7 +1223,7 @@ struct bt_plugin_set *bt_plugin_so_create_all_from_sections(
                         * _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",
@@ -1250,7 +1250,7 @@ struct bt_plugin_set *bt_plugin_so_create_all_from_sections(
                         * _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.");
index 1d7661de67611fb23730a9a7e0f8ce684f0efc1e..ce13d01b3a0bbbfbab7c54ef84209aba5daacda8 100644 (file)
@@ -124,13 +124,13 @@ const struct bt_plugin *bt_plugin_set_borrow_plugin_by_index_const(
        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;
 
@@ -246,7 +246,7 @@ const struct bt_plugin *bt_plugin_find(const char *plugin_name)
 
                /*
                 * 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: "
@@ -254,8 +254,8 @@ const struct bt_plugin *bt_plugin_find(const char *plugin_name)
                        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);
@@ -281,7 +281,7 @@ const struct bt_plugin *bt_plugin_find(const char *plugin_name)
        }
 
        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 =
@@ -348,7 +348,7 @@ int nftw_append_all_from_dir(const char *file, const struct stat *sb, int flag,
                        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;
@@ -408,7 +408,7 @@ enum bt_plugin_status bt_plugin_create_append_all_from_dir(
        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;
index e9739f3e928f2f4be3eaed95a000e84d414216ca..6d9c42633d4898b8d8ef45082753814ee64676b6 100644 (file)
@@ -72,13 +72,13 @@ static void test_minimal(const char *plugin_dir)
        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");
@@ -132,7 +132,7 @@ static void test_sfs(const char *plugin_dir)
        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) ==
@@ -214,17 +214,17 @@ static void test_create_all_from_dir(const char *plugin_dir)
 
        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);
 }
This page took 0.031562 seconds and 4 git commands to generate.