diff --git a/interfaces/innerkits/native/file_uri/src/file_uri.cpp b/interfaces/innerkits/native/file_uri/src/file_uri.cpp index 655e6dcb491a2f800da8af55dd6626c988b0ac81..d13f58ab00e685a782d844963db7b472ec880199 100644 --- a/interfaces/innerkits/native/file_uri/src/file_uri.cpp +++ b/interfaces/innerkits/native/file_uri/src/file_uri.cpp @@ -143,6 +143,7 @@ string FileUri::GetRealPath() realPath = pathShare + MODE_R + bundleName + sandboxPath; } } + LOGD("GetRealPath return path is ,%{private}s", realPath.c_str()); return realPath; } diff --git a/tools/backup_tool/src/tools_op_backup.cpp b/tools/backup_tool/src/tools_op_backup.cpp index 439760fd4a059063a30a603c2fcb405fb9b182b5..577ce7eaecc2ac2a2236739e055dd6bdeeaa6b77 100644 --- a/tools/backup_tool/src/tools_op_backup.cpp +++ b/tools/backup_tool/src/tools_op_backup.cpp @@ -226,7 +226,7 @@ static void BackupToolDirSoftlinkToBackupDir() static int32_t InitPathCapFile(const string &pathCapFile, vector bundleNames) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "InitPathCapFile"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "InitPathCapFile", ""); // SELinux backup_tool工具/data/文件夹下创建文件夹 SA服务因root用户的自定义标签无写入权限 此处调整为软链接形式 BackupToolDirSoftlinkToBackupDir(); @@ -259,7 +259,7 @@ static int32_t InitPathCapFile(const string &pathCapFile, vector bundleN .onProcess = bind(OnProcess, ctx, placeholders::_1, placeholders::_2)}); if (ctx->session_ == nullptr) { printf("Failed to init backup\n"); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -EPERM; } ctx->SetBundleFinishedCount(bundleNames.size()); @@ -269,7 +269,7 @@ static int32_t InitPathCapFile(const string &pathCapFile, vector bundleN throw BError(BError::Codes::TOOL_INVAL_ARG, "backup append bundles error"); } ctx->Wait(); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); ctx->session_->Release(); return 0; } diff --git a/tools/backup_tool/src/tools_op_incremental_backup.cpp b/tools/backup_tool/src/tools_op_incremental_backup.cpp index 2c8a95d36ad6c7e3c15443ac4360af17627239e5..d037003467fbb425e1141a7e0356380910b34052 100644 --- a/tools/backup_tool/src/tools_op_incremental_backup.cpp +++ b/tools/backup_tool/src/tools_op_incremental_backup.cpp @@ -299,7 +299,7 @@ static int GetLocalCapabilitiesIncremental(shared_ptr ctx, static int32_t Init(const string &pathCapFile, const vector& bundleNames, const vector& times) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Init"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "Init", ""); // SELinux backup_tool工具/data/文件夹下创建文件夹 SA服务因root用户的自定义标签无写入权限 此处调整为软链接形式 BackupToolDirSoftlinkToBackupDir(); @@ -319,7 +319,7 @@ static int32_t Init(const string &pathCapFile, const vector& bundleNames .onProcess = bind(OnProcess, ctx, placeholders::_1, placeholders::_2)}); if (ctx->session_ == nullptr) { printf("Failed to init backup\n"); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -EPERM; } @@ -342,7 +342,7 @@ static int32_t Init(const string &pathCapFile, const vector& bundleNames ctx->SetBundleFinishedCount(bundleNames.size()); ctx->Wait(); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); ctx->session_->Release(); return 0; } diff --git a/tools/backup_tool/src/tools_op_incremental_restore.cpp b/tools/backup_tool/src/tools_op_incremental_restore.cpp index 3fe36888193b5d772d67ed5181b9d246d6f58e9f..5f1c2eda95f075ca045a70b1658b6767c16651ac 100644 --- a/tools/backup_tool/src/tools_op_incremental_restore.cpp +++ b/tools/backup_tool/src/tools_op_incremental_restore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -226,7 +226,7 @@ static void OnProcess(shared_ptr ctx, const std::string bundleNa static void RestoreApp(shared_ptr restore) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "RestoreApp"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "RestoreApp", ""); if (!restore || !restore->session_) { throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); } @@ -248,7 +248,7 @@ static void RestoreApp(shared_ptr restore) restore->UpdateBundleSendFiles(data.bundleName, fileName); } } - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); } static bool GetRealPath(string &path) @@ -281,7 +281,7 @@ static int32_t InitRestoreSession(shared_ptr ctx, .onProcess = bind(OnProcess, ctx, placeholders::_1, placeholders::_2)}); if (ctx->session_ == nullptr) { printf("Failed to init restore\n"); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -EPERM; } @@ -298,7 +298,7 @@ static int32_t InitRestoreSession(shared_ptr ctx, static int32_t Init(const string &pathCapFile, vector bundleNames, bool depMode, vector times) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Init"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "Init", ""); string realPath = pathCapFile; if (!GetRealPath(realPath)) { fprintf(stderr, "path to realpath error"); @@ -322,7 +322,7 @@ static int32_t Init(const string &pathCapFile, vector bundleNames, bool UniqueFd fileFd(open(realPath.data(), O_RDWR, S_IRWXU)); if (fileFd < 0) { fprintf(stderr, "Failed to open file error: %d %s\n", errno, strerror(errno)); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -errno; } int result = ctx->session_->AppendBundles(move(fileFd), {bundleName}); diff --git a/tools/backup_tool/src/tools_op_incremental_restore_async.cpp b/tools/backup_tool/src/tools_op_incremental_restore_async.cpp index f39f53196a7688e059dbbf7cb48401246304a2e0..230393c81ee7b20a1566dcfcb7770c4d5c532ce2 100644 --- a/tools/backup_tool/src/tools_op_incremental_restore_async.cpp +++ b/tools/backup_tool/src/tools_op_incremental_restore_async.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -253,7 +253,7 @@ static void OnProcess(shared_ptr ctx, const std::string bundleName, con static void RestoreApp(shared_ptr restore, vector &bundleNames) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "RestoreApp"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "RestoreApp", ""); if (!restore || !restore->session_) { throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); } @@ -303,7 +303,7 @@ static void RestoreApp(shared_ptr restore, vectorsession_->GetFileHandle(bundleName, item.hashName); } } - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); } static int32_t ChangeBundleInfo(const string &pathCapFile, const vector &bundleNames, const string &type) @@ -312,7 +312,7 @@ static int32_t ChangeBundleInfo(const string &pathCapFile, const vector UniqueFd fd(open(pathCapFile.data(), O_RDWR, S_IRWXU)); if (fd < 0) { fprintf(stderr, "Failed to open file error: %d %s\n", errno, strerror(errno)); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -errno; } BJsonCachedEntity cachedEntity(move(fd)); @@ -356,7 +356,7 @@ static int32_t AppendBundles(shared_ptr restore, UniqueFd fd(open(pathCapFile.data(), O_RDWR, S_IRWXU)); if (fd < 0) { fprintf(stderr, "Failed to open file error: %d %s\n", errno, strerror(errno)); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -errno; } RestoreTypeEnum restoreType = RestoreTypeEnum::RESTORE_DATA_WAIT_SEND; @@ -388,7 +388,7 @@ static int32_t InitArg(const string &pathCapFile, const string &type, const string &userId) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Init"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "Init", ""); BExcepUltils::VerifyPath(pathCapFile, false); if (ChangeBundleInfo(pathCapFile, bundleNames, type)) { @@ -411,7 +411,7 @@ static int32_t InitArg(const string &pathCapFile, .onProcess = bind(OnProcess, ctx, placeholders::_1, placeholders::_2)}); if (ctx->session_ == nullptr) { printf("Failed to init restore\n"); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -EPERM; } ctx->SetBundleFinishedCount(bundleNames.size()); diff --git a/tools/backup_tool/src/tools_op_restore.cpp b/tools/backup_tool/src/tools_op_restore.cpp index 7649de29a1217304d23e0f0015862124c08210e4..aa33da190d03f239702209b41634e3fe1b8315ea 100644 --- a/tools/backup_tool/src/tools_op_restore.cpp +++ b/tools/backup_tool/src/tools_op_restore.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2024 Huawei Device Co., Ltd. + * Copyright (c) 2022-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -204,7 +204,7 @@ static void OnProcess(shared_ptr ctx, const std::string bundleName, con static void RestoreApp(shared_ptr restore, vector &bundleNames, bool updateSendFiles) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "RestoreApp"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "RestoreApp", ""); if (!restore || !restore->session_) { throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); } @@ -233,7 +233,7 @@ static void RestoreApp(shared_ptr restore, vector &bundleNa } } } - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); } static bool GetRealPath(string &path) @@ -266,7 +266,7 @@ static int32_t InitRestoreSession(shared_ptr ctx) .onProcess = bind(OnProcess, ctx, placeholders::_1, placeholders::_2)}); if (ctx->session_ == nullptr) { printf("Failed to init restore\n"); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -EPERM; } return 0; @@ -274,7 +274,7 @@ static int32_t InitRestoreSession(shared_ptr ctx) static int32_t InitPathCapFile(const string &pathCapFile, vector bundleNames, bool depMode) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Init"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "Init", ""); string realPath = pathCapFile; if (!GetRealPath(realPath)) { fprintf(stderr, "path to realpath error"); @@ -299,7 +299,7 @@ static int32_t InitPathCapFile(const string &pathCapFile, vector bundleN UniqueFd fileFd(open(realPath.data(), O_RDWR, S_IRWXU)); if (fileFd < 0) { fprintf(stderr, "Failed to open file error: %d %s\n", errno, strerror(errno)); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -errno; } int result = ctx->session_->AppendBundles(move(fileFd), {bundleName}); diff --git a/tools/backup_tool/src/tools_op_restore_async.cpp b/tools/backup_tool/src/tools_op_restore_async.cpp index c87462f695277adc87d3b820a687ed80956946de..f52f6a2d916ae81a3fb72f36f6f9bc6c9a6927e5 100644 --- a/tools/backup_tool/src/tools_op_restore_async.cpp +++ b/tools/backup_tool/src/tools_op_restore_async.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2024 Huawei Device Co., Ltd. + * Copyright (c) 2024-2025 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -246,7 +246,7 @@ static void AdapteCloneOptimize(const string &path) static void RestoreApp(shared_ptr restore, vector &bundleNames) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "RestoreApp"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "RestoreApp", ""); if (!restore || !restore->session_) { throw BError(BError::Codes::TOOL_INVAL_ARG, generic_category().message(errno)); } @@ -286,7 +286,7 @@ static void RestoreApp(shared_ptr restore, vector &bun restore->session_->GetFileHandle(bundleName, item.hashName); } } - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); } static int32_t ChangeBundleInfo(const string &pathCapFile, const vector &bundleNames, const string &type) @@ -295,7 +295,7 @@ static int32_t ChangeBundleInfo(const string &pathCapFile, const vector UniqueFd fd(open(pathCapFile.data(), O_RDWR, S_IRWXU)); if (fd < 0) { fprintf(stderr, "Failed to open file error: %d %s\n", errno, strerror(errno)); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -errno; } BJsonCachedEntity cachedEntity(move(fd)); @@ -339,7 +339,7 @@ static int32_t AppendBundles(shared_ptr restore, UniqueFd fd(open(pathCapFile.data(), O_RDWR, S_IRWXU)); if (fd < 0) { fprintf(stderr, "Failed to open file error: %d %s\n", errno, strerror(errno)); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -errno; } RestoreTypeEnum restoreType = RestoreTypeEnum::RESTORE_DATA_WAIT_SEND; @@ -371,7 +371,7 @@ static int32_t InitArg(const string &pathCapFile, const string &type, const string &userId) { - StartTrace(HITRACE_TAG_FILEMANAGEMENT, "Init"); + StartTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT, "Init", ""); BExcepUltils::VerifyPath(pathCapFile, false); if (ChangeBundleInfo(pathCapFile, bundleNames, type)) { @@ -394,7 +394,7 @@ static int32_t InitArg(const string &pathCapFile, .onProcess = bind(OnProcess, ctx, placeholders::_1, placeholders::_2)}); if (ctx->session_ == nullptr) { printf("Failed to init restore\n"); - FinishTrace(HITRACE_TAG_FILEMANAGEMENT); + FinishTraceEx(HiTraceOutputLevel::HITRACE_LEVEL_INFO, HITRACE_TAG_FILEMANAGEMENT); return -EPERM; } ctx->SetBundleFinishedCount(bundleNames.size()); diff --git a/utils/include/b_hilog/filemgmt_libhilog.h b/utils/include/b_hilog/filemgmt_libhilog.h index 9e882f46b4731ff0a5deaf7f7ea74405a50ac14f..eed8d94d50217f48e2a0a34e2fb1e4fc91bd0599 100644 --- a/utils/include/b_hilog/filemgmt_libhilog.h +++ b/utils/include/b_hilog/filemgmt_libhilog.h @@ -22,7 +22,7 @@ namespace OHOS { #ifndef LOG_DOMAIN -#define LOG_DOMAIN 0xD001600 +#define LOG_DOMAIN 0xD004303 #endif #ifndef LOG_TAG