Skip to content

Commit

Permalink
lib: remove plugin's ABI version
Browse files Browse the repository at this point in the history
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 <eeppeliteloop@gmail.com>
Change-Id: I4e9658f7d2216f43d872e3acd072dbdf588abe46
Reviewed-on: https://review.lttng.org/c/babeltrace/+/2220
Tested-by: jenkins <jenkins@lttng.org>
Reviewed-by: Francis Deslauriers <francis.deslauriers@efficios.com>
  • Loading branch information
eepp committed Oct 22, 2019
1 parent fbfccb2 commit 7c0244d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 34 deletions.
15 changes: 0 additions & 15 deletions include/babeltrace2/plugin/plugin-dev.h
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -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));
Expand Down Expand Up @@ -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
Expand Down
21 changes: 2 additions & 19 deletions src/lib/plugin/plugin-so.c
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 7c0244d

Please sign in to comment.