diff --git a/src/cm_mes/mes_func.c b/src/cm_mes/mes_func.c index 6cbec42bf4cd01e07a25a4f6a2c74a3ee654906a..07866313ba293391465f034082b39f98b4bb80bc 100644 --- a/src/cm_mes/mes_func.c +++ b/src/cm_mes/mes_func.c @@ -31,7 +31,6 @@ #include "mes_tcp.h" #include "cm_date_to_text.h" #include "mes_rpc_dl.h" -#include "mes_rpc_ulog4c.h" #include "cm_defs.h" #include "mes_metadata.h" #include "mes_interface.h" @@ -946,7 +945,6 @@ static inline void mes_close_libdl(void) { if (MES_GLOBAL_INST_MSG.profile.pipe_type == MES_TYPE_RDMA) { FinishOckRpcDl(); - FinishUlogDl(); } } diff --git a/src/cm_mes/mes_rdma_rpc.c b/src/cm_mes/mes_rdma_rpc.c index daecb875f813d399119a0c7a9b48b9aa3ba47297..0162c07d28b1762adaf208fa59da11b0fe9409ce 100644 --- a/src/cm_mes/mes_rdma_rpc.c +++ b/src/cm_mes/mes_rdma_rpc.c @@ -39,8 +39,6 @@ #include "mes_msg_pool.h" #include "mes_interface.h" #include "mes_metadata.h" -#include "mes_rpc_ulog4c.h" -#include "mes_rpc_openssl_dl.h" #include "mes_rpc_dl.h" #include "openssl/x509.h" #include "openssl/x509v3.h" @@ -68,15 +66,7 @@ typedef enum { #define PATH_LENGTH PATH_MAX #define OCK_RPC_ENV_PATH "OCK_RPC_LIB_PATH" -#define ULOG_SO_NAME "libulog.so" -#define OCK_RPC_SO_NAME "librpc_ucx.so" - -// Ulog input param -#define ULOG_FILE_OUTPUT 1 -#define ULOG_ERR_LOG_LEVEL 4 -#define ULOG_DEFAULT_FILE_NAME "ockrpc.log" -#define ULOG_FILE_SIZE (1024 * 1024 * 10ULL) -#define ULOG_FILE_CNT 10 +#define OCK_RPC_SO_NAME "libhcom4db.so" #define ERASE_FULL_1_NUM (0xff) #define ERASE_KEY_PASS_COUNT 30 @@ -146,35 +136,6 @@ static int mes_get_lib_path(char* rpcPath) return CM_SUCCESS; } -static int mes_init_ulog(void) -{ - char logPath[PATH_MAX] = {0}; - char *logPathPtr = logPath; - char path[PATH_MAX] = {0}; -#ifdef WIN32 - if (!_fullpath(path, MES_GLOBAL_INST_MSG.profile.ock_log_path, MES_MAX_LOG_PATH - 1)) { - LOG_RUN_ERR("_fullpath ock_log_path failed"); - return CM_ERROR; - } -#else - if (realpath(MES_GLOBAL_INST_MSG.profile.ock_log_path, path) == NULL) { - LOG_RUN_ERR("realpath ock_log_path failed"); - return CM_ERROR; - } -#endif - if (cm_access_file(path, F_OK | R_OK | W_OK) != CM_SUCCESS) { - LOG_RUN_ERR("access log path(%s) failed.", path); - return CM_ERROR; - } - int ret = snprintf_s(logPath, PATH_MAX, PATH_MAX - 1, "%s/%s", path, ULOG_DEFAULT_FILE_NAME); - if (ret < 0) { - LOG_RUN_ERR("snprintf path(%s) + filename(%s) failed", path, ULOG_DEFAULT_FILE_NAME); - return CM_ERROR; - } - - return ULOG_Init(ULOG_FILE_OUTPUT, ULOG_ERR_LOG_LEVEL, logPathPtr, ULOG_FILE_SIZE, ULOG_FILE_CNT); -} - static int mes_init_rdma_dlopen_so(void) { char rpcPath[PATH_LENGTH] = {0}; @@ -183,19 +144,6 @@ static int mes_init_rdma_dlopen_so(void) return CM_ERROR; } - // init ulog dlopen - char ockUlogDlPath[PATH_LENGTH] = {0}; - ret = snprintf_s(ockUlogDlPath, PATH_LENGTH, PATH_LENGTH - 1, "%s/%s", rpcPath, ULOG_SO_NAME); - if (ret < 0) { - LOG_RUN_ERR("construct ulog dl path failed, ret %d.", ret); - return CM_ERROR; - } - ret = InitUlogDl(ockUlogDlPath, PATH_LENGTH); - if (ret != CM_SUCCESS) { - LOG_RUN_ERR("mes init UlogDl failed."); - return CM_ERROR; - } - // init ockrpc dlopen char ockRpcDlPath[PATH_LENGTH] = {0}; ret = snprintf_s(ockRpcDlPath, PATH_LENGTH, PATH_LENGTH - 1, "%s/%s", rpcPath, OCK_RPC_SO_NAME); @@ -205,28 +153,10 @@ static int mes_init_rdma_dlopen_so(void) } ret = InitOckRpcDl(ockRpcDlPath, PATH_LENGTH); if (ret != CM_SUCCESS) { - FinishUlogDl(); LOG_RUN_ERR("mes init OckRpcDl failed."); return CM_ERROR; } - static bool32 ulog_init = CM_FALSE; - if (!ulog_init) { - ret = mes_init_ulog(); - if (ret != 0) { - LOG_RUN_ERR("ULog_Init failed, ret %d", ret); - FinishOckRpcDl(); - FinishUlogDl(); - return CM_ERROR; - } - ulog_init = CM_TRUE; - } - - if (OpensslDlopenAndSet((const char*)rpcPath) != DL_OPENSSL_OK) { - LOG_RUN_ERR("mes set ock openssl libpath failed."); - return CM_ERROR; - } - return CM_SUCCESS; } @@ -373,7 +303,6 @@ int mes_init_rdma_rpc_resource(void) mes_free_channel_msg_queue(CM_FALSE); mes_free_channels(); FinishOckRpcDl(); - FinishUlogDl(); LOG_RUN_ERR("mes init rdma rpc server failed."); return ret; } @@ -385,7 +314,6 @@ int mes_init_rdma_rpc_resource(void) mes_clear_rdma_rpc_server(); mes_free_channels(); FinishOckRpcDl(); - FinishUlogDl(); LOG_RUN_ERR("[mes]: reg rdma rpc proc func failed."); return ret; } diff --git a/src/cm_mes/mes_rpc_openssl_dl.c b/src/cm_mes/mes_rpc_openssl_dl.c deleted file mode 100644 index 349439ee26a1eed37cd5e04b2cf530ce4c8a6e08..0000000000000000000000000000000000000000 --- a/src/cm_mes/mes_rpc_openssl_dl.c +++ /dev/null @@ -1,83 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Technologies Co.,Ltd. - * - * CBB is licensed under Mulan PSL v2. - * You can use this software according to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * - * http://license.coscl.org.cn/MulanPSL2 - * - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * ------------------------------------------------------------------------- - * - * mes_rpc_openssl_dl.c - * - * - * IDENTIFICATION - * src/cm_mes/mes_rpc_openssl_dl.c - * - * ------------------------------------------------------------------------- - */ -#include "cm_log.h" -#include "cm_utils.h" -#include "cm_file.h" -#include "mes_rpc_openssl_dl.h" - -typedef int (*SetOpensslLibPath)(const char *ssl, const char *crypto); - -#define SSL_SO_NAME "libssl.so" -#define CRYPTO_SO_NAME "libcrypto.so" -#define OPENSSL_DL_SO_NAME "libopenssl_dl.so" -#define PATH_LENGTH PATH_MAX - - -int OpensslDlopenAndSet(const char* path) -{ - char opensslPath[PATH_LENGTH] = {0}; - char* opensslPathPtr = opensslPath; - int ret = snprintf_s(opensslPath, PATH_LENGTH, PATH_LENGTH - 1, "%s/%s", path, OPENSSL_DL_SO_NAME); - if (ret < 0) { - LOG_RUN_ERR("construct opensslPath failed, ret %d.", ret); - return DL_OPENSSL_ERROR; - } - char ockSslPath[PATH_LENGTH] = {0}; - ret = snprintf_s(ockSslPath, PATH_LENGTH, PATH_LENGTH - 1, "%s/%s", path, SSL_SO_NAME); - if (ret < 0) { - LOG_RUN_ERR("construct ockSslPath failed, ret %d.", ret); - return DL_OPENSSL_ERROR; - } - char ockCryptoPath[PATH_LENGTH] = {0}; - ret = snprintf_s(ockCryptoPath, PATH_LENGTH, PATH_LENGTH - 1, "%s/%s", path, CRYPTO_SO_NAME); - if (ret < 0) { - LOG_RUN_ERR("construct ockCryptoPath failed, ret %d.", ret); - return DL_OPENSSL_ERROR; - } - - void* opensslDl; - ret = cm_open_dl(&opensslDl, opensslPathPtr); - if (ret != CM_SUCCESS) { - LOG_RUN_ERR("dlopen openssl_dl error, path(%s)", opensslPathPtr); - return DL_OPENSSL_ERROR; - } - - SetOpensslLibPath setPath; - ret = cm_load_symbol(opensslDl, "SetOpensslDLopenLibPath", (void**)&setPath); - if (ret != CM_SUCCESS) { - cm_close_dl(opensslDl); - LOG_RUN_ERR("dlsym SetOpensslDLopenLibPath error"); - return DL_OPENSSL_ERROR; - } - - ret = setPath(ockSslPath, ockCryptoPath); - if (ret != DL_OPENSSL_OK) { - cm_close_dl(opensslDl); - LOG_RUN_ERR("call SetOpensslDLopenLibPath error"); - return DL_OPENSSL_ERROR; - } - - cm_close_dl(opensslDl); - return DL_OPENSSL_OK; -} \ No newline at end of file diff --git a/src/cm_mes/mes_rpc_openssl_dl.h b/src/cm_mes/mes_rpc_openssl_dl.h deleted file mode 100644 index aec9e6bf2f30125d97a5402f4c51b00b34790ee6..0000000000000000000000000000000000000000 --- a/src/cm_mes/mes_rpc_openssl_dl.h +++ /dev/null @@ -1,61 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Technologies Co.,Ltd. - * - * CBB is licensed under Mulan PSL v2. - * You can use this software according to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * - * http://license.coscl.org.cn/MulanPSL2 - * - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * ------------------------------------------------------------------------- - * - * mes_rpc_openssl_dl.h - * - * - * IDENTIFICATION - * src/cm_mes/mes_rpc_openssl_dl.h - * - * ------------------------------------------------------------------------- - */ -#ifndef OCK_OPENSSL_DL_H -#define OCK_OPENSSL_DL_H - -#include -#include - -#ifdef __cplusplus -extern "C" { -#endif - -static const int DL_OPENSSL_ERROR = -1; -static const int DL_OPENSSL_OK = 1; - -/** - * @brief get the path of libssl.so and libctypto.so of special version of OPENSSL (1.1.1k) - * - * @param path the folder path where libopenssl.so is located - * - * @return DL_OPENSSL_OK for success, DL_OPENSSL_ERROR for failed. - */ -int OpensslDlopenAndSet(const char* path); - -/** - * @brief get the path of libssl.so and libctypto.so of special version of OPENSSL (1.1.1k) - * - * @param ssl the path of libssl.so - * @param crypto the path of libcrypto.so - * - * @return DL_OPENSSL_OK for success, DL_OPENSSL_ERROR for failed. - */ -int SetOpensslDLopenLibPath(const char *ssl, const char *crypto); - - -#ifdef __cplusplus -} -#endif - -#endif \ No newline at end of file diff --git a/src/cm_mes/mes_rpc_ulog4c.h b/src/cm_mes/mes_rpc_ulog4c.h deleted file mode 100644 index 2607f053f0a2dcd6e9ece3eb641d6adf3f1b19ac..0000000000000000000000000000000000000000 --- a/src/cm_mes/mes_rpc_ulog4c.h +++ /dev/null @@ -1,51 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Technologies Co.,Ltd. - * - * CBB is licensed under Mulan PSL v2. - * You can use this software according to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * - * http://license.coscl.org.cn/MulanPSL2 - * - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * ------------------------------------------------------------------------- - * - * mes_rpc_ulog4c.h - * - * - * IDENTIFICATION - * src/cm_mes/mes_rpc_ulog4c.h - * - * ------------------------------------------------------------------------- - */ -#ifndef PLATFORM_UTILITIES_REMOTE_ULOG_H -#define PLATFORM_UTILITIES_REMOTE_ULOG_H - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * @brief initialize the normal ulog - * - * @param logType - [IN] type of the ulog, could 0 or 1; 0: stdout, 1: file - * @param minLogLevel - [IN] min level of message, 0:trace, 1:debug, 2:info, 3:warn, 4:error, 5:critical - * @param path - [IN] full path of ulog file name - * @param rotationFileSize - [IN] the max file size of a single rotation file - * @param rotationFileSize - [IN] the max count of total rotated file - * - * @return 0 for success, non zero for failure - */ -int ULOG_Init(int logType, int minLogLevel, const char *path, int rotationFileSize, int rotationFileCount); - -int InitUlogDl(char* path, unsigned int len); -void FinishUlogDl(void); - -#if defined(__cplusplus) -} -#endif - -#endif // PLATFORM_UTILITIES_REMOTE_ULOG_H diff --git a/src/cm_mes/mes_rpc_ulog4c_dl.c b/src/cm_mes/mes_rpc_ulog4c_dl.c deleted file mode 100644 index cb62bccc8558d6bcde968d050c6b2133bb7ddbbe..0000000000000000000000000000000000000000 --- a/src/cm_mes/mes_rpc_ulog4c_dl.c +++ /dev/null @@ -1,87 +0,0 @@ -/* - * Copyright (c) 2022 Huawei Technologies Co.,Ltd. - * - * CBB is licensed under Mulan PSL v2. - * You can use this software according to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * - * http://license.coscl.org.cn/MulanPSL2 - * - * THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, - * MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * ------------------------------------------------------------------------- - * - * mes_rpc_ulog4c_dl.c - * - * - * IDENTIFICATION - * src/cm_mes/mes_rpc_ulog4c_dl.c - * - * ------------------------------------------------------------------------- - */ -#include "cm_defs.h" -#include "cm_log.h" -#include "cm_utils.h" - -typedef int (*ULOGDL_Init)(int logType, int minLogLevel, const char *path, int rotationFileSize, int rotationFileCount); - -typedef struct UlogFunc { - ULOGDL_Init init; -} UlogFuncPtr; - -void* g_ulogDl = NULL; -UlogFuncPtr g_ulogFunc; - -#define RETURN_OK 0 -#define RETURN_ERR (-1) - -int InitUlogDl(char* path, unsigned int len) -{ - if (path == NULL || len == 0) { - LOG_RUN_ERR("ulog path is nullptr"); - return RETURN_ERR; - } - - int ret = RETURN_OK; - if (g_ulogDl != NULL) { - return RETURN_OK; - } - - ret = cm_open_dl(&g_ulogDl, path); - if (ret != CM_SUCCESS) { - LOG_RUN_ERR("dlopen ulog error"); - return RETURN_ERR; - } - - ret = cm_load_symbol(g_ulogDl, "ULOG_Init", (void**)&g_ulogFunc.init); - if (ret != CM_SUCCESS) { - return RETURN_ERR; - } - - return ret; -} - -void FinishUlogDl(void) -{ - if (g_ulogDl != NULL) { - cm_close_dl(g_ulogDl); - g_ulogDl = NULL; - } - - if (memset_sp(&g_ulogFunc, sizeof(g_ulogFunc), 0, sizeof(g_ulogFunc)) != EOK) { - LOG_RUN_ERR("memset_sp failed"); - } -} - -int ULOG_Init(int logType, int minLogLevel, const char *path, int rotationFileSize, int rotationFileCount) -{ - int ret; - if (g_ulogFunc.init != NULL) { - ret = g_ulogFunc.init(logType, minLogLevel, path, rotationFileSize, rotationFileCount); - } else { - ret = RETURN_ERR; - } - return ret; -} \ No newline at end of file