From be0e44d0f12e295b1efdda20b92209ca704bd1a9 Mon Sep 17 00:00:00 2001 From: Alessio Balsini Date: Tue, 21 Jan 2020 18:47:21 +0000 Subject: [PATCH] snapshot: helper to get access snapshot_state path /metadata/ota/snapshot_state is a temporary file that keeps track of snapshot merge operations across reboots. Bug: 138817833 Test: m Change-Id: I9785db3f73e1575b8ac8a522d938d09f8948e1b0 Signed-off-by: Alessio Balsini --- fs_mgr/libsnapshot/include/libsnapshot/snapshot.h | 4 ++++ fs_mgr/libsnapshot/snapshot.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h index ed92dd797..a56078a1d 100644 --- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h @@ -395,6 +395,10 @@ class SnapshotManager final { bool WriteSnapshotUpdateStatus(LockedFile* file, const SnapshotUpdateStatus& status); std::string GetStateFilePath() const; + // Interact with /metadata/ota/merge_state. + // This file contains information related to the snapshot merge process. + std::string GetMergeStateFilePath() const; + // Helpers for merging. bool SwitchSnapshotToMerge(LockedFile* lock, const std::string& name); bool RewriteSnapshotDeviceTable(const std::string& dm_name); diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp index ba53615fb..bfa0a1fda 100644 --- a/fs_mgr/libsnapshot/snapshot.cpp +++ b/fs_mgr/libsnapshot/snapshot.cpp @@ -1739,6 +1739,10 @@ std::string SnapshotManager::GetStateFilePath() const { return metadata_dir_ + "/state"s; } +std::string SnapshotManager::GetMergeStateFilePath() const { + return metadata_dir_ + "/merge_state"s; +} + std::string SnapshotManager::GetLockPath() const { return metadata_dir_; }