From 5caf40afcde3dedf0586da58da96976d270d4be7 Mon Sep 17 00:00:00 2001 From: Chanwoo Choi Date: Tue, 2 Feb 2021 17:49:34 +0900 Subject: [PATCH] halapi: Update error log for providing the more correct debugging info Update error log for providing the more correct debugging info without any behavior changes. Change-Id: Icfc9f72fd971e970457e3dbb2d8bb5eb10a61743 Signed-off-by: Chanwoo Choi --- src/hal-api-common.c | 72 +++++++++++++++++++++++++++------------------------- 1 file changed, 37 insertions(+), 35 deletions(-) diff --git a/src/hal-api-common.c b/src/hal-api-common.c index c8fdccd..6492aae 100644 --- a/src/hal-api-common.c +++ b/src/hal-api-common.c @@ -45,7 +45,7 @@ const char *hal_common_get_backend_library_name(enum hal_module module) info = _hal_api_conf_get_module_info(module); if (info == NULL) { - _E("Failed to get module inforamtion\n"); + _E("Failed to get HAL module(%d) information\n", module); return NULL; } @@ -56,8 +56,7 @@ const char *hal_common_get_backend_library_name(enum hal_module module) #endif if (!library_name) { - _E("%s backend library name is NULL\n", - info->module_name); + _E("%s backend library name is NULL\n", info->module_name); return NULL; } return library_name; @@ -76,13 +75,12 @@ const char *hal_common_get_backend_symbol_name(enum hal_module module) info = _hal_api_conf_get_module_info(module); if (info == NULL) { - _E("Failed to get module information\n"); + _E("Failed to get HAL module(%d) information\n", module); return NULL; } if (!info->symbol_name) { - _E("%s backend library name is NULL\n", - info->module_name); + _E("%s backend library name is NULL\n", info->module_name); return NULL; } @@ -100,7 +98,7 @@ int hal_common_get_backend(enum hal_module module, void **data) info = _hal_api_conf_get_module_info(module); if (info == NULL) { - _E("Failed to get module information\n"); + _E("Failed to get HAL module(%d) information\n", module); ret = TIZEN_ERROR_UNKNOWN; goto err; } @@ -108,20 +106,21 @@ int hal_common_get_backend(enum hal_module module, void **data) /* Load module */ library_name = hal_common_get_backend_library_name(module); if (!library_name) { - _E("Failed to get backend library name of %s\n", + _E("%s: Failed to get backend library name\n", info->module_name); return TIZEN_ERROR_INVALID_PARAMETER; } handle = dlopen(library_name, RTLD_LAZY); if (!handle) { - _E("Failed to load shared library (%s)\n", dlerror()); + _E("%s: Failed to load shared library (%s)\n", + info->module_name, dlerror()); return TIZEN_ERROR_INVALID_PARAMETER; } symbol_name = hal_common_get_backend_symbol_name(module); if (!symbol_name) { - _E("Failed to get backend symbol name of %s\n", + _E("%s: Failed to get backend symbol name\n", info->module_name); ret = TIZEN_ERROR_INVALID_PARAMETER; goto err; @@ -129,17 +128,16 @@ int hal_common_get_backend(enum hal_module module, void **data) backend = dlsym(handle, symbol_name); if (!backend) { - _E("Failed to find backend data (%s)\n", dlerror()); + _E("%s: Failed to find backend data (%s)\n", + info->module_name, dlerror()); ret = TIZEN_ERROR_INVALID_PARAMETER; goto err; } - /* Print backend module and vendor name */ - /* Check HAL ABI Version */ ret = hal_common_check_backend_abi_version(module, backend->abi_version); if (ret < 0) { - _E("Failed to check ABI version of %s\n", + _E("%s: Failed to check ABI version\n", info->module_name); ret = TIZEN_ERROR_INVALID_PARAMETER; goto err; @@ -147,7 +145,7 @@ int hal_common_get_backend(enum hal_module module, void **data) /* Get the backend module data */ if (!backend->init) { - _E("hal_backend->init() is NULL for %s\n", + _E("%s: hal_backend->init() is NULL\n", info->module_name); ret = TIZEN_ERROR_INVALID_PARAMETER; goto err; @@ -155,8 +153,8 @@ int hal_common_get_backend(enum hal_module module, void **data) ret = backend->init(data); if (ret < 0) { - _E("Failed to initialize backend: name(%s)/vendor(%s)\n", - backend->name, backend->vendor); + _E("%s: Failed to initialize backend: name(%s)/vendor(%s)\n", + info->module_name, backend->name, backend->vendor); ret = TIZEN_ERROR_INVALID_PARAMETER; goto err; } @@ -164,8 +162,8 @@ int hal_common_get_backend(enum hal_module module, void **data) info->library_backend = backend; info->library_handle = handle; - _I("Get HAL backend: name(%s)/vendor(%s)\n", - backend->name, backend->vendor); + _I("%s: Get HAL backend: name(%s)/vendor(%s)\n", + info->module_name, backend->name, backend->vendor); return TIZEN_ERROR_NONE; err: @@ -189,7 +187,7 @@ int hal_common_put_backend(enum hal_module module, void *data) info = _hal_api_conf_get_module_info(module); if (info == NULL) { - _E("Failed to get module information\n"); + _E("Failed to get HAL module(%d) information\n", module); return TIZEN_ERROR_UNKNOWN; } @@ -197,21 +195,21 @@ int hal_common_put_backend(enum hal_module module, void *data) handle = info->library_handle; if (!backend) { - _I("Already fully put for HAL module (%d)\n", module); + _I("%s: Already fully put for HAL module\n", info->module_name); return TIZEN_ERROR_NONE; } if (backend->exit) { ret = backend->exit(data); if (ret < 0) { - _E("Failed to exit backend: name(%s)/vendor(%s)\n", - backend->name, backend->vendor); + _E("%s: Failed to exit backend: name(%s)/vendor(%s)\n", + info->module_name, backend->name, backend->vendor); return TIZEN_ERROR_INVALID_PARAMETER; } } - _I("Put HAL backend: name(%s)/vendor(%s)\n", - backend->name, backend->vendor); + _I("%s: Put HAL backend: name(%s)/vendor(%s)\n", + info->module_name, backend->name, backend->vendor); if (handle) dlclose(handle); @@ -231,32 +229,33 @@ int hal_common_check_backend_abi_version(enum hal_module module, /* Check parameter whether is valid or not */ if (module <= HAL_MODULE_UNKNOWN || module >= HAL_MODULE_END) { - _E("Invalid paramer of HAL module (%d)\n", module); + _E("Invalid paramer of HAL module(%d)\n", module); return TIZEN_ERROR_INVALID_PARAMETER; } if (abi_version <= HAL_ABI_VERSION_UNKNOWN || abi_version >= HAL_ABI_VERSION_END) { - _E("Invalid paramer of HAL ABI version (%d)\n", abi_version); + _E("Invalid paramer of HAL ABI version(%d) for HAL module(%d)\n", + abi_version, module); return TIZEN_ERROR_INVALID_PARAMETER; } info = _hal_api_conf_get_module_info(module); if (info == NULL) { - _E("Failed to get module information\n"); + _E("Failed to get HAL module(%d) information\n", module); return TIZEN_ERROR_UNKNOWN; } /* Check abi_version whether is supported or not */ if (!info->hal_api) { - _E("HAL module(%d) doesn't support HAL API\n", module); + _E("%s: Doesn't support HAL API\n", info->module_name); return TIZEN_ERROR_INVALID_PARAMETER; } if (!info->num_abi_versions || !info->abi_versions) { - _E("HAL module(%d) doesn't have the ABI version information\n", - module); + _E("%s: Doesn't have the ABI version information\n", + info->module_name); return TIZEN_ERROR_INVALID_PARAMETER; } @@ -270,8 +269,8 @@ int hal_common_check_backend_abi_version(enum hal_module module, if (data->backend_min_abi_version <= HAL_ABI_VERSION_UNKNOWN || data->backend_min_abi_version >= HAL_ABI_VERSION_END) { - _E("wrong data in backend_min_abi_version %d\n", - data->backend_min_abi_version); + _E("%s: abi_versions[%d].backend_min_abi_version(%d) is invalid\n", + info->module_name, i, data->backend_min_abi_version); return TIZEN_ERROR_INVALID_PARAMETER; } @@ -279,9 +278,12 @@ int hal_common_check_backend_abi_version(enum hal_module module, && abi_version >= data->backend_min_abi_version) return TIZEN_ERROR_NONE; - _E("%s doesn't support %s of HAL Backend\n", hal_abi_version_str[g_platform_curr_abi_version], + _E("%s: \'%s\' doesn't support \'%s\'\n", + info->module_name, + hal_abi_version_str[g_platform_curr_abi_version], hal_abi_version_str[abi_version]); - _E("Must use the following ABI versions from %s to %s\n", + _E("%s: Must use ABI versions from \'%s\' to \'%s\'\n", + info->module_name, hal_abi_version_str[data->backend_min_abi_version], hal_abi_version_str[data->platform_abi_version]); } -- 2.7.4