Loading fs_mgr/libsnapshot/android/snapshot/snapshot.proto +4 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ message SnapshotUpdateStatus { MergePhase merge_phase = 6; } // Next: 4 // Next: 5 message SnapshotMergeReport { // Status of the update after the merge attempts. UpdateState state = 1; Loading @@ -167,4 +167,7 @@ message SnapshotMergeReport { // Total size of all the COW images before the update. uint64 cow_file_size = 3; // Whether compression/dm-user was used for any snapshots. bool compression_enabled = 4; } fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class MockSnapshotManager : public ISnapshotManager { (const std::function<bool()>& callback, const std::function<bool()>& before_cancel), (override)); MOCK_METHOD(UpdateState, GetUpdateState, (double* progress), (override)); MOCK_METHOD(bool, UpdateUsesCompression, (), (override)); MOCK_METHOD(Return, CreateUpdateSnapshots, (const chromeos_update_engine::DeltaArchiveManifest& manifest), (override)); MOCK_METHOD(bool, MapUpdateSnapshot, Loading fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +8 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,10 @@ class ISnapshotManager { // Other: 0 virtual UpdateState GetUpdateState(double* progress = nullptr) = 0; // Returns true if compression is enabled for the current update. This always returns false if // UpdateState is None, or no snapshots have been created. virtual bool UpdateUsesCompression() = 0; // Create necessary COW device / files for OTA clients. New logical partitions will be added to // group "cow" in target_metadata. Regions of partitions of current_metadata will be // "write-protected" and snapshotted. Loading Loading @@ -326,6 +330,7 @@ class SnapshotManager final : public ISnapshotManager { UpdateState ProcessUpdateState(const std::function<bool()>& callback = {}, const std::function<bool()>& before_cancel = {}) override; UpdateState GetUpdateState(double* progress = nullptr) override; bool UpdateUsesCompression() override; Return CreateUpdateSnapshots(const DeltaArchiveManifest& manifest) override; bool MapUpdateSnapshot(const CreateLogicalPartitionParams& params, std::string* snapshot_path) override; Loading Loading @@ -720,6 +725,9 @@ class SnapshotManager final : public ISnapshotManager { SnapuserdClient* snapuserd_client() const { return snapuserd_client_.get(); } // Helper of UpdateUsesCompression bool UpdateUsesCompression(LockedFile* lock); std::string gsid_dir_; std::string metadata_dir_; std::unique_ptr<IDeviceInfo> device_; Loading fs_mgr/libsnapshot/include/libsnapshot/snapshot_stats.h +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ class ISnapshotMergeStats { virtual ~ISnapshotMergeStats() = default; // Called when merge starts or resumes. virtual bool Start() = 0; virtual void set_state(android::snapshot::UpdateState state) = 0; virtual void set_state(android::snapshot::UpdateState state, bool using_compression) = 0; virtual void set_cow_file_size(uint64_t cow_file_size) = 0; virtual uint64_t cow_file_size() = 0; Loading @@ -51,7 +51,7 @@ class SnapshotMergeStats : public ISnapshotMergeStats { // ISnapshotMergeStats overrides bool Start() override; void set_state(android::snapshot::UpdateState state) override; void set_state(android::snapshot::UpdateState state, bool using_compression) override; void set_cow_file_size(uint64_t cow_file_size) override; uint64_t cow_file_size() override; std::unique_ptr<Result> Finish() override; Loading fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class SnapshotManagerStub : public ISnapshotManager { UpdateState ProcessUpdateState(const std::function<bool()>& callback = {}, const std::function<bool()>& before_cancel = {}) override; UpdateState GetUpdateState(double* progress = nullptr) override; bool UpdateUsesCompression() override; Return CreateUpdateSnapshots( const chromeos_update_engine::DeltaArchiveManifest& manifest) override; bool MapUpdateSnapshot(const android::fs_mgr::CreateLogicalPartitionParams& params, Loading Loading
fs_mgr/libsnapshot/android/snapshot/snapshot.proto +4 −1 Original line number Diff line number Diff line Loading @@ -156,7 +156,7 @@ message SnapshotUpdateStatus { MergePhase merge_phase = 6; } // Next: 4 // Next: 5 message SnapshotMergeReport { // Status of the update after the merge attempts. UpdateState state = 1; Loading @@ -167,4 +167,7 @@ message SnapshotMergeReport { // Total size of all the COW images before the update. uint64 cow_file_size = 3; // Whether compression/dm-user was used for any snapshots. bool compression_enabled = 4; }
fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class MockSnapshotManager : public ISnapshotManager { (const std::function<bool()>& callback, const std::function<bool()>& before_cancel), (override)); MOCK_METHOD(UpdateState, GetUpdateState, (double* progress), (override)); MOCK_METHOD(bool, UpdateUsesCompression, (), (override)); MOCK_METHOD(Return, CreateUpdateSnapshots, (const chromeos_update_engine::DeltaArchiveManifest& manifest), (override)); MOCK_METHOD(bool, MapUpdateSnapshot, Loading
fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +8 −0 Original line number Diff line number Diff line Loading @@ -170,6 +170,10 @@ class ISnapshotManager { // Other: 0 virtual UpdateState GetUpdateState(double* progress = nullptr) = 0; // Returns true if compression is enabled for the current update. This always returns false if // UpdateState is None, or no snapshots have been created. virtual bool UpdateUsesCompression() = 0; // Create necessary COW device / files for OTA clients. New logical partitions will be added to // group "cow" in target_metadata. Regions of partitions of current_metadata will be // "write-protected" and snapshotted. Loading Loading @@ -326,6 +330,7 @@ class SnapshotManager final : public ISnapshotManager { UpdateState ProcessUpdateState(const std::function<bool()>& callback = {}, const std::function<bool()>& before_cancel = {}) override; UpdateState GetUpdateState(double* progress = nullptr) override; bool UpdateUsesCompression() override; Return CreateUpdateSnapshots(const DeltaArchiveManifest& manifest) override; bool MapUpdateSnapshot(const CreateLogicalPartitionParams& params, std::string* snapshot_path) override; Loading Loading @@ -720,6 +725,9 @@ class SnapshotManager final : public ISnapshotManager { SnapuserdClient* snapuserd_client() const { return snapuserd_client_.get(); } // Helper of UpdateUsesCompression bool UpdateUsesCompression(LockedFile* lock); std::string gsid_dir_; std::string metadata_dir_; std::unique_ptr<IDeviceInfo> device_; Loading
fs_mgr/libsnapshot/include/libsnapshot/snapshot_stats.h +2 −2 Original line number Diff line number Diff line Loading @@ -28,7 +28,7 @@ class ISnapshotMergeStats { virtual ~ISnapshotMergeStats() = default; // Called when merge starts or resumes. virtual bool Start() = 0; virtual void set_state(android::snapshot::UpdateState state) = 0; virtual void set_state(android::snapshot::UpdateState state, bool using_compression) = 0; virtual void set_cow_file_size(uint64_t cow_file_size) = 0; virtual uint64_t cow_file_size() = 0; Loading @@ -51,7 +51,7 @@ class SnapshotMergeStats : public ISnapshotMergeStats { // ISnapshotMergeStats overrides bool Start() override; void set_state(android::snapshot::UpdateState state) override; void set_state(android::snapshot::UpdateState state, bool using_compression) override; void set_cow_file_size(uint64_t cow_file_size) override; uint64_t cow_file_size() override; std::unique_ptr<Result> Finish() override; Loading
fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h +1 −0 Original line number Diff line number Diff line Loading @@ -32,6 +32,7 @@ class SnapshotManagerStub : public ISnapshotManager { UpdateState ProcessUpdateState(const std::function<bool()>& callback = {}, const std::function<bool()>& before_cancel = {}) override; UpdateState GetUpdateState(double* progress = nullptr) override; bool UpdateUsesCompression() override; Return CreateUpdateSnapshots( const chromeos_update_engine::DeltaArchiveManifest& manifest) override; bool MapUpdateSnapshot(const android::fs_mgr::CreateLogicalPartitionParams& params, Loading