diff options
author | Tao Bao <tbao@google.com> | 2018-07-13 21:48:45 +0200 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-07-13 21:48:45 +0200 |
commit | 603b7ed470e98843cd97c31e50e149518616fde0 (patch) | |
tree | 81909b18c39e8fa0e37f18d887a0482cef39c50a /applypatch/freecache.cpp | |
parent | Merge "tests: Clean up the temporary dirs post-run." (diff) | |
parent | Merge "applypatch: Consolidate CacheSizeCheck() and MakeFreeSpaceOnCache()." (diff) | |
download | android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.tar android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.tar.gz android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.tar.bz2 android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.tar.lz android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.tar.xz android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.tar.zst android_bootable_recovery-603b7ed470e98843cd97c31e50e149518616fde0.zip |
Diffstat (limited to 'applypatch/freecache.cpp')
-rw-r--r-- | applypatch/freecache.cpp | 12 |
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, |