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/hardware_interface.h b/hardware_interface.h
index 7dc4e53..df8f227 100644
--- a/hardware_interface.h
+++ b/hardware_interface.h
@@ -20,6 +20,7 @@
#include <string>
#include <vector>
+#include <base/files/file_path.h>
#include <base/time/time.h>
namespace chromeos_update_engine {
@@ -60,6 +61,16 @@
// or is invalid, returns -1. Brand new machines out of the factory or after
// recovery don't have this value set.
virtual int GetPowerwashCount() const = 0;
+
+ // Store in |path| the path to a non-volatile directory (persisted across
+ // reboots) available for this daemon. In case of an error, such as no
+ // directory available, returns false.
+ virtual bool GetNonVolatileDirectory(base::FilePath* path) const = 0;
+
+ // Store in |path| the path to a non-volatile directory persisted across
+ // powerwash cycles. In case of an error, such as no directory available,
+ // returns false.
+ virtual bool GetPowerwashSafeDirectory(base::FilePath* path) const = 0;
};
} // namespace chromeos_update_engine