From f488daa2dcd1cc728456e00bf19200fb6b3a5d0d Mon Sep 17 00:00:00 2001 From: Philippe Proulx Date: Fri, 18 Oct 2019 13:47:27 -0400 Subject: [PATCH] lib: remove plugin's ABI version MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit We don't need this version property. We intend for Babeltrace 2.y to be able to load any plugin written for Babeltrace 2.x, where y ≥ x. With this patch, `struct __bt_plugin_descriptor` only contains the plugin's name, because this is the only required property. Optional properties are within an array of plugin descriptor attributes (`struct __bt_plugin_descriptor_attribute`). Each plugin descriptor attribute has a type (`enum __bt_plugin_descriptor_attribute_type`), so this is how we can introduce new, optional plugin properties, instead of relying on some ABI version. The same goes for component class attributes (`struct __bt_plugin_component_class_descriptor_attribute`) and their type (`enum __bt_plugin_component_class_descriptor_attribute_type`). Signed-off-by: Philippe Proulx Change-Id: I4e9658f7d2216f43d872e3acd072dbdf588abe46 Reviewed-on: https://review.lttng.org/c/babeltrace/+/2220 Tested-by: jenkins Reviewed-by: Francis Deslauriers --- include/babeltrace2/plugin/plugin-dev.h | 15 --------------- src/lib/plugin/plugin-so.c | 21 ++------------------- 2 files changed, 2 insertions(+), 34 deletions(-) diff --git a/include/babeltrace2/plugin/plugin-dev.h b/include/babeltrace2/plugin/plugin-dev.h index 85c3ef7f..0db0f6bf 100644 --- a/include/babeltrace2/plugin/plugin-dev.h +++ b/include/babeltrace2/plugin/plugin-dev.h @@ -50,13 +50,6 @@ extern "C" { #endif -/* - * Plugin interface's version, not synced with Babeltrace's version - * (internal use). - */ -#define __BT_PLUGIN_VERSION_MAJOR 1 -#define __BT_PLUGIN_VERSION_MINOR 0 - /* Plugin initialization function type */ typedef enum bt_plugin_initialize_func_status { BT_PLUGIN_INITIALIZE_FUNC_STATUS_OK = __BT_FUNC_STATUS_OK, @@ -72,12 +65,6 @@ typedef void (*bt_plugin_finalize_func)(void); /* Plugin descriptor: describes a single plugin (internal use) */ struct __bt_plugin_descriptor { - /* Plugin's interface major version number */ - uint32_t major; - - /* Plugin's interface minor version number */ - uint32_t minor; - /* Plugin's name */ const char *name; } __attribute__((packed)); @@ -433,8 +420,6 @@ struct __bt_plugin_component_class_descriptor_attribute const * const *__bt_get_ */ #define BT_PLUGIN_WITH_ID(_id, _name) \ struct __bt_plugin_descriptor __bt_plugin_descriptor_##_id = { \ - .major = __BT_PLUGIN_VERSION_MAJOR, \ - .minor = __BT_PLUGIN_VERSION_MINOR, \ .name = _name, \ }; \ static struct __bt_plugin_descriptor const * const __bt_plugin_descriptor_##_id##_ptr __BT_PLUGIN_DESCRIPTOR_ATTRS = &__bt_plugin_descriptor_##_id diff --git a/src/lib/plugin/plugin-so.c b/src/lib/plugin/plugin-so.c index 00e51b50..bbd91692 100644 --- a/src/lib/plugin/plugin-so.c +++ b/src/lib/plugin/plugin-so.c @@ -1336,25 +1336,8 @@ int bt_plugin_so_create_all_from_sections( continue; } - BT_LOGI("Creating plugin object for plugin: " - "name=\"%s\", abi-major=%d, abi-minor=%d", - descriptor->name, descriptor->major, descriptor->minor); - - if (descriptor->major > __BT_PLUGIN_VERSION_MAJOR) { - if (fail_on_load_error) { - BT_LIB_LOGW_APPEND_CAUSE( - "Unknown ABI major version: abi-major=%d", - descriptor->major); - status = BT_FUNC_STATUS_ERROR; - goto error; - } else { - BT_LIB_LOGW( - "Unknown ABI major version: abi-major=%d", - descriptor->major); - continue; - } - } - + BT_LOGI("Creating plugin object for plugin: name=\"%s\"", + descriptor->name); plugin = bt_plugin_so_create_empty(shared_lib_handle); if (!plugin) { BT_LIB_LOGE_APPEND_CAUSE( -- 2.34.1