Move to kernel style SPDX license identifiers
[babeltrace.git] / src / lib / plugin / plugin.c
index 52614fbbd00644785d54845432368479c5183559..f9800af7fec233f730c72bd567ff53742cb5b13d 100644 (file)
@@ -1,26 +1,8 @@
 /*
+ * SPDX-License-Identifier: MIT
+ *
  * Copyright 2017-2018 Philippe Proulx <pproulx@efficios.com>
  * Copyright 2016 Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Author: Jérémie Galarneau <jeremie.galarneau@efficios.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a copy
- * of this software and associated documentation files (the "Software"), to deal
- * in the Software without restriction, including without limitation the rights
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the Software is
- * furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice shall be included in
- * all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
- * SOFTWARE.
  */
 
 #define BT_LOG_TAG "LIB/PLUGIN"
@@ -31,9 +13,9 @@
 #include "common/macros.h"
 #include "compat/compiler.h"
 #include "common/common.h"
-#include <babeltrace2/plugin/plugin-const.h>
-#include <babeltrace2/graph/component-class-const.h>
-#include <babeltrace2/current-thread.h>
+#include <babeltrace2/plugin/plugin-loading.h>
+#include <babeltrace2/graph/component-class.h>
+#include <babeltrace2/error-reporting.h>
 #include "lib/graph/component-class.h"
 #include <babeltrace2/types.h>
 #include <glib.h>
@@ -188,6 +170,8 @@ enum bt_plugin_find_all_from_static_status bt_plugin_find_all_from_static(
                bt_bool fail_on_load_error,
                const struct bt_plugin_set **plugin_set_out)
 {
+       BT_ASSERT_PRE_NO_ERROR();
+
        /* bt_plugin_so_create_all_from_static() logs errors */
        return bt_plugin_so_create_all_from_static(fail_on_load_error,
                (void *) plugin_set_out);
@@ -199,6 +183,7 @@ enum bt_plugin_find_all_from_file_status bt_plugin_find_all_from_file(
 {
        enum bt_plugin_find_all_from_file_status status;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(path, "Path");
        BT_ASSERT_PRE_NON_NULL(path, "Plugin set (output)");
        BT_LOGI("Creating plugins from file: path=\"%s\"", path);
@@ -282,6 +267,7 @@ enum bt_plugin_find_all_status bt_plugin_find_all(bt_bool find_in_std_env_var,
        int status = BT_FUNC_STATUS_OK;
        uint64_t dir_i, plugin_i;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)");
        BT_LOGI("Finding all plugins in standard directories and built-in plugins: "
                "find-in-std-env-var=%d, find-in-user-dir=%d, "
@@ -465,6 +451,7 @@ enum bt_plugin_find_status bt_plugin_find(const char *plugin_name,
        const struct bt_plugin_set *plugin_set = NULL;
        uint64_t i;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(plugin_name, "Name");
        BT_ASSERT_PRE_NON_NULL(plugin_out, "Plugin (output)");
        BT_LOGI("Finding named plugin in standard directories and built-in plugins: "
@@ -621,7 +608,7 @@ int bt_plugin_create_append_all_from_dir(struct bt_plugin_set *plugin_set,
                        ": path=\"%s\", recurse=%d",
                        path, recurse);
                (void) BT_CURRENT_THREAD_ERROR_APPEND_CAUSE_FROM_UNKNOWN(
-                       "Babeltrace library",
+                       BT_LIB_LOG_LIBBABELTRACE2_NAME,
                        "Cannot open directory: path=\"%s\", recurse=%d",
                        path, recurse);
                status = BT_FUNC_STATUS_ERROR;
@@ -666,6 +653,7 @@ enum bt_plugin_find_all_from_dir_status bt_plugin_find_all_from_dir(
        enum bt_plugin_find_all_from_dir_status status =
                BT_FUNC_STATUS_OK;
 
+       BT_ASSERT_PRE_NO_ERROR();
        BT_ASSERT_PRE_NON_NULL(plugin_set_out, "Plugin set (output)");
        BT_LOGI("Creating all plugins in directory: path=\"%s\", recurse=%d",
                path, recurse);
This page took 0.024572 seconds and 4 git commands to generate.