/base/security/code_signature/test/unittest/ |
D | enable_verity_test.cpp | 185 static void CleanFile(const std::string &filePath) in CleanFile() argument 187 EXPECT_EQ(OHOS::RemoveFile(filePath), true); in CleanFile() 220 static void CheckEnableSuccess(const std::string &filePath) in CheckEnableSuccess() argument 224 FILE *fout = fopen(filePath.c_str(), "wb"); in CheckEnableSuccess() 228 EXPECT_EQ(ReadDataFromFile(filePath, tmp), true); in CheckEnableSuccess() 237 static bool TamperFileTail(const std::string &filePath) in TamperFileTail() argument 239 FILE *file = fopen(filePath.c_str(), "ab"); in TamperFileTail() 259 static bool TamperFileHead(const std::string &filePath) in TamperFileHead() argument 261 FILE *file = fopen(filePath.c_str(), "ab"); in TamperFileHead() 276 int32_t EnableVerityOnOneFile(const std::string filePath, in EnableVerityOnOneFile() argument [all …]
|
/base/hiviewdfx/hiview/framework/native/unified_collection/calculator/ |
D | io_calculator.cpp | 33 std::string filePath = path + "/size"; in GetEMMCSize() local 34 if (FileUtil::FileExists(filePath)) { in GetEMMCSize() 35 sizeStr = FileUtil::GetFirstLine(filePath); in GetEMMCSize() 38 filePath = path + "/block/mmcblk" + std::to_string(index) + "/size"; in GetEMMCSize() 39 if (FileUtil::FileExists(filePath)) { in GetEMMCSize() 40 sizeStr = FileUtil::GetFirstLine(filePath); in GetEMMCSize() 49 HIVIEW_LOGE("load file=%{public}s failed.", filePath.c_str()); in GetEMMCSize() 56 std::string filePath = path + "/manfid"; in GetEMMCManfid() local 57 std::string eMMCManfid = FileUtil::GetFirstLine(filePath); in GetEMMCManfid() 59 HIVIEW_LOGE("load file=%{public}s failed.", filePath.c_str()); in GetEMMCManfid()
|
/base/update/updater/test/fuzztest/applypatch_fuzzer/ |
D | applypatch_fuzzer.cpp | 29 const std::string filePath = "/data/fuzz/test/MountForPath_fuzzer.fstable"; in FuzzApplyPatch() local 30 ApplyPatch(filePath, filePath, std::string(reinterpret_cast<const char*>(data), size)); in FuzzApplyPatch() 31 ApplyPatch(filePath, std::string(reinterpret_cast<const char*>(data), size), filePath); in FuzzApplyPatch() 32 ApplyPatch(std::string(reinterpret_cast<const char*>(data), size), filePath, filePath); in FuzzApplyPatch()
|
/base/security/huks/test/unittest/huks_common_test/src/ |
D | hks_test_file_operator_func.c | 60 char filePath[PATH_MAX + 1] = {0}; in FileRead() local 61 (void)realpath(fileName, filePath); in FileRead() 62 if (strstr(filePath, "../") != NULL) { in FileRead() 63 HKS_TEST_LOG_E("invalid filePath, path %s", filePath); in FileRead() 67 FILE *fp = fopen(filePath, "rb"); in FileRead() 105 char filePath[PATH_MAX + 1] = {0}; in FileWrite() local 106 if (memcpy_s(filePath, sizeof(filePath) - 1, fileName, strlen(fileName)) != EOK) { in FileWrite() 109 (void)realpath(fileName, filePath); in FileWrite() 110 if (strstr(filePath, "../") != NULL) { in FileWrite() 111 HKS_TEST_LOG_E("invalid filePath, path %s", filePath); in FileWrite() [all …]
|
/base/security/device_auth/services/frameworks/src/security_label_adapter/ |
D | security_label_adapter.c | 25 static int32_t GetSecurityLabel(const char *filePath, char **returnLabel) in GetSecurityLabel() argument 27 int32_t labelSize = getxattr(filePath, SECURITY_LABEL_XATTR_KEY, NULL, 0); in GetSecurityLabel() 37 labelSize = getxattr(filePath, SECURITY_LABEL_XATTR_KEY, label, labelSize); in GetSecurityLabel() 47 static bool IsSetLabelNeeded(const char *filePath, const char *labelToSet) in IsSetLabelNeeded() argument 50 if (GetSecurityLabel(filePath, &existLabel) != HC_SUCCESS) { in IsSetLabelNeeded() 62 void SetSecurityLabel(const char *filePath, const char *labelToSet) in SetSecurityLabel() argument 64 if (!IsSetLabelNeeded(filePath, labelToSet)) { in SetSecurityLabel() 67 int32_t res = setxattr(filePath, SECURITY_LABEL_XATTR_KEY, labelToSet, in SetSecurityLabel()
|
/base/sensors/miscdevice/utils/common/src/ |
D | file_utils.cpp | 38 std::string ReadJsonFile(const std::string &filePath) in ReadJsonFile() argument 40 if (filePath.empty()) { in ReadJsonFile() 45 if (realpath(filePath.c_str(), realPath) == nullptr) { in ReadJsonFile() 78 int32_t GetFileSize(const std::string &filePath) in GetFileSize() argument 81 if (stat(filePath.c_str(), &statbuf) != 0) { in GetFileSize() 109 char filePath[FILE_PATH_MAX] = {'\0'}; in GetFileName() local 117 ret = readlink(buf, filePath, FILE_PATH_MAX); in GetFileName() 123 fileName = filePath; in GetFileName() 148 bool CheckFileDir(const std::string &filePath, const std::string &dir) in CheckFileDir() argument 150 if (filePath.compare(0, CONFIG_DIR.size(), CONFIG_DIR) != 0) { in CheckFileDir() [all …]
|
/base/customization/config_policy/test/unittest/ |
D | config_policy_utils_test.cpp | 46 char *filePath = nullptr; in TestGetCfgFile() local 48 filePath = cfgFiles->paths[i]; in TestGetCfgFile() 49 if (filePath && *filePath != '\0') { in TestGetCfgFile() 50 std::cout << "type: " << type << ", filePath: " << filePath << std::endl; in TestGetCfgFile() 56 filePath = GetOneCfgFileEx(testPathSuffix, buf, MAX_PATH_LEN, type, extra); in TestGetCfgFile() 57 if (filePath && *filePath != '\0') { in TestGetCfgFile() 58 std::cout << "type: " << type << ", one filePath: " << filePath << std::endl; in TestGetCfgFile() 124 char *filePath = cfgDir->paths[i]; variable 125 if (filePath && *filePath != '\0') { 126 std::cout << "filePath: " << filePath << std::endl;
|
/base/msdp/device_status/libs/src/ |
D | devicestatus_data_parse.cpp | 127 std::string DeviceStatusDataParse::ReadJsonFile(const std::string &filePath) in ReadJsonFile() argument 129 if (filePath.empty()) { in ReadJsonFile() 134 if (realpath(filePath.c_str(), realPath) == nullptr) { in ReadJsonFile() 146 if (!Utility::DoesFileExist(filePath.c_str())) { in ReadJsonFile() 150 if (!CheckFileSize(filePath)) { in ReadJsonFile() 157 bool DeviceStatusDataParse::CheckFileDir(const std::string& filePath, const std::string& dir) in CheckFileDir() argument 159 if (filePath.compare(0, MSDP_DATA_DIR.size(), MSDP_DATA_DIR) != 0) { in CheckFileDir() 166 bool DeviceStatusDataParse::CheckFileSize(const std::string& filePath) in CheckFileSize() argument 168 int32_t fileSize = Utility::GetFileSize(filePath); in CheckFileSize() 176 bool DeviceStatusDataParse::CheckFileExtendName(const std::string& filePath, const std::string& che… in CheckFileExtendName() argument [all …]
|
/base/sensors/miscdevice/utils/common/include/ |
D | file_utils.h | 29 std::string ReadJsonFile(const std::string &filePath); 30 std::string ReadFile(const std::string &filePath); 31 bool CheckFileDir(const std::string &filePath, const std::string &dir); 32 bool CheckFileExtendName(const std::string &filePath, const std::string &checkExtension); 33 bool CheckFileSize(const std::string &filePath); 35 int32_t GetFileSize(const std::string &filePath);
|
/base/hiviewdfx/hiview/utility/common_utils/ |
D | calc_fingerprint.cpp | 59 int CalcFingerprint::CalcFileSha(const string& filePath, char *hash, size_t len) in CalcFileSha() argument 61 if (filePath.empty() || hash == nullptr || !FileUtil::IsLegalPath(filePath)) { in CalcFileSha() 66 int ret = CalcFileShaOriginal(filePath, value, len); in CalcFileSha() 74 int CalcFingerprint::CalcFileShaOriginal(const string& filePath, unsigned char *hash, size_t len) in CalcFileShaOriginal() argument 76 if (filePath.empty() || hash == nullptr || !FileUtil::IsLegalPath(filePath)) { in CalcFileShaOriginal() 87 fp = fopen(filePath.c_str(), "rb"); in CalcFileShaOriginal()
|
/base/msdp/device_status/libs/include/ |
D | devicestatus_data_parse.h | 37 bool CheckFileDir(const std::string &filePath, const std::string &dir); 38 bool CheckFileSize(const std::string &filePath); 39 bool CheckFileExtendName(const std::string &filePath, const std::string &checkExtension); 40 std::string ReadFile(const std::string &filePath); 41 std::string ReadJsonFile(const std::string &filePath);
|
/base/hiviewdfx/hiappevent/frameworks/native/libhiappevent/utility/ |
D | file_util.cpp | 91 std::string filePath = GetFilePathByDir(dir, dirInfo->d_name); in ForceRemoveDirectory() local 92 if (!ForceRemoveDirectory(filePath)) { in ForceRemoveDirectory() 119 std::string filePath = GetFilePathByDir(dir, ent->d_name); in GetDirFiles() local 120 if (IsFile(filePath)) { // do not process subdirectory in GetDirFiles() 121 files.push_back(filePath); in GetDirFiles() 177 std::string filePath = dir; in GetFilePathByDir() local 178 if (filePath.back() != '/') { in GetFilePathByDir() 179 filePath.push_back(PATH_DELIMITER); in GetFilePathByDir() 181 filePath.append(fileName); in GetFilePathByDir() 182 return filePath; in GetFilePathByDir() [all …]
|
/base/request/request/frameworks/js/napi/src/upload/ |
D | obtain_file.cpp | 94 bool ObtainFile::IsValidPath(const std::string &filePath) in IsValidPath() argument 97 if (filePath.length() > PATH_MAX || realpath(filePath.c_str(), resolvedPath) == nullptr in IsValidPath() 98 || strncmp(resolvedPath, filePath.c_str(), filePath.length()) != 0) { in IsValidPath() 124 std::string filePath = fileAdapter_->InternalGetFilePath(context); in GetInternalFile() local 125 if (filePath.empty()) { in GetInternalFile() 129 filePath += "/" + fileName; in GetInternalFile() 130 if (!IsValidPath(filePath)) { in GetInternalFile() 133 FILE *filePtr = fopen(filePath.c_str(), "r"); in GetInternalFile()
|
/base/global/i18n/frameworks/intl/test/unittest/mock/src/ |
D | generate_ics_file.cpp | 34 std::string filePath = "/data/log/TR.ics"; in GenerateFile() local 35 std::ofstream fstream(filePath); in GenerateFile() 38 return filePath; in GenerateFile() 63 return filePath; in GenerateFile()
|
/base/security/code_signature/interfaces/innerkits/local_code_sign/src/ |
D | local_code_sign_kit.cpp | 28 int32_t LocalCodeSignKit::SignLocalCode(const std::string &filePath, ByteBuffer &signature) in SignLocalCode() argument 30 return LocalCodeSignClient::GetInstance().SignLocalCode("", filePath, signature); in SignLocalCode() 33 int32_t LocalCodeSignKit::SignLocalCode(const std::string &ownerID, const std::string &filePath, By… in SignLocalCode() argument 35 return LocalCodeSignClient::GetInstance().SignLocalCode(ownerID, filePath, signature); in SignLocalCode()
|
/base/hiviewdfx/blackbox_lite/ |
D | blackbox_detector.c | 18 int UploadEventByFile(const char *filePath) in UploadEventByFile() argument 20 if (filePath == NULL) { in UploadEventByFile() 21 BBOX_PRINT_ERR("filePath: %p\n", filePath); in UploadEventByFile()
|
/base/hiviewdfx/hiview/base/event_store/store/ |
D | sys_event_doc.cpp | 122 std::string filePath = GetCurFile(dir); in UpdateCurFile() local 123 if (filePath.empty() || IsFileFull(filePath)) { in UpdateCurFile() 126 curFile_ = filePath; in UpdateCurFile() 164 std::string filePath = dir + FILE_SEPARATOR; in CreateCurFile() local 165 …filePath.append(name_).append(FILE_NAME_SEPARATOR).append(std::to_string(type_)).append(FILE_NAME_… in CreateCurFile() 167 …if (FileUtil::CreateFile(filePath, FileUtil::FILE_PERM_660) != 0 && !FileUtil::FileExists(filePath… in CreateCurFile() 168 HIVIEW_LOGE("failed to create file=%{public}s, errno=%{public}d", filePath.c_str(), errno); in CreateCurFile() 171 curFile_ = filePath; in CreateCurFile()
|
/base/security/appverify/interfaces/innerkits/appverify/src/interfaces/ |
D | hap_verify.cpp | 86 int32_t HapVerify(const std::string& filePath, HapVerifyResult& hapVerifyResult) in HapVerify() argument 92 return hapVerifyV2.Verify(filePath, hapVerifyResult); in HapVerify() 95 int32_t ParseHapProfile(const std::string& filePath, HapVerifyResult& hapVerifyV1Result) in ParseHapProfile() argument 98 return hapVerifyV2.ParseHapProfile(filePath, hapVerifyV1Result); in ParseHapProfile() 101 int32_t ParseHapSignatureInfo(const std::string& filePath, SignatureInfo &hapSignInfo) in ParseHapSignatureInfo() argument 104 return hapVerifyV2.ParseHapSignatureInfo(filePath, hapSignInfo); in ParseHapSignatureInfo()
|
/base/update/sys_installer/services/module_update/util/src/ |
D | module_utils.cpp | 93 std::string GetHmpName(const std::string &filePath) in GetHmpName() argument 95 std::size_t endPos = filePath.find_last_of('/'); in GetHmpName() 97 LOG(ERROR) << "Invalid package path " << filePath; in GetHmpName() 103 if (StartsWith(filePath, iter)) { in GetHmpName() 109 LOG(ERROR) << "Invalid package path " << filePath; in GetHmpName() 112 return filePath.substr(startPos, endPos - startPos); in GetHmpName() 182 std::string GetRealPath(const std::string &filePath) in GetRealPath() argument 185 if (realpath(filePath.c_str(), path) == nullptr) { in GetRealPath() 186 LOG(ERROR) << "get real path fail " << filePath; in GetRealPath()
|
/base/theme/wallpaper_mgr/utils/src/ |
D | file_deal.cpp | 93 std::string FileDeal::GetExtension(const std::string &filePath) in GetExtension() argument 95 std::string filename = filePath; in GetExtension() 97 std::string::size_type pos = filePath.find_last_of('/'); in GetExtension() 99 if (pos + 1 < filePath.length()) { in GetExtension() 100 filename = filePath.substr(pos + 1); in GetExtension() 129 bool FileDeal::IsZipFile(const std::string &filePath) in IsZipFile() argument 131 fs::path file(filePath); in IsZipFile() 138 HILOG_ERROR("this is not a zip.filePath:%{private}s", filePath.c_str()); in IsZipFile()
|
/base/request/request/test/unittest/common/napi/requestTest/ |
D | RequestJsunit.test.js | 51 filePath: `/data/storage/el2/base/haps/entry/files/`, property 67 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0001.txt' 107 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0002.txt' 141 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0003.txt' 180 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0004.txt' 219 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_ON_0005.txt' 253 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0001.txt' 280 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0002.txt' 307 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0003.txt' 335 downloadConfig.filePath += 'SUB_REQUEST_DOWNLOAD_API_DOWNLOADTASK_OFF_0004.txt' [all …]
|
/base/security/appverify/interfaces/innerkits/appverify/include/interfaces/ |
D | hap_verify.h | 29 DLL_EXPORT int32_t HapVerify(const std::string& filePath, HapVerifyResult& hapVerifyResult); 30 DLL_EXPORT int32_t ParseHapProfile(const std::string& filePath, HapVerifyResult& hapVerifyV1Result); 31 DLL_EXPORT int32_t ParseHapSignatureInfo(const std::string& filePath, SignatureInfo &hapSignInfo);
|
/base/update/updateservice/services/core/ability/utils/src/ |
D | file_utils.cpp | 53 bool FileUtils::IsSpaceEnough(const std::string &filePath, const int64_t requiredSpace) in IsSpaceEnough() argument 57 int ret = statfs(filePath.c_str(), &diskStatfs); in IsSpaceEnough() 68 bool FileUtils::SaveDataToFile(const std::string &filePath, const std::string &data) in SaveDataToFile() argument 71 os.open(filePath, std::ios::trunc); in SaveDataToFile() 73 ENGINE_LOGI("SaveDataToFile success, file = %{public}s", filePath.c_str()); in SaveDataToFile() 78 ENGINE_LOGE("SaveDataToFile fail, file = %{public}s", filePath.c_str()); in SaveDataToFile() 204 std::string FileUtils::ReadDataFromFile(const std::string &filePath) in ReadDataFromFile() argument 207 readFile.open(filePath); in ReadDataFromFile() 209 ENGINE_LOGI("open file from %{public}s err", filePath.c_str()); in ReadDataFromFile()
|
/base/hiviewdfx/hiview/base/utility/ |
D | freeze_json_util.cpp | 54 int GetFd(const std::string& filePath) in GetFd() argument 59 if (!FileUtil::IsLegalPath(filePath)) { in GetFd() 62 return open(filePath.c_str(), O_CREAT | O_RDWR | O_APPEND, DEFAULT_LOG_FILE_MODE); in GetFd() 65 bool DelFile(const std::string& filePath) in DelFile() argument 67 if (!FileUtil::FileExists(filePath)) { in DelFile() 70 return FileUtil::RemoveFile(filePath); in DelFile() 142 void LoadCollectorFromFile(const std::string& filePath, FreezeJsonCollector& jsonCollector) in LoadCollectorFromFile() argument 146 if (!FileUtil::FileExists(filePath)) { in LoadCollectorFromFile() 149 std::ifstream jsonFile(filePath); in LoadCollectorFromFile()
|
/base/hiviewdfx/hisysevent/adapter/native/idl/src/ |
D | file_util.cpp | 81 std::string filePath = dir; in GetFilePathByDir() local 82 if (filePath.back() != '/') { in GetFilePathByDir() 83 filePath.push_back(PATH_DELIMITER); in GetFilePathByDir() 85 filePath.append(fileName); in GetFilePathByDir() 86 return filePath; in GetFilePathByDir()
|