/system/apex/apexd/ |
D | apexd_utils_test.cpp | 53 TemporaryFile child_file_1(root_dir.path); in TEST() 54 TemporaryFile child_file_2(root_dir.path); in TEST() 55 std::string child_dir = StringPrintf("%s/child-dir", root_dir.path); in TEST() 59 auto content = ReadDir(root_dir.path, [](auto _) { return true; }); in TEST() 63 auto del_result = DeleteDirContent(root_dir.path); in TEST() 65 content = ReadDir(root_dir.path, [](auto _) { return true; }); in TEST() 73 auto result = FindFirstExistingDirectory(first_dir.path, second_dir.path); in TEST() 75 ASSERT_EQ(*result, first_dir.path); in TEST() 81 auto result = FindFirstExistingDirectory(first_dir.path, second_dir); in TEST() 83 ASSERT_EQ(*result, first_dir.path); in TEST() [all …]
|
D | apex_file_repository_test.cpp | 80 fs::copy(GetTestFile("apex.apexd_test.apex"), built_in_dir.path); in TEST() 82 built_in_dir.path); in TEST() 84 fs::copy(GetTestFile("apex.apexd_test.apex"), data_dir.path); in TEST() 85 fs::copy(GetTestFile("apex.apexd_test_different_app.apex"), data_dir.path); in TEST() 88 ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path})); in TEST() 89 ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path)); in TEST() 105 ASSERT_EQ(StringPrintf("%s/%s", built_in_dir.path, apex_name.c_str()), in TEST() 112 ASSERT_EQ(StringPrintf("%s/%s", data_dir.path, apex_name.c_str()), *ret); in TEST() 123 ASSERT_RESULT_OK(instance.AddPreInstalledApex({built_in_dir.path})); in TEST() 124 ASSERT_RESULT_OK(instance.AddDataApex(data_dir.path)); in TEST() [all …]
|
D | apexd_utils.h | 48 android::base::Result<void> WalkDir(const std::string& path, Fn fn) { in WalkDir() argument 51 auto it = fs::directory_iterator(path, ec); in WalkDir() 59 << "Can't open " << path << " for reading : " << ec.message(); in WalkDir() 65 android::base::Result<std::vector<std::string>> ReadDir(const std::string& path, in ReadDir() argument 70 auto status = WalkDir(path, [&](const fs::directory_entry& entry) { in ReadDir() 72 ret.push_back(entry.path()); in ReadDir() 81 inline bool IsEmptyDirectory(const std::string& path) { in IsEmptyDirectory() argument 82 auto res = ReadDir(path, [](auto _) { return true; }); in IsEmptyDirectory() 86 inline android::base::Result<void> CreateDirIfNeeded(const std::string& path, in CreateDirIfNeeded() argument 90 if (stat(path.c_str(), &stat_data) != 0) { in CreateDirIfNeeded() [all …]
|
/system/incremental_delivery/incfs/ |
D | path.cpp | 32 namespace android::incfs::path { namespace 66 bool isAbsolute(std::string_view path) { in isAbsolute() argument 67 return !path.empty() && path[0] == '/'; in isAbsolute() 70 std::string normalize(std::string_view path) { in normalize() argument 71 if (path.empty()) { in normalize() 74 if (path.starts_with("../"sv)) { in normalize() 79 if (isAbsolute(path)) { in normalize() 80 path.remove_prefix(1); in normalize() 91 for (; end != path.npos; start = end + 1) { in normalize() 92 end = path.find('/', start); in normalize() [all …]
|
/system/unwinding/libunwindstack/benchmarks/ |
D | MapsBenchmark.cpp | 81 CreateMap(initial_maps.path, kNumSmallMaps, 2); in BM_local_updatable_maps_reparse_double_initial_small() 84 CreateMap(reparse_maps.path, kNumSmallMaps); in BM_local_updatable_maps_reparse_double_initial_small() 86 ReparseBenchmark(state, initial_maps.path, kNumSmallMaps / 2, reparse_maps.path, kNumSmallMaps); in BM_local_updatable_maps_reparse_double_initial_small() 92 CreateMap(initial_maps.path, kNumLargeMaps, 2); in BM_local_updatable_maps_reparse_double_initial_large() 95 CreateMap(reparse_maps.path, kNumLargeMaps); in BM_local_updatable_maps_reparse_double_initial_large() 97 ReparseBenchmark(state, initial_maps.path, kNumLargeMaps / 2, reparse_maps.path, kNumLargeMaps); in BM_local_updatable_maps_reparse_double_initial_large() 104 CreateMap(maps.path, kNumSmallMaps); in BM_local_updatable_maps_reparse_same_maps_small() 106 ReparseBenchmark(state, maps.path, kNumSmallMaps, maps.path, kNumSmallMaps); in BM_local_updatable_maps_reparse_same_maps_small() 112 CreateMap(maps.path, kNumLargeMaps); in BM_local_updatable_maps_reparse_same_maps_large() 114 ReparseBenchmark(state, maps.path, kNumLargeMaps, maps.path, kNumLargeMaps); in BM_local_updatable_maps_reparse_same_maps_large() [all …]
|
/system/unwinding/libunwindstack/tools/ |
D | strip.py | 33 def strip(path): argument 34 proc = subprocess.run(["readelf", "--file-header", "--sections", path], 39 if name == ".text" and os.path.basename(path) in ["vdso", "vdso.so", "libc.so"]: 43 print("Warning: {} not found in {}".format(name, path)) 46 with open(path, "r+b") as f: 58 with open(path, 'rb') as src, gzip.open(path + ".gz", 'wb') as dst: 60 os.remove(path) 67 for path in args.target: 68 if os.path.isdir(path): 69 for path in glob.glob(os.path.join(path, "**/*"), recursive=True): [all …]
|
/system/libbase/ |
D | file.cpp | 57 std::wstring path; in mkstemp() local 58 CHECK(android::base::UTF8ToWide(name_template, &path)) in mkstemp() 60 if (_wmktemp_s(path.data(), path.size() + 1) != 0) { in mkstemp() 66 int fd = _wopen(path.c_str(), O_CREAT | O_EXCL | O_RDWR | O_BINARY, S_IRUSR | S_IWUSR); in mkstemp() 72 CHECK(android::base::WideToUTF8(path, &path_utf8)) << "path can't be converted to utf8"; in mkstemp() 80 std::wstring path; in mkdtemp() local 81 CHECK(android::base::UTF8ToWide(name_template, &path)) in mkdtemp() 84 if (_wmktemp_s(path.data(), path.size() + 1) != 0) { in mkdtemp() 88 if (_wmkdir(path.c_str()) != 0) { in mkdtemp() 93 CHECK(android::base::WideToUTF8(path, &path_utf8)) << "path can't be converted to utf8"; in mkdtemp() [all …]
|
D | file_test.cpp | 48 ASSERT_NE(tf.fd, -1) << tf.path; in TEST() 49 ASSERT_TRUE(android::base::WriteStringToFile("abc", tf.path)) in TEST() 52 ASSERT_TRUE(android::base::ReadFileToString(tf.path, &s)) in TEST() 61 ASSERT_EQ(0, unlink(link.path)); in TEST() 62 ASSERT_EQ(0, symlink(target.path, link.path)); in TEST() 63 ASSERT_FALSE(android::base::WriteStringToFile("foo", link.path, false)); in TEST() 65 ASSERT_TRUE(android::base::WriteStringToFile("foo", link.path, true)); in TEST() 68 ASSERT_FALSE(android::base::ReadFileToString(link.path, &s)); in TEST() 70 ASSERT_TRUE(android::base::ReadFileToString(link.path, &s, true)); in TEST() 80 ASSERT_NE(tf.fd, -1) << tf.path; in TEST() [all …]
|
/system/core/libcutils/ |
D | fs.cpp | 42 static int fs_prepare_path_impl(const char* path, mode_t mode, uid_t uid, gid_t gid, in fs_prepare_path_impl() argument 52 if (TEMP_FAILURE_RETRY(lstat(path, &sb)) == -1) { in fs_prepare_path_impl() 56 ALOGE("Failed to lstat(%s): %s", path, strerror(errno)); in fs_prepare_path_impl() 64 ALOGE("Not a %s: %s", (prepare_as_dir ? "directory" : "regular file"), path); in fs_prepare_path_impl() 77 path, uid, gid, sb.st_uid, sb.st_gid); in fs_prepare_path_impl() 81 path, mode, (sb.st_mode & ALL_PERMS)); in fs_prepare_path_impl() 88 ? TEMP_FAILURE_RETRY(mkdir(path, mode)) in fs_prepare_path_impl() 89 : TEMP_FAILURE_RETRY(open(path, O_CREAT | O_CLOEXEC | O_NOFOLLOW | O_RDONLY, 0644)); in fs_prepare_path_impl() 93 (prepare_as_dir ? "mkdir" : "open"), path, strerror(errno)); in fs_prepare_path_impl() 99 ALOGW("Failed to close file after create %s: %s", path, strerror(errno)); in fs_prepare_path_impl() [all …]
|
/system/core/healthd/ |
D | BatteryMonitor_v1.cpp | 230 static int readFromFile(const String8& path, std::string* buf) { in readFromFile() argument 232 if (android::base::ReadFileToString(path.c_str(), buf)) { in readFromFile() 238 static BatteryMonitor::PowerSupplyType readPowerSupplyType(const String8& path) { in readPowerSupplyType() argument 258 if (readFromFile(path, &buf) <= 0) { in readPowerSupplyType() 271 static bool getBooleanField(const String8& path) { in getBooleanField() argument 275 if (readFromFile(path, &buf) > 0) in getBooleanField() 282 static int getIntField(const String8& path) { in getIntField() argument 286 if (readFromFile(path, &buf) > 0) in getIntField() 295 String8 path; in isScopedPowerSupply() local 296 path.appendFormat("%s/%s/scope", POWER_SUPPLY_SYSFS_PATH, name); in isScopedPowerSupply() [all …]
|
D | BatteryMonitor.cpp | 288 static int readFromFile(const String8& path, std::string* buf) { in readFromFile() argument 290 if (android::base::ReadFileToString(path.c_str(), buf)) { in readFromFile() 296 static bool writeToFile(const String8& path, int32_t in_value) { in writeToFile() argument 297 return android::base::WriteStringToFile(std::to_string(in_value), path.c_str()); in writeToFile() 300 static BatteryMonitor::PowerSupplyType readPowerSupplyType(const String8& path) { in readPowerSupplyType() argument 320 if (readFromFile(path, &buf) <= 0) { in readPowerSupplyType() 333 static bool getBooleanField(const String8& path) { in getBooleanField() argument 337 if (readFromFile(path, &buf) > 0) in getBooleanField() 344 static int getIntField(const String8& path) { in getIntField() argument 348 if (readFromFile(path, &buf) > 0) in getIntField() [all …]
|
/system/tools/mkbootimg/tests/ |
D | mkbootimg_test.py | 45 random.seed(os.path.basename(pathname) if seed is None else seed) 79 self._exec_dir = os.path.abspath(os.path.dirname(sys.argv[0])) 81 self._avbtool_path = os.path.join(self._exec_dir, 'avbtool') 90 boot_img = os.path.join(temp_out_dir, 'boot.img') 91 kernel = generate_test_file(os.path.join(temp_out_dir, 'kernel'), 93 ramdisk = generate_test_file(os.path.join(temp_out_dir, 'ramdisk'), 117 '--out', os.path.join(temp_out_dir, 'out'), 156 os.path.join(temp_out_dir, 'out', 'boot_signature') 175 boot_img = os.path.join(temp_out_dir, 'boot.img') 176 kernel = generate_test_file(os.path.join(temp_out_dir, 'kernel'), [all …]
|
/system/sepolicy/tools/ |
D | sepolicy_cleanup_check.sh | 39 …if [[ `find $sedir -name "*_contexts" -not -path "*prebuilts*" -exec grep $type '{}' \; |wc -l` -e… 52 path=`echo $path_line | sed 's/^.*:[^\/]*\([^ ]*\) .*$/\1/'` 54 path=`echo $path | sed 's/\[[^]]*\]/*/' | sed 's/+/*/'` 56 if [ -n "`$adb_cmd shell ls -lZ $path < /dev/null |& grep "No such file or directory"`" ]; then 57 echo "$path does not exist" 66 …path=`echo $file_line | sed 's/rootfs //' | sed 's/sysfs /\/sys/' | sed 's/proc /\/proc/' | sed 's… 68 if [[ $path = *" "* ]]; then 72 if [ -n "`$adb_cmd shell ls -lZ $path < /dev/null |& grep "No such file or directory"`" ]; then 73 echo "$path does not exist" 80 …name file_contexts -not -path "*prebuilts*" -exec grep "^/" '{}' \; | cut -d' ' -f1 | cut -f1 | so… [all …]
|
/system/incremental_delivery/incfs/include/ |
D | path.h | 26 namespace android::incfs::path { 36 std::string readlink(std::string_view path); 37 bool isAbsolute(std::string_view path); 38 std::string normalize(std::string_view path); 56 inline std::string_view baseName(std::string_view path) { in baseName() argument 58 if (path.empty()) { in baseName() 61 if (path == "/"sv) { in baseName() 64 auto pos = path.rfind('/'); in baseName() 65 while (!path.empty() && pos == path.size() - 1) { in baseName() 66 path.remove_suffix(1); in baseName() [all …]
|
/system/apex/tools/ |
D | apexd_host.py | 48 def DirectoryType(path): argument 49 if not os.path.exists(path): 51 if not os.path.isdir(path): 53 return os.path.realpath(path) 56 def ExistentDirectoryType(path): argument 57 if not os.path.exists(path): 59 return DirectoryType(path) 119 exec_path = os.path.realpath(sys.argv[0]) 121 script_name = os.path.basename(exec_path)[:-3] 125 tool_path = os.path.dirname(os.path.dirname(exec_path)) [all …]
|
D | apexer_with_DCLA_preprocessing_test.py | 29 TEST_PRIVATE_KEY = os.path.join('testdata', 'com.android.example.apex.pem') 81 if os.path.isdir(i): 99 payload_img = os.path.join(apex_dir, 'apex_payload.img') 100 extract_dir = os.path.join(apex_dir, 'payload_extract') 105 lost_and_found = os.path.join(extract_dir, 'lost+found') 106 etc_dir = os.path.join(extract_dir, 'etc') 107 os.remove(os.path.join(extract_dir, 'apex_manifest.pb')) 108 if os.path.isdir(lost_and_found): 110 if os.path.isdir(etc_dir): 124 apexer_wrapper = os.path.join(host_tools_dir, 'apexer_with_DCLA_preprocessing') [all …]
|
D | apex_elf_checker.py | 57 exec_path = os.path.realpath(sys.argv[0]) 59 script_name = os.path.basename(exec_path)[:-3] 67 path = os.path.join(p, name) 68 if os.path.exists(path): 69 return path 83 def IsElfFile(path): argument 84 with open(path, 'rb') as f: 90 def ParseElfNeeded(path, tools): argument 92 [tools['llvm-readelf'], '-d', '--elf-output-style', 'LLVM', path], 108 path = os.path.join(parent, file) [all …]
|
/system/tools/hidl/hashing/ |
D | Hash.cpp | 34 Hash& Hash::getMutableHash(const std::string& path) { in getMutableHash() argument 37 auto it = hashes.find(path); in getMutableHash() 39 if (hashes.find(path) == hashes.end()) { in getMutableHash() 40 it = hashes.insert(it, {path, Hash(path)}); in getMutableHash() 46 const Hash& Hash::getHash(const std::string& path) { in getHash() argument 47 return getMutableHash(path); in getHash() 50 void Hash::clearHash(const std::string& path) { in clearHash() argument 51 getMutableHash(path).mHash = kEmptyHash; in clearHash() 54 static std::vector<uint8_t> sha256File(const std::string& path) { in sha256File() argument 55 std::ifstream stream(path); in sha256File() [all …]
|
/system/core/init/ |
D | util_test.cpp | 44 EXPECT_RESULT_OK(WriteFile(tf.path, s)); in TEST() 45 EXPECT_NE(-1, fchmodat(AT_FDCWD, tf.path, 0620, AT_SYMLINK_NOFOLLOW)) << strerror(errno); in TEST() 46 auto file_contents = ReadFile(tf.path); in TEST() 55 EXPECT_RESULT_OK(WriteFile(tf.path, s)); in TEST() 56 EXPECT_NE(-1, fchmodat(AT_FDCWD, tf.path, 0602, AT_SYMLINK_NOFOLLOW)) << strerror(errno); in TEST() 57 auto file_contents = ReadFile(tf.path); in TEST() 90 EXPECT_RESULT_OK(WriteFile(tf.path, contents)); in TEST() 92 auto read_back_contents = ReadFile(tf.path); in TEST() 101 std::string path = android::base::StringPrintf("%s/does-not-exist", test_dir.path); in TEST() local 102 EXPECT_RESULT_OK(WriteFile(path, s)); in TEST() [all …]
|
D | devices.cpp | 63 static bool FindPciDevicePrefix(const std::string& path, std::string* result) { in FindPciDevicePrefix() argument 66 if (!StartsWith(path, "/devices/pci")) return false; in FindPciDevicePrefix() 73 auto end = path.find('/', start); in FindPciDevicePrefix() 76 end = path.find('/', end + 1); in FindPciDevicePrefix() 86 *result = path.substr(start, length); in FindPciDevicePrefix() 94 static bool FindVbdDevicePrefix(const std::string& path, std::string* result) { in FindVbdDevicePrefix() argument 97 if (!StartsWith(path, "/devices/vbd-")) return false; in FindVbdDevicePrefix() 104 auto end = path.find('/', start); in FindVbdDevicePrefix() 110 *result = path.substr(start, length); in FindVbdDevicePrefix() 119 if (!StartsWith(uevent.path, "/devices/virtual/block/dm-")) return false; in FindDmDevice() [all …]
|
/system/vold/ |
D | VoldNativeServiceValidation.cpp | 76 binder::Status CheckArgumentPath(const std::string& path) { in CheckArgumentPath() argument 77 if (path.empty()) { in CheckArgumentPath() 80 if (path[0] != '/') { in CheckArgumentPath() 82 StringPrintf("Path %s is relative", path.c_str())); in CheckArgumentPath() 84 if (path.find("/../"sv) != path.npos || android::base::EndsWith(path, "/.."sv)) { in CheckArgumentPath() 86 StringPrintf("Path %s is shady", path.c_str())); in CheckArgumentPath() 88 for (const char& c : path) { in CheckArgumentPath() 91 StringPrintf("Path %s is malformed", path.c_str())); in CheckArgumentPath() 108 binder::Status CheckIncrementalPath(IncrementalPathKind kind, const std::string& path) { in CheckIncrementalPath() argument 109 if (auto status = CheckArgumentPath(path); !status.isOk()) { in CheckIncrementalPath() [all …]
|
D | AppFuseUtil.cpp | 36 static android::status_t GetMountPath(uid_t uid, const std::string& name, std::string* path) { in GetMountPath() argument 47 *path = StringPrintf("/mnt/appfuse/%d_%s", uid, name.c_str()); in GetMountPath() 51 static android::status_t Mount(int device_fd, const std::string& path) { in Mount() argument 63 TEMP_FAILURE_RETRY(mount("/dev/fuse", path.c_str(), "fuse", in Mount() 66 PLOG(ERROR) << "Failed to mount " << path; in Mount() 73 static android::status_t RunCommand(const std::string& command, uid_t uid, const std::string& path, in RunCommand() argument 76 LOG(DEBUG) << "Run app fuse command " << command << " for the path " << path << " and uid " in RunCommand() 81 return Mount(device_fd, path); in RunCommand() 85 if (umount2(path.c_str(), UMOUNT_NOFOLLOW | MNT_DETACH) != 0 && errno != EINVAL && in RunCommand() 90 if (rmdir(path.c_str()) != 0) { in RunCommand() [all …]
|
/system/libvintf/ |
D | FileSystem.cpp | 29 status_t FileSystemImpl::fetch(const std::string& path, std::string* fetched, in fetch() argument 31 if (!android::base::ReadFileToString(path, fetched, true /* follow_symlinks */)) { in fetch() 34 *error = "Cannot read " + path + ": " + strerror(saved_errno); in fetch() 41 status_t FileSystemImpl::listFiles(const std::string& path, std::vector<std::string>* out, in listFiles() argument 43 std::unique_ptr<DIR, decltype(&closedir)> dir(opendir(path.c_str()), closedir); in listFiles() 47 *error = "Cannot open " + path + ": " + strerror(saved_errno); in listFiles() 61 *error = "Failed while reading directory " + path + ": " + strerror(saved_errno); in listFiles() 67 status_t FileSystemImpl::modifiedTime(const std::string& path, timespec* mtime, in modifiedTime() argument 70 if (stat(path.c_str(), &stat_buf) != 0) { in modifiedTime() 73 *error = "Cannot open " + path + ": " + strerror(saved_errno); in modifiedTime() [all …]
|
/system/security/ondevice-signing/ |
D | VerityUtils.cpp | 93 Result<std::vector<uint8_t>> createDigest(const std::string& path) { in createDigest() argument 94 unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_CLOEXEC))); in createDigest() 135 static Result<std::string> measureFsVerity(const std::string& path) { in measureFsVerity() argument 136 unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_CLOEXEC))); in measureFsVerity() 138 return ErrnoError() << "Failed to open " << path; in measureFsVerity() 161 Result<void> enableFsVerity(const std::string& path) { in enableFsVerity() argument 162 unique_fd fd(TEMP_FAILURE_RETRY(open(path.c_str(), O_RDONLY | O_CLOEXEC))); in enableFsVerity() 164 return Error() << "Can't open " << path; in enableFsVerity() 178 Result<std::map<std::string, std::string>> addFilesToVerityRecursive(const std::string& path) { in addFilesToVerityRecursive() argument 182 auto it = std::filesystem::recursive_directory_iterator(path, ec); in addFilesToVerityRecursive() [all …]
|
/system/linkerconfig/modules/ |
D | namespace.cc | 58 ns.AddSearchPath(apex_info.path + "/${LIB}"); in InitializeWithApex() 62 ns.AddSearchPath(apex_info.path + "/${LIB}/hw"); in InitializeWithApex() 64 ns.AddPermittedPath(apex_info.path + "/${LIB}"); in InitializeWithApex() 132 void Namespace::AddSearchPath(const std::string& path) { in AddSearchPath() argument 133 search_paths_.push_back(path); in AddSearchPath() 135 if (RequiresAsanPath(path)) { in AddSearchPath() 136 asan_search_paths_.push_back(CreateAsanPath(path)); in AddSearchPath() 138 asan_search_paths_.push_back(path); in AddSearchPath() 141 void Namespace::AddPermittedPath(const std::string& path) { in AddPermittedPath() argument 142 permitted_paths_.push_back(path); in AddPermittedPath() [all …]
|