summaryrefslogtreecommitdiffstats
path: root/applypatch/freecache.cpp
diff options
context:
space:
mode:
authorTao Bao <tbao@google.com>2018-07-12 00:55:32 +0200
committerTao Bao <tbao@google.com>2018-07-13 18:42:19 +0200
commit5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3 (patch)
treeeeadaddce1095a7f53dbc86941de0a00b5325b8d /applypatch/freecache.cpp
parentMerge "tests: Clean up the temporary dirs post-run." (diff)
downloadandroid_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.tar
android_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.tar.gz
android_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.tar.bz2
android_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.tar.lz
android_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.tar.xz
android_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.tar.zst
android_bootable_recovery-5ee25666cc819e9ebc9b72c7a44c4bc9bab9e4e3.zip
Diffstat (limited to '')
-rw-r--r--applypatch/freecache.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/applypatch/freecache.cpp b/applypatch/freecache.cpp
index 4989b7496..e4878655e 100644
--- a/applypatch/freecache.cpp
+++ b/applypatch/freecache.cpp
@@ -150,22 +150,22 @@ static int64_t FreeSpaceForFile(const std::string& filename) {
return free_space;
}
-int MakeFreeSpaceOnCache(size_t bytes_needed) {
+bool CheckAndFreeSpaceOnCache(size_t bytes) {
#ifndef __ANDROID__
// TODO(xunchang): Implement a heuristic cache size check during host simulation.
- LOG(WARNING) << "Skipped making (" << bytes_needed
+ LOG(WARNING) << "Skipped making (" << bytes
<< ") bytes free space on /cache; program is running on host";
- return 0;
+ return true;
#endif
std::vector<std::string> dirs{ "/cache", Paths::Get().cache_log_directory() };
for (const auto& dirname : dirs) {
- if (RemoveFilesInDirectory(bytes_needed, dirname, FreeSpaceForFile)) {
- return 0;
+ if (RemoveFilesInDirectory(bytes, dirname, FreeSpaceForFile)) {
+ return true;
}
}
- return -1;
+ return false;
}
bool RemoveFilesInDirectory(size_t bytes_needed, const std::string& dirname,