/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/hiview/base/utility/ |
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 void GetDirDirs(const std::string& path, std::vector<std::string>& dirs) in GetDirDirs() argument 98 DIR* dir = opendir(path.c_str()); in GetDirDirs() 111 dirs.push_back(IncludeTrailingPathDelimiter(path) + string(ptr->d_name)); in GetDirDirs() 117 bool ForceCreateDirectory(const std::string& path) in ForceCreateDirectory() argument [all …]
|
/base/security/dlp_permission_service/services/dlp_permission/sa/adapt/ |
D | file_operator.cpp | 41 int32_t FileOperator::InputFileByPathAndContent(const std::string& path, const std::string& content) in InputFileByPathAndContent() argument 43 std::string str = path; in InputFileByPathAndContent() 58 FILE* fp = fopen(path.c_str(), "wb"); in InputFileByPathAndContent() 60 DLP_LOG_INFO(LABEL, "failed to open %{public}s, errno %{public}d.", path.c_str(), errno); in InputFileByPathAndContent() 65 DLP_LOG_INFO(LABEL, "failed to fwrite %{public}s, errno %{public}d.", path.c_str(), errno); in InputFileByPathAndContent() 70 DLP_LOG_INFO(LABEL, "failed to fflush %{public}s, errno %{public}d.", path.c_str(), errno); in InputFileByPathAndContent() 75 DLP_LOG_INFO(LABEL, "failed to fsync %{public}s, errno %{public}d.", path.c_str(), errno); in InputFileByPathAndContent() 81 if (!ChangeModeFile(path, S_IRUSR | S_IWUSR)) { in InputFileByPathAndContent() 82 …DLP_LOG_INFO(LABEL, "failed to change mode for file %{public}s, errno %{public}d.", path.c_str(), … in InputFileByPathAndContent() 88 int32_t FileOperator::GetFileContentByPath(const std::string& path, std::string& content) in GetFileContentByPath() argument [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/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/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/selinux_adapter/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/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/huks/utils/file_operator/ |
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 …]
|
D | hks_file_operator.h | 75 uint32_t HksFileRead(const char *path, const char *fileName, uint32_t offset, uint8_t *buf, uint32_… 77 int32_t HksFileWrite(const char *path, const char *fileName, uint32_t offset, const uint8_t *buf, u… 79 int32_t HksFileRemove(const char *path, const char *fileName); 81 uint32_t HksFileSize(const char *path, const char *fileName); 83 int32_t HksIsFileExist(const char *path, const char *fileName); 85 int32_t HksIsDirExist(const char *path); 87 int32_t HksMakeDir(const char *path); 89 void *HksOpenDir(const char *path); 97 int32_t HksDeleteDir(const char *path); 110 int32_t HksGetStoragePath(enum HksStoragePathType pathType, char *path, uint32_t *len); [all …]
|
D | hks_file_operator_lite.c | 51 static int32_t GetFileName(const char *path, const char *fileName, char *fullFileName, uint32_t ful… in GetFileName() argument 53 if (path != NULL) { in GetFileName() 54 if (strncpy_s(fullFileName, fullFileNameLen, path, strlen(path)) != EOK) { in GetFileName() 58 if (path[strlen(path) - 1] != '/') { in GetFileName() 76 static int32_t GetFullFileName(const char *path, const char *fileName, char **fullFileName) in GetFullFileName() argument 83 int32_t ret = GetFileName(path, fileName, tmpFileName, nameLen); in GetFullFileName() 200 int32_t HksIsDirExist(const char *path) in HksIsDirExist() argument 202 HKS_IF_NULL_RETURN(path, HKS_ERROR_NULL_POINTER) in HksIsDirExist() 203 return IsFileExist(path); in HksIsDirExist() 206 int32_t HksMakeDir(const char *path) in HksMakeDir() argument [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/sys_installer/services/module_update/util/src/ |
D | module_utils.cpp | 38 bool CreateDirIfNeeded(const std::string &path, mode_t mode) in CreateDirIfNeeded() argument 42 if (stat(path.c_str(), &statData) != 0) { in CreateDirIfNeeded() 44 if (mkdir(path.c_str(), mode) != 0) { in CreateDirIfNeeded() 45 LOG(ERROR) << "Could not mkdir " << path; in CreateDirIfNeeded() 49 LOG(ERROR) << "Could not stat " << path; in CreateDirIfNeeded() 54 LOG(ERROR) << path << " exists and is not a directory"; in CreateDirIfNeeded() 61 if (chmod(path.c_str(), mode) != 0) { in CreateDirIfNeeded() 62 LOG(ERROR) << "Could not chmod " << path; in CreateDirIfNeeded() 68 bool CheckPathExists(const std::string &path) in CheckPathExists() argument 71 return stat(path.c_str(), &buffer) == 0; in CheckPathExists() [all …]
|
/base/hiviewdfx/hiview/base/utility/include/ |
D | file_util.h | 69 int32_t CreateFile(const std::string &path, mode_t mode = DEFAULT_FILE_MODE); 74 std::string IncludeTrailingPathDelimiter(const std::string& path); 75 std::string ExcludeTrailingPathDelimiter(const std::string& path); 76 void GetDirFiles(const std::string& path, std::vector<std::string>& files); 77 void GetDirDirs(const std::string& path, std::vector<std::string>& dirs); 78 bool ForceCreateDirectory(const std::string& path); 79 bool ForceCreateDirectory(const std::string& path, mode_t mode); 80 void RemoveFolderBeginWith(const std::string &path, const std::string &folderName); 81 bool ForceRemoveDirectory(const std::string& path, bool isNeedDeleteGivenDirSelf = true); 83 uint64_t GetFolderSize(const std::string& path); [all …]
|
/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/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 …]
|
/base/update/updater/test/unittest/misc_info_test/ |
D | misc_info_unittest.cpp | 50 std::string path = ""; variable 51 bool ret = WriteUpdaterMessage(path, boot); 54 path = MISC_FILE; 55 ret = WriteUpdaterMessage(path, boot); 58 path = ""; 59 ret = ReadUpdaterMessage(path, boot); 61 unlink(path.c_str()); 63 path = MISC_FILE; 64 ret = ReadUpdaterMessage(path, boot);
|
/base/security/huks/services/huks_standard/huks_service/main/core/src/ |
D | hks_storage_file_lock.c | 29 char *path; member 45 if (lock->path) { in FreeFileLock() 46 HksFree(lock->path); in FreeFileLock() 47 lock->path = NULL; in FreeFileLock() 76 static HksStorageFileLock *FindFileLock(const char *path) in FindFileLock() argument 80 if (strcmp(path, iter->path) == 0) { in FindFileLock() 89 static HksStorageFileLock *AllocFileLock(const char *path) in AllocFileLock() argument 94 size_t len = strlen(path); in AllocFileLock() 95 lock->path = HksMalloc(len + 1); in AllocFileLock() 96 if (lock->path == NULL) { in AllocFileLock() [all …]
|
/base/hiviewdfx/hidumper/frameworks/native/ |
D | dump_utils.cpp | 86 char path[PATH_MAX] = {0}; in FdToRead() local 87 if (realpath(file.c_str(), path) == nullptr) { in FdToRead() 89 path, file.c_str()); in FdToRead() 93 if (file != std::string(path)) { in FdToRead() 95 path, file.c_str()); in FdToRead() 98 int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC | O_NONBLOCK)); in FdToRead() 100 … DUMPER_HILOGD(MODULE_COMMON, "open [%{public}s] %{public}s", path, ErrnoToMsg(errno).c_str()); in FdToRead() 116 char path[PATH_MAX] = {0}; in FdToWrite() local 117 if (realpath(tempPath.c_str(), path) != nullptr) { in FdToWrite() 118 std::string fileName = path + split + name; in FdToWrite() [all …]
|
/base/hiviewdfx/faultloggerd/interfaces/innerkits/procinfo/ |
D | procinfo.cpp | 44 static bool GetProcStatusByPath(struct ProcInfo& procInfo, const std::string& path) in GetProcStatusByPath() argument 47 FILE *fp = fopen(path.c_str(), "r"); in GetProcStatusByPath() 101 std::string path = StringPrintf("/proc/%d/task/%d/status", pid, tid); in TidToNstid() local 102 if (path.empty()) { in TidToNstid() 107 if (!GetProcStatusByPath(procInfo, path)) { in TidToNstid() 119 std::string path = StringPrintf("/proc/%d/status", realPid); in GetProcStatusByPid() local 120 return GetProcStatusByPath(procInfo, path); in GetProcStatusByPid() 130 std::string path; in IsThreadInPid() local 132 path = StringPrintf("%s/%d", PROC_SELF_TASK_PATH, tid); in IsThreadInPid() 134 path = StringPrintf("/proc/%d/task/%d", pid, tid); in IsThreadInPid() [all …]
|