diff --git a/baselib/msglib/BUILD.gn b/baselib/msglib/BUILD.gn index f0fe37354d204b856d812fe13ec6b93ca44a28d8..083efd2b1cba0faa3c62f167f20190c13ab0c577 100644 --- a/baselib/msglib/BUILD.gn +++ b/baselib/msglib/BUILD.gn @@ -23,7 +23,6 @@ ohos_static_library("messenger_static") { include_dirs = [ "include", "src/common", - "src/utils", ] sources = [ diff --git a/baselib/msglib/src/utils/messenger_utils.c b/baselib/msglib/src/common/messenger_utils.c similarity index 100% rename from baselib/msglib/src/utils/messenger_utils.c rename to baselib/msglib/src/common/messenger_utils.c diff --git a/baselib/msglib/src/utils/messenger_utils.h b/baselib/msglib/utils/messenger_utils.h similarity index 100% rename from baselib/msglib/src/utils/messenger_utils.h rename to baselib/msglib/utils/messenger_utils.h diff --git a/baselib/utils/include/utils_log.h b/baselib/utils/include/utils_log.h index 0ec4343828f266f2a510b4f3e5d05b268f177228..4cbf33a3709b855856b24e27f62f39e577772f64 100644 --- a/baselib/utils/include/utils_log.h +++ b/baselib/utils/include/utils_log.h @@ -18,7 +18,6 @@ #include "hilog/log.h" -#ifndef __cplusplus #ifdef LOG_TAG #undef LOG_TAG #endif @@ -35,19 +34,4 @@ #define SECURITY_LOG_ERROR(fmt, ...) HILOG_ERROR(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) #define SECURITY_LOG_FATAL(fmt, ...) HILOG_FATAL(LOG_CORE, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) -#else // __cplusplus -static constexpr OHOS::HiviewDFX::HiLogLabel LABEL = {LOG_CORE, 0xD002F05, "DSLM_SERVICE"}; - -#define SECURITY_LOG_DEBUG(fmt, ...) \ - OHOS::HiviewDFX::HiLog::Debug(LABEL, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) -#define SECURITY_LOG_INFO(fmt, ...) \ - OHOS::HiviewDFX::HiLog::Info(LABEL, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) -#define SECURITY_LOG_WARN(fmt, ...) \ - OHOS::HiviewDFX::HiLog::Warn(LABEL, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) -#define SECURITY_LOG_ERROR(fmt, ...) \ - OHOS::HiviewDFX::HiLog::Error(LABEL, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) -#define SECURITY_LOG_FATAL(fmt, ...) \ - OHOS::HiviewDFX::HiLog::Fatal(LABEL, "[%{public}s]:" fmt, __func__, ##__VA_ARGS__) - -#endif // __cplusplus #endif // SEC_UTILS_LOG_H diff --git a/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp b/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp index 443f1105eed20af086ea89ce6910ea2c9ade3132..4b4538ebe404039fd2b1831880011f28754569c8 100644 --- a/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp +++ b/interfaces/inner_api/src/standard/device_security_level_callback_helper.cpp @@ -60,7 +60,7 @@ bool DeviceSecurityLevelCallbackHelper::Publish(const DeviceIdentify &identity, auto result = holder_.PushCallback(identity, callback, keep, cookie); if (!result) { - HiLog::Error(LABEL, "DeviceSecurityLevelCallbackHelper::PushCallback failed"); + HILOG_ERROR(LOG_CORE, "DeviceSecurityLevelCallbackHelper::PushCallback failed"); return false; } @@ -76,7 +76,7 @@ bool DeviceSecurityLevelCallbackHelper::Withdraw(uint32_t cookie) auto result = holder_.PopCallback(cookie); if (!result) { - HiLog::Error(LABEL, "DeviceSecurityLevelCallbackHelper::withdraw failed"); + HILOG_ERROR(LOG_CORE, "DeviceSecurityLevelCallbackHelper::withdraw failed"); return false; } return true; @@ -89,7 +89,7 @@ int32_t DeviceSecurityLevelCallbackHelper::OnRemoteRequest(uint32_t code, Messag auto cookie = data.ReadUint32(); auto result = data.ReadUint32(); auto level = data.ReadUint32(); - HiLog::Info(LABEL, "callback cookie %{public}u, result %{public}u, level %{public}u", cookie, result, level); + HILOG_INFO(LOG_CORE, "callback cookie %{public}u, result %{public}u, level %{public}u", cookie, result, level); holder_.PopCallback(cookie, result, level); } @@ -111,7 +111,7 @@ bool DeviceSecurityLevelCallbackHelper::CallbackInfoHolder::PushCallback(const D { std::lock_guard lock(mutex_); if (map_.size() > MAX_CALLBACKS_NUM) { - HiLog::Error(LABEL, "DeviceSecurityLevelCallbackHelper::PushCallback reached max"); + HILOG_ERROR(LOG_CORE, "DeviceSecurityLevelCallbackHelper::PushCallback reached max"); return false; } diff --git a/interfaces/inner_api/src/standard/device_security_level_callback_stub.cpp b/interfaces/inner_api/src/standard/device_security_level_callback_stub.cpp index b1d3b506d253ddb07c1a858a686791017811e2d7..d3b35af4efa9078139df017526c2c71daeb6b5b7 100644 --- a/interfaces/inner_api/src/standard/device_security_level_callback_stub.cpp +++ b/interfaces/inner_api/src/standard/device_security_level_callback_stub.cpp @@ -37,7 +37,7 @@ int32_t DeviceSecurityLevelCallbackStub::OnRemoteRequest(uint32_t code, MessageP MessageOption &option) { if (DeviceSecurityLevelCallbackStub::GetDescriptor() != data.ReadInterfaceToken()) { - HiLog::Error(LABEL, "descriptor not match"); + HILOG_ERROR(LOG_CORE, "descriptor not match"); return SUCCESS; } diff --git a/interfaces/inner_api/src/standard/device_security_level_loader.cpp b/interfaces/inner_api/src/standard/device_security_level_loader.cpp index 1cf59ddc2f2c6f5b66f8af96b3da3709c864b798..c2180fba1d7c8cc2dcebbdd23df647a8eee23a43 100644 --- a/interfaces/inner_api/src/standard/device_security_level_loader.cpp +++ b/interfaces/inner_api/src/standard/device_security_level_loader.cpp @@ -35,7 +35,7 @@ sptr DeviceSecurityLevelLoader::LoadDslmService() { auto registry = SystemAbilityManagerClient::GetInstance().GetSystemAbilityManager(); if (registry == nullptr) { - HiLog::Error(LABEL, "GetDeviceSecurityInfo get registry error."); + HILOG_ERROR(LOG_CORE, "GetDeviceSecurityInfo get registry error."); return {}; } auto object = registry->CheckSystemAbility(DEVICE_SECURITY_LEVEL_MANAGER_SA_ID); @@ -46,7 +46,7 @@ sptr DeviceSecurityLevelLoader::LoadDslmService() sptr callback = new (std::nothrow) LoadCallback(); int32_t result = registry->LoadSystemAbility(DEVICE_SECURITY_LEVEL_MANAGER_SA_ID, callback); if (result != ERR_OK) { - HiLog::Error(LABEL, "GetDeviceSecurityInfo LoadSystemAbility error."); + HILOG_ERROR(LOG_CORE, "GetDeviceSecurityInfo LoadSystemAbility error."); return {}; } return callback->Promise(); @@ -54,13 +54,13 @@ sptr DeviceSecurityLevelLoader::LoadDslmService() void DeviceSecurityLevelLoader::LoadCallback::OnLoadSystemAbilitySuccess(int32_t sid, const sptr &object) { - HiLog::Info(LABEL, "OnLoadSystemAbilitySuccess = %{public}d.", sid); + HILOG_INFO(LOG_CORE, "OnLoadSystemAbilitySuccess = %{public}d.", sid); promise_.set_value(object); } void DeviceSecurityLevelLoader::LoadCallback::OnLoadSystemAbilityFail(int32_t sid) { - HiLog::Error(LABEL, "OnLoadSystemAbilityFail = %{public}d.", sid); + HILOG_ERROR(LOG_CORE, "OnLoadSystemAbilityFail = %{public}d.", sid); } sptr DeviceSecurityLevelLoader::LoadCallback::Promise() diff --git a/interfaces/inner_api/src/standard/device_security_level_proxy.cpp b/interfaces/inner_api/src/standard/device_security_level_proxy.cpp index d4465399111679be30a039dbb70206b227a9cdf5..05610f20f6704c8bb0640805faa34dd3e8100043 100644 --- a/interfaces/inner_api/src/standard/device_security_level_proxy.cpp +++ b/interfaces/inner_api/src/standard/device_security_level_proxy.cpp @@ -49,12 +49,12 @@ int32_t DeviceSecurityLevelProxy::RequestDeviceSecurityLevel(const DeviceIdentif auto length = identify.length; if (length == 0 || length > DEVICE_ID_MAX_LEN) { - HiLog::Error(LABEL, "RequestDeviceSecurityLevel invalid para len."); + HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevel invalid para len."); return ERR_INVALID_LEN_PARA; } if (!data.WriteInterfaceToken(GetDescriptor())) { - HiLog::Error(LABEL, "RequestDeviceSecurityLevel write descriptor failed"); + HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevel write descriptor failed"); return ERR_INVALID_PARA; } @@ -74,18 +74,18 @@ int32_t DeviceSecurityLevelProxy::RequestDeviceSecurityLevel(const DeviceIdentif MessageOption ipcOption = {MessageOption::TF_SYNC}; auto result = Remote()->SendRequest(CMD_GET_DEVICE_SECURITY_LEVEL, data, reply, ipcOption); if (result != ERR_NONE) { - HiLog::Error(LABEL, "RequestDeviceSecurityLevelSendRequest send failed, ret is %{public}d", result); + HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevelSendRequest send failed, ret is %{public}d", result); return result; } if (reply.GetReadableBytes() < sizeof(uint32_t)) { - HiLog::Error(LABEL, "RequestDeviceSecurityLevelSendRequest result length error"); + HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevelSendRequest result length error"); return ERR_IPC_RET_PARCEL_ERR; } auto status = reply.ReadUint32(); if (status != cookie) { - HiLog::Error(LABEL, "RequestDeviceSecurityLevelSendRequest result value error, ret is %{public}u", status); + HILOG_ERROR(LOG_CORE, "RequestDeviceSecurityLevelSendRequest result value error, ret is %{public}u", status); return ERR_IPC_REMOTE_OBJ_ERR; } diff --git a/test/dslm_fuzz_test/dslm_fuzzer/BUILD.gn b/test/dslm_fuzz_test/dslm_fuzzer/BUILD.gn index e59f7a621b16984152abbbe44c3116c00ce88a20..ea308e90b377d5cae23073799be2beda28147dc2 100644 --- a/test/dslm_fuzz_test/dslm_fuzzer/BUILD.gn +++ b/test/dslm_fuzz_test/dslm_fuzzer/BUILD.gn @@ -28,7 +28,6 @@ if (os_level == "standard") { include_dirs = [ "../../../baselib/utils/include", "../../../baselib/msglib/include", - "../../../baselib/msglib/src/utils", "../../../baselib/msglib/src/common", "../../../baselib/msglib/src/standard", "../../../common/include",