From d5fbcc1ba9f5ff81ca67e80b552ee02d285ef536 Mon Sep 17 00:00:00 2001 From: Tianjie Xu Date: Wed, 11 Apr 2018 14:38:09 -0700 Subject: Remove the old log files if cache space is insufficient for OTA We set the limit of the max stash size to 80% of cache size. But the cache space can still be insufficient for the update if the log files occupy a large chunk of /cache. So remove the old logs for now to make room for the update. Bug: 77528881 Test: unit tests pass Change-Id: Ia8bcb0ace11f8164ad9290bfb360e08e31d282cb --- otautil/include/otautil/cache_location.h | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'otautil/include') diff --git a/otautil/include/otautil/cache_location.h b/otautil/include/otautil/cache_location.h index f2f663816..005395e5f 100644 --- a/otautil/include/otautil/cache_location.h +++ b/otautil/include/otautil/cache_location.h @@ -49,6 +49,13 @@ class CacheLocation { stash_directory_base_ = base; } + std::string cache_log_directory() const { + return cache_log_directory_; + } + void set_cache_log_directory(const std::string& log_dir) { + cache_log_directory_ = log_dir; + } + private: CacheLocation(); DISALLOW_COPY_AND_ASSIGN(CacheLocation); @@ -64,6 +71,9 @@ class CacheLocation { // The base directory to write stashes during update. std::string stash_directory_base_; + + // The location of last_log & last_kmsg. + std::string cache_log_directory_; }; #endif // _OTAUTIL_OTAUTIL_CACHE_LOCATION_H_ -- cgit v1.2.3