summaryrefslogtreecommitdiffstats
path: root/applypatch
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-04-26 03:59:40 +0200
committerTao Bao <tbao@google.com>2018-04-26 06:46:00 +0200
commit641fa97def3e6ef52471e47ad25d0658ef4d943e (patch)
treef26b3a858f289f5806b92daf0e776c082a246b8a /applypatch
parentMerge "updater_sample: Use stubs libs for android.test.base / runner." (diff)
downloadandroid_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.tar
android_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.tar.gz
android_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.tar.bz2
android_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.tar.lz
android_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.tar.xz
android_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.tar.zst
android_bootable_recovery-641fa97def3e6ef52471e47ad25d0658ef4d943e.zip
Diffstat (limited to 'applypatch')
-rw-r--r--applypatch/applypatch.cpp10
-rw-r--r--applypatch/freecache.cpp8
2 files changed, 9 insertions, 9 deletions
diff --git a/applypatch/applypatch.cpp b/applypatch/applypatch.cpp
index db7530be9..39b8030d9 100644
--- a/applypatch/applypatch.cpp
+++ b/applypatch/applypatch.cpp
@@ -40,7 +40,7 @@
#include "edify/expr.h"
#include "otafault/ota_io.h"
-#include "otautil/cache_location.h"
+#include "otautil/paths.h"
#include "otautil/print_sha1.h"
static int LoadPartitionContents(const std::string& filename, FileContents* file);
@@ -403,7 +403,7 @@ int applypatch_check(const char* filename, const std::vector<std::string>& patch
// If the source file is missing or corrupted, it might be because we were killed in the middle
// of patching it. A copy of it should have been made in cache_temp_source. If that file
// exists and matches the sha1 we're looking for, the check still passes.
- if (LoadFileContents(CacheLocation::location().cache_temp_source().c_str(), &file) != 0) {
+ if (LoadFileContents(Paths::Get().cache_temp_source().c_str(), &file) != 0) {
printf("failed to load cache file\n");
return 1;
}
@@ -525,7 +525,7 @@ int applypatch(const char* source_filename, const char* target_filename,
printf("source file is bad; trying copy\n");
FileContents copy_file;
- if (LoadFileContents(CacheLocation::location().cache_temp_source().c_str(), &copy_file) < 0) {
+ if (LoadFileContents(Paths::Get().cache_temp_source().c_str(), &copy_file) < 0) {
printf("failed to read copy file\n");
return 1;
}
@@ -620,7 +620,7 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
printf("not enough free space on /cache\n");
return 1;
}
- if (SaveFileContents(CacheLocation::location().cache_temp_source().c_str(), &source_file) < 0) {
+ if (SaveFileContents(Paths::Get().cache_temp_source().c_str(), &source_file) < 0) {
printf("failed to back up source file\n");
return 1;
}
@@ -685,7 +685,7 @@ static int GenerateTarget(const FileContents& source_file, const std::unique_ptr
}
// Delete the backup copy of the source.
- unlink(CacheLocation::location().cache_temp_source().c_str());
+ unlink(Paths::Get().cache_temp_source().c_str());
// Success!
return 0;
diff --git a/applypatch/freecache.cpp b/applypatch/freecache.cpp
index cfab0f6db..dbd4b72b1 100644
--- a/applypatch/freecache.cpp
+++ b/applypatch/freecache.cpp
@@ -38,7 +38,7 @@
#include <android-base/strings.h>
#include "applypatch/applypatch.h"
-#include "otautil/cache_location.h"
+#include "otautil/paths.h"
static int EliminateOpenFiles(const std::string& dirname, std::set<std::string>* files) {
std::unique_ptr<DIR, decltype(&closedir)> d(opendir("/proc"), closedir);
@@ -95,7 +95,7 @@ static std::vector<std::string> FindExpendableFiles(
// We can't delete cache_temp_source; if it's there we might have restarted during
// installation and could be depending on it to be there.
- if (path == CacheLocation::location().cache_temp_source()) {
+ if (path == Paths::Get().cache_temp_source()) {
continue;
}
@@ -142,7 +142,7 @@ int MakeFreeSpaceOnCache(size_t bytes_needed) {
return 0;
#endif
- std::vector<std::string> dirs = { "/cache", CacheLocation::location().cache_log_directory() };
+ std::vector<std::string> dirs = { "/cache", Paths::Get().cache_log_directory() };
for (const auto& dirname : dirs) {
if (RemoveFilesInDirectory(bytes_needed, dirname, FreeSpaceForFile)) {
return 0;
@@ -172,7 +172,7 @@ bool RemoveFilesInDirectory(size_t bytes_needed, const std::string& dirname,
}
std::vector<std::string> files;
- if (dirname == CacheLocation::location().cache_log_directory()) {
+ if (dirname == Paths::Get().cache_log_directory()) {
// Deletes the log files only.
auto log_filter = [](const std::string& file_name) {
return android::base::StartsWith(file_name, "last_log") ||