diff --git a/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h index 70e1dc864..eb6ad0537 100644 --- a/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h +++ b/fs_mgr/libsnapshot/include/libsnapshot/mock_snapshot.h @@ -39,11 +39,9 @@ class MockSnapshotManager : public ISnapshotManager { std::string* snapshot_path), (override)); MOCK_METHOD(std::unique_ptr, OpenSnapshotWriter, - (const std::string& partition_name, std::chrono::milliseconds timeout_ms), - (override)); + (const android::fs_mgr::CreateLogicalPartitionParams& params), (override)); MOCK_METHOD(std::unique_ptr, OpenSnapshotReader, - (const std::string& partition_name, std::chrono::milliseconds timeout_ms), - (override)); + (const android::fs_mgr::CreateLogicalPartitionParams& params), (override)); MOCK_METHOD(bool, UnmapUpdateSnapshot, (const std::string& target_partition_name), (override)); MOCK_METHOD(bool, NeedSnapshotsInFirstStageMount, (), (override)); MOCK_METHOD(bool, CreateLogicalAndSnapshotPartitions, diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h index dacdb1ec1..6fef58a7f 100644 --- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h +++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot.h @@ -187,14 +187,15 @@ class ISnapshotManager { virtual bool MapUpdateSnapshot(const android::fs_mgr::CreateLogicalPartitionParams& params, std::string* snapshot_path) = 0; - // Create an ICowWriter to build a snapshot against a target partition. + // Create an ICowWriter to build a snapshot against a target partition. The partition name must + // be suffixed. virtual std::unique_ptr OpenSnapshotWriter( - const std::string& partition_name, std::chrono::milliseconds timeout_ms = {}) = 0; + const android::fs_mgr::CreateLogicalPartitionParams& params) = 0; // Open a snapshot for reading. A file-like interface is provided through the FileDescriptor. - // In this mode, writes are not supported. + // In this mode, writes are not supported. The partition name must be suffixed. virtual std::unique_ptr OpenSnapshotReader( - const std::string& partition_name, std::chrono::milliseconds timeout_ms = {}) = 0; + const android::fs_mgr::CreateLogicalPartitionParams& params) = 0; // Unmap a snapshot device or CowWriter that was previously opened with MapUpdateSnapshot, // OpenSnapshotWriter, or OpenSnapshotReader. All outstanding open descriptors, writers, @@ -310,9 +311,9 @@ class SnapshotManager final : public ISnapshotManager { bool MapUpdateSnapshot(const CreateLogicalPartitionParams& params, std::string* snapshot_path) override; std::unique_ptr OpenSnapshotWriter( - const std::string& partition_name, std::chrono::milliseconds timeout_ms = {}) override; + const android::fs_mgr::CreateLogicalPartitionParams& params) override; std::unique_ptr OpenSnapshotReader( - const std::string& partition_name, std::chrono::milliseconds timeout_ms = {}) override; + const android::fs_mgr::CreateLogicalPartitionParams& params) override; bool UnmapUpdateSnapshot(const std::string& target_partition_name) override; bool NeedSnapshotsInFirstStageMount() override; bool CreateLogicalAndSnapshotPartitions( diff --git a/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h index f70cc921a..149f463a9 100644 --- a/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h +++ b/fs_mgr/libsnapshot/include/libsnapshot/snapshot_stub.h @@ -36,10 +36,10 @@ class SnapshotManagerStub : public ISnapshotManager { const chromeos_update_engine::DeltaArchiveManifest& manifest) override; bool MapUpdateSnapshot(const android::fs_mgr::CreateLogicalPartitionParams& params, std::string* snapshot_path) override; - std::unique_ptr OpenSnapshotWriter(const std::string& partition_name, - std::chrono::milliseconds timeout_ms) override; + std::unique_ptr OpenSnapshotWriter( + const android::fs_mgr::CreateLogicalPartitionParams& params) override; std::unique_ptr OpenSnapshotReader( - const std::string& partition_name, std::chrono::milliseconds timeout_ms = {}) override; + const android::fs_mgr::CreateLogicalPartitionParams& params) override; bool UnmapUpdateSnapshot(const std::string& target_partition_name) override; bool NeedSnapshotsInFirstStageMount() override; bool CreateLogicalAndSnapshotPartitions( diff --git a/fs_mgr/libsnapshot/snapshot.cpp b/fs_mgr/libsnapshot/snapshot.cpp index a74f984ab..0904fc76b 100644 --- a/fs_mgr/libsnapshot/snapshot.cpp +++ b/fs_mgr/libsnapshot/snapshot.cpp @@ -2442,25 +2442,18 @@ bool SnapshotManager::MapUpdateSnapshot(const CreateLogicalPartitionParams& para } std::unique_ptr SnapshotManager::OpenSnapshotWriter( - const std::string& partition_name, std::chrono::milliseconds timeout_ms) { - if (!IsCompressionEnabled()) { - LOG(ERROR) << "OpenSnapshotWriter can only be called in compression mode."; - return nullptr; - } + const android::fs_mgr::CreateLogicalPartitionParams& params) { + (void)params; - (void)partition_name; - (void)timeout_ms; - - // Not yet implemented. + LOG(ERROR) << "OpenSnapshotWriter not yet implemented"; return nullptr; } std::unique_ptr SnapshotManager::OpenSnapshotReader( - const std::string& partition_name, std::chrono::milliseconds timeout_ms) { - (void)partition_name; - (void)timeout_ms; + const android::fs_mgr::CreateLogicalPartitionParams& params) { + (void)params; - // Not yet implemented. + LOG(ERROR) << "OpenSnapshotReader not yet implemented"; return nullptr; } diff --git a/fs_mgr/libsnapshot/snapshot_stub.cpp b/fs_mgr/libsnapshot/snapshot_stub.cpp index 269dd09fc..8ae63054f 100644 --- a/fs_mgr/libsnapshot/snapshot_stub.cpp +++ b/fs_mgr/libsnapshot/snapshot_stub.cpp @@ -130,14 +130,14 @@ ISnapshotMergeStats* SnapshotManagerStub::GetSnapshotMergeStatsInstance() { return &snapshot_merge_stats; } -std::unique_ptr SnapshotManagerStub::OpenSnapshotWriter(const std::string&, - std::chrono::milliseconds) { +std::unique_ptr SnapshotManagerStub::OpenSnapshotWriter( + const CreateLogicalPartitionParams&) { LOG(ERROR) << __FUNCTION__ << " should never be called."; return nullptr; } -std::unique_ptr SnapshotManagerStub::OpenSnapshotReader(const std::string&, - std::chrono::milliseconds) { +std::unique_ptr SnapshotManagerStub::OpenSnapshotReader( + const CreateLogicalPartitionParams&) { LOG(ERROR) << __FUNCTION__ << " should never be called."; return nullptr; }