Lines Matching refs:lpath
86 std::string lpath; member
97 : lpath(local_path), rpath(remote_path), mode(mode) { in copyinfo()
98 ensure_trailing_separators(lpath, rpath); in copyinfo()
99 lpath.append(name); in copyinfo()
102 ensure_trailing_separators(lpath, rpath); in copyinfo()
563 bool SendSmallFile(const std::string& path, mode_t mode, const std::string& lpath, in SendSmallFile() argument
568 return SendLargeFile(path, mode, lpath, rpath, mtime, CompressionType::None, dry_run); in SendSmallFile()
601 WriteOrDie(lpath, rpath, &buf[0], (p - &buf[0])); in SendSmallFile()
603 RecordFileSent(lpath, rpath); in SendSmallFile()
609 bool SendLargeFile(const std::string& path, mode_t mode, const std::string& lpath, in SendLargeFile() argument
618 return SendLargeFileLegacy(path, mode, lpath, rpath, mtime); in SendLargeFile()
629 if (stat(lpath.c_str(), &st) == -1) { in SendLargeFile()
630 Error("cannot stat '%s': %s", lpath.c_str(), strerror(errno)); in SendLargeFile()
637 unique_fd lfd(adb_open(lpath.c_str(), O_RDONLY | O_CLOEXEC)); in SendLargeFile()
639 Error("opening '%s' locally failed: %s", lpath.c_str(), strerror(errno)); in SendLargeFile()
675 Error("reading '%s' locally failed: %s", lpath.c_str(), strerror(errno)); in SendLargeFile()
693 Error("compressing '%s' locally failed", lpath.c_str()); in SendLargeFile()
700 WriteOrDie(lpath, rpath, &sbuf, sizeof(SyncRequest) + output.size()); in SendLargeFile()
717 RecordFileSent(lpath, rpath); in SendLargeFile()
718 return WriteOrDie(lpath, rpath, &msg.data, sizeof(msg.data)); in SendLargeFile()
721 bool SendLargeFileLegacy(const std::string& path, mode_t mode, const std::string& lpath, in SendLargeFileLegacy() argument
731 if (stat(lpath.c_str(), &st) == -1) { in SendLargeFileLegacy()
732 Error("cannot stat '%s': %s", lpath.c_str(), strerror(errno)); in SendLargeFileLegacy()
739 unique_fd lfd(adb_open(lpath.c_str(), O_RDONLY | O_CLOEXEC)); in SendLargeFileLegacy()
741 Error("opening '%s' locally failed: %s", lpath.c_str(), strerror(errno)); in SendLargeFileLegacy()
751 Error("reading '%s' locally failed: %s", lpath.c_str(), strerror(errno)); in SendLargeFileLegacy()
758 WriteOrDie(lpath, rpath, &sbuf, sizeof(SyncRequest) + bytes_read); in SendLargeFileLegacy()
768 RecordFileSent(lpath, rpath); in SendLargeFileLegacy()
769 return WriteOrDie(lpath, rpath, &msg.data, sizeof(msg.data)); in SendLargeFileLegacy()
1030 static bool sync_send(SyncConnection& sc, const std::string& lpath, const std::string& rpath, in sync_send() argument
1046 ssize_t data_length = readlink(lpath.c_str(), buf, PATH_MAX - 1); in sync_send()
1048 sc.Error("readlink '%s' failed: %s", lpath.c_str(), strerror(errno)); in sync_send()
1053 if (!sc.SendSmallFile(rpath, mode, lpath, rpath, mtime, buf, data_length, dry_run)) { in sync_send()
1061 if (stat(lpath.c_str(), &st) == -1) { in sync_send()
1062 sc.Error("failed to stat local file '%s': %s", lpath.c_str(), strerror(errno)); in sync_send()
1067 if (!android::base::ReadFileToString(lpath, &data, true)) { in sync_send()
1068 sc.Error("failed to read all of '%s': %s", lpath.c_str(), strerror(errno)); in sync_send()
1071 if (!sc.SendSmallFile(rpath, mode, lpath, rpath, mtime, data.data(), data.size(), in sync_send()
1076 if (!sc.SendLargeFile(rpath, mode, lpath, rpath, mtime, compression, dry_run)) { in sync_send()
1083 static bool sync_recv_v1(SyncConnection& sc, const char* rpath, const char* lpath, const char* name, in sync_recv_v1() argument
1087 adb_unlink(lpath); in sync_recv_v1()
1088 unique_fd lfd(adb_creat(lpath, 0644)); in sync_recv_v1()
1090 sc.Error("cannot create '%s': %s", lpath, strerror(errno)); in sync_recv_v1()
1098 adb_unlink(lpath); in sync_recv_v1()
1105 adb_unlink(lpath); in sync_recv_v1()
1106 sc.ReportCopyFailure(rpath, lpath, msg); in sync_recv_v1()
1112 adb_unlink(lpath); in sync_recv_v1()
1118 adb_unlink(lpath); in sync_recv_v1()
1123 sc.Error("cannot write '%s': %s", lpath, strerror(errno)); in sync_recv_v1()
1124 adb_unlink(lpath); in sync_recv_v1()
1138 static bool sync_recv_v2(SyncConnection& sc, const char* rpath, const char* lpath, const char* name, in sync_recv_v2() argument
1144 adb_unlink(lpath); in sync_recv_v2()
1145 unique_fd lfd(adb_creat(lpath, 0644)); in sync_recv_v2()
1147 sc.Error("cannot create '%s': %s", lpath, strerror(errno)); in sync_recv_v2()
1183 adb_unlink(lpath); in sync_recv_v2()
1193 adb_unlink(lpath); in sync_recv_v2()
1194 sc.ReportCopyFailure(rpath, lpath, msg); in sync_recv_v2()
1199 adb_unlink(lpath); in sync_recv_v2()
1205 adb_unlink(lpath); in sync_recv_v2()
1217 adb_unlink(lpath); in sync_recv_v2()
1223 sc.Error("cannot write '%s': %s", lpath, strerror(errno)); in sync_recv_v2()
1224 adb_unlink(lpath); in sync_recv_v2()
1247 static bool sync_recv(SyncConnection& sc, const char* rpath, const char* lpath, const char* name, in sync_recv() argument
1250 return sync_recv_v2(sc, rpath, lpath, name, expected_size, compression); in sync_recv()
1252 return sync_recv_v1(sc, rpath, lpath, name, expected_size); in sync_recv()
1270 std::vector<std::string>* directory_list, const std::string& lpath, in local_build_list() argument
1273 std::unique_ptr<DIR, int (*)(DIR*)> dir(opendir(lpath.c_str()), closedir); in local_build_list()
1275 sc.Error("cannot open '%s': %s", lpath.c_str(), strerror(errno)); in local_build_list()
1287 std::string stat_path = lpath + de->d_name; in local_build_list()
1296 copyinfo ci(lpath, rpath, de->d_name, st.st_mode); in local_build_list()
1301 sc.Warning("skipping special file '%s' (mode = 0o%o)", lpath.c_str(), st.st_mode); in local_build_list()
1315 local_build_list(sc, file_list, directory_list, ci.lpath, ci.rpath); in local_build_list()
1331 static bool copy_local_dir_remote(SyncConnection& sc, std::string lpath, std::string rpath, in copy_local_dir_remote() argument
1338 ensure_trailing_separators(lpath, rpath); in copy_local_dir_remote()
1350 if (!local_build_list(sc, &file_list, &directory_list, lpath, rpath)) { in copy_local_dir_remote()
1413 sc.Println("would push: %s -> %s", ci.lpath.c_str(), ci.rpath.c_str()); in copy_local_dir_remote()
1415 if (!sync_send(sc, ci.lpath, ci.rpath, ci.time, ci.mode, false, compression, in copy_local_dir_remote()
1427 sc.ReportTransferRate(lpath, TransferDirection::push); in copy_local_dir_remote()
1530 const std::string& rpath, const std::string& lpath) { in remote_build_list() argument
1535 copyinfo ci(android::base::Dirname(lpath), android::base::Dirname(rpath), in remote_build_list()
1536 android::base::Basename(lpath), S_IFDIR); in remote_build_list()
1545 copyinfo ci(lpath, rpath, name, mode); in remote_build_list()
1584 if (!remote_build_list(sc, file_list, current.rpath, current.lpath)) { in remote_build_list()
1592 static int set_time_and_mode(const std::string& lpath, time_t time, in set_time_and_mode() argument
1595 int r1 = utime(lpath.c_str(), ×); in set_time_and_mode()
1600 int r2 = chmod(lpath.c_str(), mode & ~mask); in set_time_and_mode()
1605 static bool copy_remote_dir_local(SyncConnection& sc, std::string rpath, std::string lpath, in copy_remote_dir_local() argument
1611 ensure_trailing_separators(lpath, rpath); in copy_remote_dir_local()
1616 if (!remote_build_list(sc, &file_list, rpath, lpath)) { in copy_remote_dir_local()
1628 if (!mkdirs(ci.lpath)) { in copy_remote_dir_local()
1630 ci.lpath.c_str(), strerror(errno)); in copy_remote_dir_local()
1636 if (!sync_recv(sc, ci.rpath.c_str(), ci.lpath.c_str(), nullptr, ci.size, compression)) { in copy_remote_dir_local()
1640 if (copy_attrs && set_time_and_mode(ci.lpath, ci.time, ci.mode)) { in copy_remote_dir_local()
1763 bool do_sync_sync(const std::string& lpath, const std::string& rpath, bool list_only, in do_sync_sync() argument
1768 bool success = copy_local_dir_remote(sc, lpath, rpath, true, list_only, compression, dry_run); in do_sync_sync()