Make non-volatile directory platform-specific.
update_engine daemon needs to persist files (such as the progress of
the update) in a non-volatile storage and also used to store a
marker file on a volatile storage to detect when update_engine is
restarted, likelly due to a crash.
This patch moves the non-volatile directory configuration to the
Hardware interface, making it platform-specific. It also replaces the
system rebooted detection using the boot_id provided by the kernel
instead of storing a file under /tmp. This implementation works both
on Chrome OS and Android.
Bug: 24074252
Test: FEATURES=test emerge-link update_engine; `mma`; deployed and tested manually on brillo.
Change-Id: I921d767982adebfd04eb12e08d8a157d9102d1e3
diff --git a/real_system_state.h b/real_system_state.h
index 5797d18..fd2a684 100644
--- a/real_system_state.h
+++ b/real_system_state.h
@@ -77,11 +77,11 @@
return &metrics_lib_;
}
- inline PrefsInterface* prefs() override { return &prefs_; }
+ inline PrefsInterface* prefs() override { return prefs_.get(); }
inline PrefsInterface* powerwash_safe_prefs() override {
- return &powerwash_safe_prefs_;
- }
+ return powerwash_safe_prefs_.get();
+ }
inline PayloadStateInterface* payload_state() override {
return &payload_state_;
@@ -136,10 +136,10 @@
MetricsLibrary metrics_lib_;
// Interface for persisted store.
- Prefs prefs_;
+ std::unique_ptr<PrefsInterface> prefs_;
// Interface for persisted store that persists across powerwashes.
- Prefs powerwash_safe_prefs_;
+ std::unique_ptr<PrefsInterface> powerwash_safe_prefs_;
// All state pertaining to payload state such as response, URL, backoff
// states.