Lines Matching refs:path
72 static bool should_use_fs_config([[maybe_unused]] const std::string& path) { in should_use_fs_config() argument
82 return !android::base::StartsWith(path, "/data/"); in should_use_fs_config()
88 static bool update_capabilities(const char* path, uint64_t capabilities) { in update_capabilities() argument
92 removexattr(path, XATTR_NAME_CAPS); in update_capabilities()
102 return setxattr(path, XATTR_NAME_CAPS, &cap_data, sizeof(cap_data), 0) != -1; in update_capabilities()
104 UNUSED(path, capabilities); in update_capabilities()
109 static bool secure_mkdirs(const std::string& path) { in secure_mkdirs() argument
110 if (path[0] != '/') return false; in secure_mkdirs()
112 std::vector<std::string> path_components = android::base::Split(path, "/"); in secure_mkdirs()
150 static bool do_lstat_v1(int s, const char* path) { in do_lstat_v1() argument
155 lstat(path, &st); in do_lstat_v1()
162 static bool do_stat_v2(int s, uint32_t id, const char* path) { in do_stat_v2() argument
174 int rc = stat_fn(path, &st); in do_stat_v2()
194 static bool do_list(int s, const char* path) { in do_list() argument
207 std::unique_ptr<DIR, int(*)(DIR*)> d(opendir(path), closedir); in do_list()
214 std::string filename(StringPrintf("%s/%s", path, de->d_name)); in do_list()
254 static bool do_list_v1(int s, const char* path) { in do_list_v1() argument
255 return do_list<false>(s, path); in do_list_v1()
258 static bool do_list_v2(int s, const char* path) { in do_list_v2() argument
259 return do_list<true>(s, path); in do_list_v2()
354 static bool handle_send_file(borrowed_fd s, const char* path, uint32_t* timestamp, uid_t uid, in handle_send_file() argument
362 __android_log_security_bswrite(SEC_TAG_ADB_SEND_FILE, path); in handle_send_file()
363 fd.reset(adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, mode)); in handle_send_file()
366 if (!secure_mkdirs(Dirname(path))) { in handle_send_file()
370 fd.reset(adb_open_mode(path, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, mode)); in handle_send_file()
373 fd.reset(adb_open_mode(path, O_WRONLY | O_CLOEXEC, mode)); in handle_send_file()
385 if (!Realpath(path, &real_path) || lstat(Dirname(real_path).c_str(), &st) == -1 || in handle_send_file()
394 selinux_android_restorecon(path, 0); in handle_send_file()
414 if (!update_capabilities(path, capabilities)) { in handle_send_file()
452 if (do_unlink) adb_unlink(path); in handle_send_file()
457 extern bool handle_send_link(int s, const std::string& path,
461 static bool handle_send_link(int s, const std::string& path, uint32_t* timestamp, bool dry_run, in handle_send_link() argument
481 if (!android::base::Readlink(path, &buf_link) || (buf_link != &buffer[0])) { in handle_send_link()
482 adb_unlink(path.c_str()); in handle_send_link()
483 auto ret = symlink(&buffer[0], path.c_str()); in handle_send_link()
485 if (!secure_mkdirs(Dirname(path))) { in handle_send_link()
489 ret = symlink(&buffer[0], path.c_str()); in handle_send_link()
514 static bool send_impl(int s, const std::string& path, mode_t mode, CompressionType compression, in send_impl() argument
520 do_unlink = (lstat(path.c_str(), &st) == -1) || S_ISREG(st.st_mode) || in send_impl()
524 adb_unlink(path.c_str()); in send_impl()
530 result = handle_send_link(s, path, ×tamp, dry_run, buffer); in send_impl()
540 if (!dry_run && should_use_fs_config(path)) { in send_impl()
541 adbd_fs_config(path.c_str(), false, nullptr, &uid, &gid, &mode, &capabilities); in send_impl()
544 result = handle_send_file(s, path.c_str(), ×tamp, uid, gid, capabilities, mode, in send_impl()
557 lutimes(path.c_str(), tv); in send_impl()
569 std::string path = spec.substr(0, comma); in do_send_v1() local
578 return send_impl(s, path, mode, CompressionType::None, false, buffer); in do_send_v1()
581 static bool do_send_v2(int s, const std::string& path, std::vector<char>& buffer) { in do_send_v2() argument
631 return send_impl(s, path, msg.send_v2_setup.mode, compression.value_or(CompressionType::None), in do_send_v2()
635 static bool recv_impl(borrowed_fd s, const char* path, CompressionType compression, in recv_impl() argument
637 __android_log_security_bswrite(SEC_TAG_ADB_RECV_FILE, path); in recv_impl()
639 unique_fd fd(adb_open(path, O_RDONLY | O_CLOEXEC)); in recv_impl()
726 static bool do_recv_v1(borrowed_fd s, const char* path, std::vector<char>& buffer) { in do_recv_v1() argument
727 return recv_impl(s, path, CompressionType::None, buffer); in do_recv_v1()
730 static bool do_recv_v2(borrowed_fd s, const char* path, std::vector<char>& buffer) { in do_recv_v2() argument
773 return recv_impl(s, path, compression.value_or(CompressionType::None), buffer); in do_recv_v2()