Loading fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <chrono> #include <map> #include <memory> #include <ostream> #include <string> #include <string_view> #include <vector> Loading Loading @@ -84,6 +85,7 @@ enum class UpdateState : unsigned int { // operation via fastboot. This state can only be returned by WaitForMerge. Cancelled }; std::ostream& operator<<(std::ostream& os, UpdateState state); class SnapshotManager final { using CreateLogicalPartitionParams = android::fs_mgr::CreateLogicalPartitionParams; Loading fs_mgr/libsnapshot/snapshot.cpp +16 −17 Original line number Diff line number Diff line Loading @@ -1526,34 +1526,33 @@ UpdateState SnapshotManager::ReadUpdateState(LockedFile* file) { } } bool SnapshotManager::WriteUpdateState(LockedFile* file, UpdateState state) { std::string contents; std::ostream& operator<<(std::ostream& os, UpdateState state) { switch (state) { case UpdateState::None: contents = "none"; break; return os << "none"; case UpdateState::Initiated: contents = "initiated"; break; return os << "initiated"; case UpdateState::Unverified: contents = "unverified"; break; return os << "unverified"; case UpdateState::Merging: contents = "merging"; break; return os << "merging"; case UpdateState::MergeCompleted: contents = "merge-completed"; break; return os << "merge-completed"; case UpdateState::MergeNeedsReboot: contents = "merge-needs-reboot"; break; return os << "merge-needs-reboot"; case UpdateState::MergeFailed: contents = "merge-failed"; break; return os << "merge-failed"; default: LOG(ERROR) << "Unknown update state"; return false; return os; } } bool SnapshotManager::WriteUpdateState(LockedFile* file, UpdateState state) { std::stringstream ss; ss << state; std::string contents = ss.str(); if (contents.empty()) return false; if (!Truncate(file)) return false; if (!android::base::WriteStringToFd(contents, file->fd())) { Loading Loading
fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +2 −0 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <chrono> #include <map> #include <memory> #include <ostream> #include <string> #include <string_view> #include <vector> Loading Loading @@ -84,6 +85,7 @@ enum class UpdateState : unsigned int { // operation via fastboot. This state can only be returned by WaitForMerge. Cancelled }; std::ostream& operator<<(std::ostream& os, UpdateState state); class SnapshotManager final { using CreateLogicalPartitionParams = android::fs_mgr::CreateLogicalPartitionParams; Loading
fs_mgr/libsnapshot/snapshot.cpp +16 −17 Original line number Diff line number Diff line Loading @@ -1526,34 +1526,33 @@ UpdateState SnapshotManager::ReadUpdateState(LockedFile* file) { } } bool SnapshotManager::WriteUpdateState(LockedFile* file, UpdateState state) { std::string contents; std::ostream& operator<<(std::ostream& os, UpdateState state) { switch (state) { case UpdateState::None: contents = "none"; break; return os << "none"; case UpdateState::Initiated: contents = "initiated"; break; return os << "initiated"; case UpdateState::Unverified: contents = "unverified"; break; return os << "unverified"; case UpdateState::Merging: contents = "merging"; break; return os << "merging"; case UpdateState::MergeCompleted: contents = "merge-completed"; break; return os << "merge-completed"; case UpdateState::MergeNeedsReboot: contents = "merge-needs-reboot"; break; return os << "merge-needs-reboot"; case UpdateState::MergeFailed: contents = "merge-failed"; break; return os << "merge-failed"; default: LOG(ERROR) << "Unknown update state"; return false; return os; } } bool SnapshotManager::WriteUpdateState(LockedFile* file, UpdateState state) { std::stringstream ss; ss << state; std::string contents = ss.str(); if (contents.empty()) return false; if (!Truncate(file)) return false; if (!android::base::WriteStringToFd(contents, file->fd())) { Loading