From 59a9b0290e527d4e635a0ccb4a7280de6e93473b Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Thu, 14 Mar 2024 17:04:43 +0900 Subject: [PATCH] plugin-api: common: Remove abi_version module system-plugin-backend packcages don't need to check the ABI (Application Binary Interface) version because libsyscommon-plugin-api and system-plguin-backend packages have been built always together. Change-Id: I45272586624a0449e9b86cb33a912a99a1e5dbcb Signed-off-by: Chanwoo Choi --- .../syscommon-plugin-common-interface.h | 16 --- .../include/system/syscommon-plugin-common.h | 18 --- src/plugin-api/common/src/common.h | 23 ---- .../common/src/syscommon-plugin-api-common.c | 124 +----------------- .../common/src/syscommon-plugin-api-conf.c | 8 -- .../common/src/syscommon-plugin-api-conf.h | 2 - .../common/src/syscommon-plugin-api-list.h | 61 +-------- 7 files changed, 8 insertions(+), 244 deletions(-) diff --git a/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h b/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h index 7172d65..a30f700 100644 --- a/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h +++ b/src/plugin-api/common/include/system/syscommon-plugin-common-interface.h @@ -29,25 +29,9 @@ extern "C" { #endif -enum syscommon_plugin_abi_version { - SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN = 0, - SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_7_0, - SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0, - SYSCOMMON_PLUGIN_ABI_VERSION_END, -}; - -static const char *const syscommon_plugin_abi_version_str[] = { - [SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN] = "Unknown PLUGIN ABI Version", - [SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_7_0] = "PLUGIN_ABI_VERSION_TIZEN_7_0", - [SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0] = "PLUGIN_ABI_VERSION_TIZEN_8_0", - [SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0] = "PLUGIN_ABI_VERSION_TIZEN_9_0", -}; - typedef struct __syscommon_plugin_backend { const char *name; const char *vendor; - const unsigned int abi_version; int (*init) (void **data); int (*exit) (void *data); } syscommon_plugin_backend; diff --git a/src/plugin-api/common/include/system/syscommon-plugin-common.h b/src/plugin-api/common/include/system/syscommon-plugin-common.h index 81d1081..7993c08 100644 --- a/src/plugin-api/common/include/system/syscommon-plugin-common.h +++ b/src/plugin-api/common/include/system/syscommon-plugin-common.h @@ -105,24 +105,6 @@ int syscommon_plugin_common_put_backend_with_library_name( enum syscommon_plugin_module module, void *data, const char *library_name); -/** - * @brief Check PLUGIN ABI version whehter is suppored or not on current platform - * @param[in] PLUGIN module id among enum plugin_moudle - * @param[in] PLUGIN ABI version of backend module among enum plugin_abi_version - * @return @c 0 on success, otherwise a negative error value - */ -int syscommon_plugin_common_check_backend_abi_version( - enum syscommon_plugin_module module, - enum syscommon_plugin_abi_version abi_version); - -/** - * @brief Get the backend PLUGIN ABI version according to the type of PLUGIN module - * @param[in] PLUGIN module id among enum plugin_moudle - * @return @c positive integer value on success, otherwise a zero error value - */ -unsigned int syscommon_plugin_common_get_backend_abi_version( - enum syscommon_plugin_module module); - /** * @brief Get the backend name according to the type of PLUGIN module * @param[in] PLUGIN module id among enum plugin_moudle diff --git a/src/plugin-api/common/src/common.h b/src/plugin-api/common/src/common.h index e654ddc..d6a370d 100644 --- a/src/plugin-api/common/src/common.h +++ b/src/plugin-api/common/src/common.h @@ -58,26 +58,6 @@ static const char *const plugin_group_string[] = { [PLUGIN_GROUP_UPDATE_CONTROL] = "PLUGIN_GROUP_UPDATE_CONTROL", }; -/** - * syscommon-plugin-api-common provides the PLUGIN ABI * (Application Binary Interface) - * version check feature which is used to check the ABI compatibility between - * PLUGIN API package and PLUGIN backend package. - * In order to compare ABI version between two binary, Tizen core platform - * always must maintain the current PLUGIN ABI version. - * So that, define the below global variable (g_platform_curr_abi_version). - * - * 'g_platform_curr_abi_version' will be used for all PLUGIN API modules, - * to check whether PLUGIN backend ABI version of each module is supported - * or not with current PLUGIN ABI version. - * - * 'g_platform_curr_abi_version' must be updated when Tizen platform will be - * released officially. - */ -struct plugin_abi_version_match { - enum syscommon_plugin_abi_version platform_abi_version; - enum syscommon_plugin_abi_version backend_min_abi_version; -}; - struct __plugin_module_info { int usage_count; @@ -92,9 +72,6 @@ struct __plugin_module_info { void *handle; syscommon_plugin_backend *backend; char *symbol_name; - - unsigned int num_abi_versions; - struct plugin_abi_version_match *abi_versions; }; static inline const char* get_backend_library_name(struct __plugin_module_info *info) diff --git a/src/plugin-api/common/src/syscommon-plugin-api-common.c b/src/plugin-api/common/src/syscommon-plugin-api-common.c index a22bdad..6127858 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-common.c +++ b/src/plugin-api/common/src/syscommon-plugin-api-common.c @@ -46,7 +46,6 @@ extern char *program_invocation_name; #define EXPORT __attribute__ ((visibility("default"))) #endif -static enum syscommon_plugin_abi_version g_platform_curr_abi_version; G_LOCK_DEFINE_STATIC(plugin_common_lock); EXPORT @@ -234,14 +233,6 @@ static int __init_backend(struct __plugin_module_info *info, void **data, return -EINVAL; } - /* Check PLUGIN ABI Version */ - ret = syscommon_plugin_common_check_backend_abi_version(info->module, - info->backend->abi_version); - if (ret < 0) { - _E("%s: Failed to check ABI version\n", info->module_name); - return -EINVAL; - } - /* Initialize backend */ ret = info->backend->init(data); if (ret < 0) { @@ -399,7 +390,7 @@ out: return ret; } -static int __get_backend_data(enum syscommon_plugin_module module, unsigned int *abi_version, +static int __get_backend_data(enum syscommon_plugin_module module, char *name, int name_size, char *vendor, int vendor_size) { struct __plugin_module_info *info = NULL; @@ -413,14 +404,14 @@ static int __get_backend_data(enum syscommon_plugin_module module, unsigned int G_LOCK(plugin_common_lock); if (_plugin_api_conf_init()) { - ret = SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN; + ret = -EINVAL; goto err_unlock; } info = _plugin_api_conf_get_module_info(module, NULL); if (info == NULL) { _E("Failed to get PLUGIN module(%d) information\n", module); - ret = SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN; + ret = -EINVAL; goto err_conf_exit; } @@ -428,12 +419,8 @@ static int __get_backend_data(enum syscommon_plugin_module module, unsigned int if (ret < 0) goto err_conf_exit; - /* Return abi_verion of plugin_backend structure */ - if (!name_size && !vendor_size) { - *abi_version = info->backend->abi_version; - /* Return name of plugin_backend structure */ - } else if (info->backend->name && name_size && !vendor_size) { + if (info->backend->name && name_size && !vendor_size) { len = strlen(info->backend->name); if (!info->backend->name || (len + 1 > name_size)) { @@ -495,115 +482,16 @@ int syscommon_plugin_common_put_backend_with_library_name(enum syscommon_plugin_ return __put_backend(module, data, library_name); } -EXPORT -int syscommon_plugin_common_check_backend_abi_version(enum syscommon_plugin_module module, - enum syscommon_plugin_abi_version abi_version) -{ - struct __plugin_module_info *info = NULL; - int i; - int ret; - - /* Check parameter whether is valid or not */ - if (module <= SYSCOMMON_PLUGIN_MODULE_UNKNOWN || module >= SYSCOMMON_PLUGIN_MODULE_END) { - _E("Invalid paramer of PLUGIN module(%d)\n", module); - return -EINVAL; - } - - if (abi_version <= SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN - || abi_version >= SYSCOMMON_PLUGIN_ABI_VERSION_END) { - _E("Invalid paramer of PLUGIN ABI version(%d) for PLUGIN module(%d)\n", - abi_version, module); - return -EINVAL; - } - - if (_plugin_api_conf_init()) - return -EINVAL; - - info = _plugin_api_conf_get_module_info(module, NULL); - if (info == NULL) { - _E("Failed to get PLUGIN module(%d) information\n", module); - ret = -EINVAL; - goto out; - } - - if (!info->num_abi_versions - || !info->abi_versions) { - _E("%s: Doesn't have the ABI version information\n", - info->module_name); - ret = -EINVAL; - goto out; - } - - g_platform_curr_abi_version = _plugin_api_conf_get_platform_abi_version(); - - if (g_platform_curr_abi_version <= SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN - || g_platform_curr_abi_version >= SYSCOMMON_PLUGIN_ABI_VERSION_END) { - _E("Invalid paramer of current PLUGIN ABI version(%d)(%d)\n", - g_platform_curr_abi_version, module); - ret = -EINVAL; - goto out; - } - - for (i = 0; i < info->num_abi_versions; i++) { - struct plugin_abi_version_match *data - = &info->abi_versions[i]; - - if (g_platform_curr_abi_version != data->platform_abi_version) - continue; - - if (data->backend_min_abi_version <= SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN || - data->backend_min_abi_version >= SYSCOMMON_PLUGIN_ABI_VERSION_END) { - _E("%s: abi_versions[%d].backend_min_abi_version(%d) is invalid\n", - info->module_name, i, data->backend_min_abi_version); - ret = -EINVAL; - goto out; - } - - if (abi_version <= data->platform_abi_version - && abi_version >= data->backend_min_abi_version) { - ret = 0; - goto out; - } - - _E("%s: \'%s\' doesn't support \'%s\'\n", - info->module_name, - syscommon_plugin_abi_version_str[g_platform_curr_abi_version], - syscommon_plugin_abi_version_str[abi_version]); - _E("%s: Must use ABI versions from \'%s\' to \'%s\'\n", - info->module_name, - syscommon_plugin_abi_version_str[data->backend_min_abi_version], - syscommon_plugin_abi_version_str[data->platform_abi_version]); - } - ret = -EINVAL; - -out: - _plugin_api_conf_exit(); - return ret; -} - -EXPORT -unsigned int syscommon_plugin_common_get_backend_abi_version(enum syscommon_plugin_module module) -{ - unsigned int abi_version; - int ret; - - ret = __get_backend_data(module, &abi_version, NULL, 0, NULL, 0); - if (ret < 0) - return SYSCOMMON_PLUGIN_ABI_VERSION_UNKNOWN; - - return abi_version; -} - EXPORT int syscommon_plugin_common_get_backend_name(enum syscommon_plugin_module module, char *name, int size) { - return __get_backend_data(module, NULL, name, size, NULL, 0); + return __get_backend_data(module, name, size, NULL, 0); } EXPORT int syscommon_plugin_common_get_backend_vendor(enum syscommon_plugin_module module, char *vendor, int size) { - return __get_backend_data(module, NULL, NULL, 0, vendor, size); + return __get_backend_data(module, NULL, 0, vendor, size); } diff --git a/src/plugin-api/common/src/syscommon-plugin-api-conf.c b/src/plugin-api/common/src/syscommon-plugin-api-conf.c index fe64d8d..af97e88 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-conf.c +++ b/src/plugin-api/common/src/syscommon-plugin-api-conf.c @@ -128,8 +128,6 @@ static struct __plugin_module_info* _get_module_info_with_library_name( new_info->library_name = g_strdup_printf("/usr/lib/system/plugin/%s", library_name); #endif new_info->symbol_name = g_strdup(info->symbol_name); - new_info->num_abi_versions = info->num_abi_versions; - new_info->abi_versions = info->abi_versions; g_hash_table_insert(_module_hash, (gpointer)library_name, new_info); @@ -152,12 +150,6 @@ struct __plugin_module_info* _plugin_api_conf_get_module_info(enum syscommon_plu return _get_module_info_with_library_name(module, library_name); } - -enum syscommon_plugin_abi_version _plugin_api_conf_get_platform_abi_version(void) -{ - return g_platform_curr_abi_version; -} - EXPORT int _plugin_api_conf_init(void) { diff --git a/src/plugin-api/common/src/syscommon-plugin-api-conf.h b/src/plugin-api/common/src/syscommon-plugin-api-conf.h index 17dbbe8..a723961 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-conf.h +++ b/src/plugin-api/common/src/syscommon-plugin-api-conf.h @@ -41,8 +41,6 @@ struct __plugin_module_info *_plugin_api_conf_get_module_info( enum syscommon_plugin_module module, const char *library_name); -enum syscommon_plugin_abi_version _plugin_api_conf_get_platform_abi_version(void); - #ifdef __cplusplus } #endif /* __cplusplus */ diff --git a/src/plugin-api/common/src/syscommon-plugin-api-list.h b/src/plugin-api/common/src/syscommon-plugin-api-list.h index 7904b87..8161a31 100644 --- a/src/plugin-api/common/src/syscommon-plugin-api-list.h +++ b/src/plugin-api/common/src/syscommon-plugin-api-list.h @@ -29,51 +29,6 @@ #include "common.h" -#define PLUGIN_ABI_VERSION_MAX 10 - -enum syscommon_plugin_abi_version g_platform_curr_abi_version = - SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0; - -static struct plugin_abi_version_match abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_END][PLUGIN_ABI_VERSION_MAX] = { - [SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK] = { - [0] = { - .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - }, - }, - /* PLUGIN_GROUP_DEVICED */ - [SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY] = { - [0] = { - .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - }, - }, - [SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT] = { - [0] = { - .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - }, - }, - [SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY] = { - [0] = { - .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - }, - }, - [SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING] = { - [0] = { - .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_8_0, - }, - }, - [SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL] = { - [0] = { - .platform_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0, - .backend_min_abi_version = SYSCOMMON_PLUGIN_ABI_VERSION_TIZEN_9_0, - }, - }, -}; - static struct __plugin_module_info g_plugin_module_info[] = { [SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK] = { .group = PLUGIN_GROUP_RESOURCED, @@ -84,8 +39,6 @@ static struct __plugin_module_info g_plugin_module_info[] = { .library_name = "/usr/lib/system/plugin/libplugin-backend-resourced-memory-lmk.so", .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-resourced-memory-lmk.so", .symbol_name = "system_plugin_backend_resourced_memory_lmk_data", - .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK]), - .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_MEMORY_LMK], }, [SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY] = { .group = PLUGIN_GROUP_DEVICED, @@ -96,8 +49,6 @@ static struct __plugin_module_info g_plugin_module_info[] = { .library_name = "/usr/lib/system/plugin/libplugin-backend-deviced-battery.so", .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-deviced-battery.so", .symbol_name = "system_plugin_backend_deviced_battery_data", - .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY]), - .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_BATTERY], }, [SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT] = { .group = PLUGIN_GROUP_DEVICED, @@ -108,8 +59,6 @@ static struct __plugin_module_info g_plugin_module_info[] = { .library_name = "/usr/lib/system/plugin/libplugin-backend-deviced-input.so", .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-deviced-input.so", .symbol_name = "system_plugin_backend_deviced_input_data", - .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT]), - .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_INPUT], }, [SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY] = { .group = PLUGIN_GROUP_DEVICED, @@ -120,8 +69,6 @@ static struct __plugin_module_info g_plugin_module_info[] = { .library_name = "/usr/lib/system/plugin/libplugin-backend-deviced-display.so", .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-deviced-display.so", .symbol_name = "system_plugin_backend_deviced_display_data", - .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY]), - .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_DEVICED_DISPLAY], }, [SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING] = { .group = PLUGIN_GROUP_RESOURCED, @@ -132,20 +79,16 @@ static struct __plugin_module_info g_plugin_module_info[] = { .library_name = "/usr/lib/system/plugin/libplugin-backend-resourced-cpu-boosting.so", .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-resourced-cpu-boosting.so", .symbol_name = "system_plugin_backend_resourced_cpu_boosting_data", - .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING]), - .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_RESOURCED_CPU_BOOSTING], }, [SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL] = { - .group = PLUGIN_GROUP_UPDATE_CONTROL, - .module = SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL, + .group = PLUGIN_GROUP_UPDATE_CONTROL, + .module = SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL, .license = PLUGIN_LICENSE_APACHE_2_0, .module_name = "SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL", .backend_module_name = "update-control", .library_name = "/usr/lib/system/plugin/libplugin-backend-update-control.so", .library_name_64bit = "/usr/lib64/system/plugin/libplugin-backend-update-control.so", .symbol_name = "system_plugin_backend_update_control_data", - .num_abi_versions = ARRAY_SIZE(abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL]), - .abi_versions = abi_version_match_data[SYSCOMMON_PLUGIN_MODULE_UPDATE_CONTROL], }, }; -- 2.34.1