/base/account/os_account/frameworks/common/file_operator/src/ |
D | account_file_operator.cpp | 39 ErrCode AccountFileOperator::CreateDir(const std::string &path) in CreateDir() argument 43 if (!OHOS::ForceCreateDirectory(path)) { in CreateDir() 44 ACCOUNT_LOGE("failed to create %{public}s, errno %{public}d.", path.c_str(), errno); in CreateDir() 48 bool createFlag = OHOS::ChangeModeDirectory(path, mode); in CreateDir() 50 … ACCOUNT_LOGE("failed to change mode for %{public}s, errno %{public}d.", path.c_str(), errno); in CreateDir() 57 ErrCode AccountFileOperator::DeleteDirOrFile(const std::string &path) in DeleteDirOrFile() argument 60 if (IsExistFile(path)) { in DeleteDirOrFile() 61 delFlag = OHOS::RemoveFile(path); in DeleteDirOrFile() 63 if (IsExistDir(path)) { in DeleteDirOrFile() 64 delFlag = OHOS::ForceRemoveDirectory(path); in DeleteDirOrFile() [all …]
|
/base/hiviewdfx/faultloggerd/common/util/ |
D | dfx_cutil.c | 39 bool ReadStringFromFile(const char* path, char* dst, size_t dstSz) in ReadStringFromFile() argument 48 fd = open(path, O_RDONLY); in ReadStringFromFile() 81 char path[NAME_LEN]; in GetThreadName() local 82 (void)memset_s(path, sizeof(path), '\0', sizeof(path)); in GetThreadName() 83 if (snprintf_s(path, sizeof(path), sizeof(path) - 1, "/proc/%d/comm", getpid()) <= 0) { in GetThreadName() 86 return ReadStringFromFile(path, buffer, bufferSz); in GetThreadName() 91 char path[NAME_LEN]; in GetProcessName() local 92 (void)memset_s(path, sizeof(path), '\0', sizeof(path)); in GetProcessName() 93 if (snprintf_s(path, sizeof(path), sizeof(path) - 1, "/proc/%d/cmdline", getpid()) <= 0) { in GetProcessName() 96 return ReadStringFromFile(path, buffer, bufferSz); in GetProcessName()
|
D | musl_cutil.h | 39 bool ReadStringFromFile(const char* path, char* dst, size_t dstSz) in ReadStringFromFile() argument 47 fd = open(path, O_RDONLY); in ReadStringFromFile() 79 char path[NAME_LEN]; in GetThreadName() local 80 memset(path, '\0', sizeof(path)); in GetThreadName() 81 if (snprintf(path, sizeof(path) - 1, "/proc/%d/comm", getpid()) <= 0) { in GetThreadName() 84 return ReadStringFromFile(path, buffer, bufferSz); in GetThreadName() 89 char path[NAME_LEN]; in GetProcessName() local 90 memset(path, '\0', sizeof(path)); in GetProcessName() 91 if (snprintf(path, sizeof(path) - 1, "/proc/%d/cmdline", getpid()) <= 0) { in GetProcessName() 94 return ReadStringFromFile(path, buffer, bufferSz); in GetProcessName()
|
/base/hiviewdfx/faultloggerd/utils/ |
D | directory_ex.cpp | 59 string ExcludeTrailingPathDelimiter(const std::string& path) in ExcludeTrailingPathDelimiter() argument 61 if (path.rfind("/") != path.size() - 1) { in ExcludeTrailingPathDelimiter() 62 return path; in ExcludeTrailingPathDelimiter() 65 if (!path.empty()) { in ExcludeTrailingPathDelimiter() 66 return path.substr(0, path.size() - 1); in ExcludeTrailingPathDelimiter() 69 return path; in ExcludeTrailingPathDelimiter() 72 string IncludeTrailingPathDelimiter(const std::string& path) in IncludeTrailingPathDelimiter() argument 74 if (path.rfind("/") != path.size() - 1) { in IncludeTrailingPathDelimiter() 75 return path + "/"; in IncludeTrailingPathDelimiter() 78 return path; in IncludeTrailingPathDelimiter() [all …]
|
D | directory_ex.h | 53 std::string ExcludeTrailingPathDelimiter(const std::string& path); 59 std::string IncludeTrailingPathDelimiter(const std::string& path); 64 void GetDirFiles(const std::string& path, std::vector<std::string>& files); 70 bool IsEmptyFolder(const std::string& path); 76 bool ForceCreateDirectory(const std::string& path); 82 bool ForceRemoveDirectory(const std::string& path); 93 uint64_t GetFolderSize(const std::string& path); 105 bool ChangeModeDirectory(const std::string& path, const mode_t& mode); 111 bool PathToRealPath(const std::string& path, std::string& realPath);
|
/base/hiviewdfx/hiview/adapter/utility/platform/ohos/ |
D | file_util.cpp | 81 std::string IncludeTrailingPathDelimiter(const std::string& path) in IncludeTrailingPathDelimiter() argument 83 return OHOS::IncludeTrailingPathDelimiter(path); in IncludeTrailingPathDelimiter() 86 std::string ExcludeTrailingPathDelimiter(const std::string& path) in ExcludeTrailingPathDelimiter() argument 88 return OHOS::ExcludeTrailingPathDelimiter(path); in ExcludeTrailingPathDelimiter() 91 void GetDirFiles(const std::string& path, std::vector<std::string>& files) in GetDirFiles() argument 93 return OHOS::GetDirFiles(path, files); in GetDirFiles() 96 bool ForceCreateDirectory(const std::string& path) in ForceCreateDirectory() argument 98 return OHOS::ForceCreateDirectory(path); in ForceCreateDirectory() 101 bool ForceCreateDirectory(const string& path, mode_t mode) in ForceCreateDirectory() argument 105 index = path.find('/', index + 1); in ForceCreateDirectory() [all …]
|
/base/hiviewdfx/hiview/adapter/utility/platform/windows/ |
D | file_util.cpp | 39 std::string IncludeTrailingPathDelimiter(const std::string& path) in IncludeTrailingPathDelimiter() argument 44 std::string ExcludeTrailingPathDelimiter(const std::string& path) in ExcludeTrailingPathDelimiter() argument 55 int Open(const std::string& path, const int flags, const mode_t mode) in Open() argument 58 return open(path.c_str(), flags, defaultMode); in Open() 61 void CreateDirWithDefaultPerm(const std::string& path, uid_t aidRoot, uid_t aidSystem) in CreateDirWithDefaultPerm() argument 63 FileUtil::ForceCreateDirectory(path); in CreateDirWithDefaultPerm() 66 void FormatPath2UnixStyle(std::string &path) in FormatPath2UnixStyle() argument 68 replace(path.begin(), path.end(), '\\', '/'); in FormatPath2UnixStyle() 71 void RemoveFolderBeginWith(const std::string &path, const std::string &folderName) in RemoveFolderBeginWith() argument 73 if (!fs::exists(path)) { in RemoveFolderBeginWith() [all …]
|
/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/include/ |
D | cert_manager_file_operator.h | 32 uint32_t CmFileRead(const char *path, const char *fileName, uint32_t offset, uint8_t *buf, uint32_t… 34 int32_t CmFileWrite(const char *path, const char *fileName, uint32_t offset, const uint8_t *buf, ui… 36 int32_t CmFileRemove(const char *path, const char *fileName); 38 uint32_t CmFileSize(const char *path, const char *fileName); 40 int32_t CmIsFileExist(const char *path, const char *fileName); 42 int32_t CmMakeDir(const char *path); 44 void *CmOpenDir(const char *path); 50 int32_t CmIsDirExist(const char *path); 52 int32_t CmUserIdLayerGetFileCountAndNames(const char *path, struct CmBlob *fileNames, 55 int32_t CmUidLayerGetFileCountAndNames(const char *path, struct CmBlob *fileNames, [all …]
|
/base/update/updater/test/unittest/utils/ |
D | utils_unittest.cpp | 72 string path = string(PATH_MAX, 'a') + "/"; variable 73 EXPECT_EQ(Utils::MkdirRecursive(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH), -1); 74 path = "/data/updater/firstDir/secondDir"; 75 EXPECT_EQ(Utils::MkdirRecursive(path, S_IRWXU | S_IRGRP | S_IXGRP | S_IROTH | S_IXOTH), 0); 91 string path = "/no_exist"; variable 92 EXPECT_EQ(Utils::GetFilesFromDirectory(path, files, true), -1); 93 path = "/data"; 94 Utils::GetFilesFromDirectory(path, files, true); 99 string path = "/data/updater/test_file"; variable 101 auto fd = open(path.c_str(), O_RDWR | O_CREAT, 0777); [all …]
|
/base/hiviewdfx/hiview/adapter/utility/ |
D | file_util.cpp | 181 return fs::path(fileFullName).parent_path().string(); in ExtractFilePath() 186 return fs::path(fileFullName).filename().string(); in ExtractFileName() 189 void GetDirFiles(const std::string& path, std::vector<std::string>& files) in GetDirFiles() argument 192 for (const auto& p : fs::directory_iterator(path)) { in GetDirFiles() 193 files.push_back(p.path().string()); in GetDirFiles() 199 bool ForceCreateDirectory(const std::string& path) in ForceCreateDirectory() argument 202 if (fs::exists(path, ec)) { in ForceCreateDirectory() 205 if (!fs::create_directories(path, ec)) { in ForceCreateDirectory() 208 return fs::exists(path, ec); in ForceCreateDirectory() 211 bool ForceCreateDirectory(const std::string& path, int mode) in ForceCreateDirectory() argument [all …]
|
/base/hiviewdfx/hiview/build/ |
D | run_oem_hook.py | 22 def find_oem_script(path): argument 23 for relpath, dirs, files in os.walk(path): 25 script_path = os.path.join(path, relpath, "oem_hook.py") 26 return os.path.normpath(os.path.abspath(script_path)) 41 hiview_build_path = os.path.split(os.path.realpath(__file__))[0] 42 hiview_path = os.path.realpath(os.path.join(hiview_build_path, "..")) 55 out_dir = os.path.dirname(output_file) 57 if os.path.isdir(out_dir) is False:
|
/base/security/device_auth/deps_adapter/os_adapter/impl/src/liteos/mini/ |
D | hc_file.c | 27 static int HcFileOpenRead(const char *path) in HcFileOpenRead() argument 29 int ret = UtilsFileOpen(path, O_RDONLY, 0); in HcFileOpenRead() 34 static int HcFileOpenWrite(const char *path) in HcFileOpenWrite() argument 36 int ret = UtilsFileOpen(path, O_RDWR_FS | O_CREAT_FS | O_TRUNC_FS, 0); in HcFileOpenWrite() 41 int HcFileOpen(const char *path, int mode, FileHandle *file) in HcFileOpen() argument 43 if (path == NULL || file == NULL) { in HcFileOpen() 46 if (strcpy_s(file->filePath, MAX_FILE_PATH_SIZE, path) != EOK) { in HcFileOpen() 51 file->fileHandle.fd = HcFileOpenRead(path); in HcFileOpen() 53 file->fileHandle.fd = HcFileOpenWrite(path); in HcFileOpen() 104 void HcFileRemove(const char *path) in HcFileRemove() argument [all …]
|
/base/update/updater/interfaces/kits/misc_info/ |
D | misc_info.cpp | 24 bool WriteUpdaterMessage(const std::string &path, const UpdateMessage &boot) in WriteUpdaterMessage() argument 26 char *realPath = realpath(path.c_str(), NULL); in WriteUpdaterMessage() 53 bool ReadUpdaterMessage(const std::string &path, UpdateMessage &boot) in ReadUpdaterMessage() argument 55 char *realPath = realpath(path.c_str(), NULL); in ReadUpdaterMessage() 89 auto path = GetBlockDeviceByMountPoint(MISC_PATH); in WriteUpdaterMiscMsg() local 90 if (path.empty()) { in WriteUpdaterMiscMsg() 92 path = MISC_FILE; in WriteUpdaterMiscMsg() 94 LOG(INFO) << "WriteUpdaterMiscMsg::misc path : " << path; in WriteUpdaterMiscMsg() 95 return WriteUpdaterMessage(path, boot); in WriteUpdaterMiscMsg() 100 auto path = GetBlockDeviceByMountPoint(MISC_PATH); in ReadUpdaterMiscMsg() local [all …]
|
/base/account/os_account/frameworks/common/file_operator/include/ |
D | account_file_operator.h | 31 ErrCode CreateDir(const std::string &path); 32 ErrCode DeleteDirOrFile(const std::string &path); 33 ErrCode InputFileByPathAndContent(const std::string &path, const std::string &content); 34 ErrCode GetFileContentByPath(const std::string &path, std::string &content); 35 bool IsExistFile(const std::string &path); 36 bool IsJsonFormat(const std::string &path); 37 bool IsJsonFileReady(const std::string &path); 38 bool IsExistDir(const std::string &path);
|
/base/security/certificate_manager/services/cert_manager_standard/cert_manager_engine/main/core/src/ |
D | cert_manager_file.c | 25 inline uint32_t CertManagerFileSize(const char *path, const char *fileName) in CertManagerFileSize() argument 27 return CmFileSize(path, fileName); in CertManagerFileSize() 30 inline uint32_t CertManagerFileRead(const char *path, const char *fileName, uint32_t offset, uint8_… in CertManagerFileRead() argument 32 return CmFileRead(path, fileName, offset, buf, len); in CertManagerFileRead() 35 inline int32_t CertManagerFileWrite(const char *path, const char *fileName, in CertManagerFileWrite() argument 38 return CmFileWrite(path, fileName, offset, buf, len); in CertManagerFileWrite() 41 inline int32_t CertManagerFileRemove(const char *path, const char *fileName) in CertManagerFileRemove() argument 43 return CmFileRemove(path, fileName); in CertManagerFileRemove() 46 static int32_t GetNumberOfFiles(const char *path) in GetNumberOfFiles() argument 48 void *dir = CmOpenDir(path); in GetNumberOfFiles() [all …]
|
D | cert_manager_file_operator.c | 30 static int32_t GetFileName(const char *path, const char *fileName, char *fullFileName, uint32_t ful… in GetFileName() argument 32 if (path != NULL) { in GetFileName() 33 if (strncpy_s(fullFileName, fullFileNameLen, path, strlen(path)) != EOK) { in GetFileName() 37 if (path[strlen(path) - 1] != '/') { in GetFileName() 54 static int32_t GetFullFileName(const char *path, const char *fileName, char **fullFileName) in GetFullFileName() argument 63 int32_t ret = GetFileName(path, fileName, tmpFileName, nameLen); in GetFullFileName() 83 int32_t CmIsDirExist(const char *path) in CmIsDirExist() argument 85 if (path == NULL) { in CmIsDirExist() 88 return IsFileExist(path); in CmIsDirExist() 196 int32_t CmFileRemove(const char *path, const char *fileName) in CmFileRemove() argument [all …]
|
/base/security/selinux/test/unittest/common/ |
D | test_common.cpp | 24 bool CreateDirectory(const std::string &path) in CreateDirectory() argument 29 index = path.find('/', index + 1); in CreateDirectory() 31 subPath = path; in CreateDirectory() 33 subPath = path.substr(0, index); in CreateDirectory() 43 return access(path.c_str(), F_OK) == 0; in CreateDirectory() 46 bool RemoveDirectory(const std::string &path) in RemoveDirectory() argument 54 if (access(path.c_str(), F_OK) != 0) { in RemoveDirectory() 57 int statRet = stat(path.c_str(), &dirStat); in RemoveDirectory() 63 remove(path.c_str()); in RemoveDirectory() 65 dirp = opendir(path.c_str()); in RemoveDirectory() [all …]
|
/base/update/updater/services/applypatch/ |
D | data_writer.cpp | 29 int DataWriter::OpenPath(const std::string &path) in OpenPath() argument 31 if (path.empty()) { in OpenPath() 36 if (access(path.c_str(), W_OK) < 0) { in OpenPath() 37 LOG(ERROR) << "Datawriter: " << path << " is not writable."; in OpenPath() 40 char *realPath = realpath(path.c_str(), NULL); in OpenPath() 48 … LOG(ERROR) << "Datawriter: open block device " << path << " failed " << " : " << strerror(errno); in OpenPath() 52 LOG(ERROR) << "Datawriter: seek " << path << "failed " << " : " << strerror(errno); in OpenPath() 59 std::unique_ptr<DataWriter> DataWriter::CreateDataWriter(WriteMode mode, const std::string &path, in CreateDataWriter() argument 64 return std::make_unique<RawWriter>(path, offset); in CreateDataWriter() 84 std::unique_ptr<DataWriter> DataWriter::CreateDataWriter(WriteMode mode, const std::string &path, in CreateDataWriter() argument [all …]
|
/base/security/huks/utils/file_operator/ |
D | hks_file_operator.h | 58 uint32_t HksFileRead(const char *path, const char *fileName, uint32_t offset, uint8_t *buf, uint32_… 60 int32_t HksFileWrite(const char *path, const char *fileName, uint32_t offset, const uint8_t *buf, u… 62 int32_t HksFileRemove(const char *path, const char *fileName); 64 uint32_t HksFileSize(const char *path, const char *fileName); 66 int32_t HksIsFileExist(const char *path, const char *fileName); 68 int32_t HksIsDirExist(const char *path); 70 int32_t HksMakeDir(const char *path); 72 void *HksOpenDir(const char *path); 80 int32_t HksDeleteDir(const char *path); 93 int32_t HksGetStoragePath(enum HksStoragePathType pathType, char *path, uint32_t *len); [all …]
|
D | hks_file_operator.c | 35 static int32_t GetFileName(const char *path, const char *fileName, char *fullFileName, uint32_t ful… in GetFileName() argument 37 if (path != NULL) { in GetFileName() 38 if (strncpy_s(fullFileName, fullFileNameLen, path, strlen(path)) != EOK) { in GetFileName() 42 if (path[strlen(path) - 1] != '/') { in GetFileName() 60 static int32_t GetFullFileName(const char *path, const char *fileName, char **fullFileName) in GetFullFileName() argument 67 int32_t ret = GetFileName(path, fileName, tmpFileName, nameLen); in GetFullFileName() 204 int32_t HksFileRemove(const char *path, const char *fileName) in HksFileRemove() argument 209 int32_t ret = GetFullFileName(path, fileName, &fullFileName); in HksFileRemove() 217 int32_t HksIsFileExist(const char *path, const char *fileName) in HksIsFileExist() argument 222 int32_t ret = GetFullFileName(path, fileName, &fullFileName); in HksIsFileExist() [all …]
|
/base/startup/init/interfaces/innerkits/file/ |
D | init_file.c | 34 char path[PATH_MAX] = { 0 }; in GetControlFile() local 35 …BEGET_ERROR_CHECK(snprintf_s(path, sizeof(path), sizeof(path) - 1, OHOS_FILE_ENV_PREFIX "%s", path… in GetControlFile() 37 BEGET_ERROR_CHECK(StringReplaceChr(path, '/', '_') == 0, in GetControlFile() 39 BEGET_LOGI("Environment path is %s ", path); in GetControlFile() 40 const char *val = getenv(path); in GetControlFile()
|
/base/update/packaging_tools/test/ |
D | create_package_data.py | 91 if not os.path.exists(package_name_path): 95 create_file(os.path.join(package_name_path, "system.img"), 107 create_file(os.path.join(package_name_path, "vendor.img"), 110 create_file(os.path.join(package_name_path, "updater_binary"), 114 create_file(os.path.join(package_name_path, "uImage"), 116 create_file(os.path.join(package_name_path, "updater.img"), 118 create_file(os.path.join(package_name_path, "updater_b.img"), 120 create_file(os.path.join(package_name_path, "updater_uImage"), 124 if not os.path.exists(updater_config_path): 126 create_file(os.path.join(updater_config_path, "BOARD.list"), [all …]
|
/base/hiviewdfx/hiview/adapter/utility/include/ |
D | file_util.h | 67 int32_t CreateFile(const std::string &path, mode_t mode = DEFAULT_FILE_MODE); 72 std::string IncludeTrailingPathDelimiter(const std::string& path); 73 std::string ExcludeTrailingPathDelimiter(const std::string& path); 74 void GetDirFiles(const std::string& path, std::vector<std::string>& files); 75 bool ForceCreateDirectory(const std::string& path); 76 bool ForceCreateDirectory(const std::string& path, mode_t mode); 77 void RemoveFolderBeginWith(const std::string &path, const std::string &folderName); 78 bool ForceRemoveDirectory(const std::string& path, bool isNeedDeleteGivenDirSelf = true); 80 uint64_t GetFolderSize(const std::string& path); 81 uint64_t GetFileSize(const std::string& path); [all …]
|
/base/startup/init/interfaces/innerkits/socket/ |
D | init_socket.c | 28 static int GetControlFromEnv(const char *path, int length) in GetControlFromEnv() argument 30 BEGET_CHECK_RETURN_VALUE(path != NULL && length > 0, -1); in GetControlFromEnv() 31 const char *val = getenv(path); in GetControlFromEnv() 32 BEGET_ERROR_CHECK(val != NULL, return -1, "Get environment from %s failed", path); in GetControlFromEnv() 43 char path[MAX_SOCKET_ENV_PREFIX_LEN] = {0}; in GetControlSocket() local 44 …BEGET_CHECK_RETURN_VALUE(snprintf_s(path, sizeof(path), sizeof(path) - 1, OHOS_SOCKET_ENV_PREFIX"%… in GetControlSocket() 46 int fd = GetControlFromEnv(path, MAX_SOCKET_ENV_PREFIX_LEN); in GetControlSocket()
|
/base/startup/init/services/param/liteos/ |
D | param_hal.c | 41 static int ParamFileOpen(const char* path, int oflag, int mode) in ParamFileOpen() argument 44 return open(path, oflag, mode); in ParamFileOpen() 46 return UtilsFileOpen(path, oflag, mode); in ParamFileOpen() 77 static int ParamFileDelete(const char* path) in ParamFileDelete() argument 80 return unlink(path); in ParamFileDelete() 82 return UtilsFileDelete(path); in ParamFileDelete() 86 static int ParamFileStat(const char* path, unsigned int* fileSize) in ParamFileStat() argument 89 int fd = open(path, O_RDONLY); in ParamFileStat() 97 return UtilsFileStat(path, fileSize); in ParamFileStat() 121 const char *path = PARAM_PERSIST_SAVE_TMP_PATH; in LoadPersistParam() local [all …]
|