Loading fs_mgr/libsnapshot/cow_api_test.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ TEST_F(CowTest, ReadWrite) { ASSERT_TRUE(writer.AddCopy(10, 20)); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.AddZeroBlocks(51, 2)); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -145,7 +145,7 @@ TEST_F(CowTest, CompressGz) { data.resize(options.block_size, '\0'); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -182,7 +182,7 @@ TEST_F(CowTest, CompressTwoBlocks) { data.resize(options.block_size * 2, '\0'); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -224,7 +224,7 @@ TEST_P(CompressionTest, HorribleSink) { data.resize(options.block_size, '\0'); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -259,7 +259,7 @@ TEST_F(CowTest, GetSize) { ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.AddZeroBlocks(51, 2)); auto size_before = writer.GetCowSize(); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); auto size_after = writer.GetCowSize(); ASSERT_EQ(size_before, size_after); struct stat buf; Loading @@ -279,7 +279,7 @@ TEST_F(CowTest, Append) { std::string data = "This is some data, believe it"; data.resize(options.block_size, '\0'); ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer->Finalize()); ASSERT_TRUE(writer->Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading @@ -289,7 +289,7 @@ TEST_F(CowTest, Append) { std::string data2 = "More data!"; data2.resize(options.block_size, '\0'); ASSERT_TRUE(writer->AddRawBlocks(51, data2.data(), data2.size())); ASSERT_TRUE(writer->Finalize()); ASSERT_TRUE(writer->Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading fs_mgr/libsnapshot/cow_snapuserd_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ void SnapuserdTest::CreateCowDevice(std::unique_ptr<TemporaryFile>& cow) { ASSERT_TRUE(writer.AddRawBlocks(blk_random2_replace_start, random_buffer_2_.get(), size_)); // Flush operations ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow->fd, 0, SEEK_SET), 0); } Loading fs_mgr/libsnapshot/cow_writer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ static void SHA256(const void*, size_t, uint8_t[]) { #endif } bool CowWriter::Finalize() { bool CowWriter::Flush() { header_.ops_size = ops_.size(); memset(header_.ops_checksum, 0, sizeof(uint8_t) * 32); Loading fs_mgr/libsnapshot/estimate_cow_from_nonab_ota.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ bool NonAbEstimator::AnalyzePartition(const std::string& partition_name) { } } if (!writer->Finalize()) { if (!writer->Flush()) { return false; } Loading fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h +2 −2 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class ICowWriter { // Flush all pending writes. This must be called before closing the writer // to ensure that the correct headers and footers are written. virtual bool Finalize() = 0; virtual bool Flush() = 0; // Return number of bytes the cow image occupies on disk. virtual uint64_t GetCowSize() = 0; Loading Loading @@ -84,7 +84,7 @@ class CowWriter : public ICowWriter { bool Initialize(android::base::unique_fd&& fd, OpenMode mode = OpenMode::WRITE); bool Initialize(android::base::borrowed_fd fd, OpenMode mode = OpenMode::WRITE); bool Finalize() override; bool Flush() override; uint64_t GetCowSize() override; Loading Loading
fs_mgr/libsnapshot/cow_api_test.cpp +7 −7 Original line number Diff line number Diff line Loading @@ -70,7 +70,7 @@ TEST_F(CowTest, ReadWrite) { ASSERT_TRUE(writer.AddCopy(10, 20)); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.AddZeroBlocks(51, 2)); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -145,7 +145,7 @@ TEST_F(CowTest, CompressGz) { data.resize(options.block_size, '\0'); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -182,7 +182,7 @@ TEST_F(CowTest, CompressTwoBlocks) { data.resize(options.block_size * 2, '\0'); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -224,7 +224,7 @@ TEST_P(CompressionTest, HorribleSink) { data.resize(options.block_size, '\0'); ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading Loading @@ -259,7 +259,7 @@ TEST_F(CowTest, GetSize) { ASSERT_TRUE(writer.AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer.AddZeroBlocks(51, 2)); auto size_before = writer.GetCowSize(); ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); auto size_after = writer.GetCowSize(); ASSERT_EQ(size_before, size_after); struct stat buf; Loading @@ -279,7 +279,7 @@ TEST_F(CowTest, Append) { std::string data = "This is some data, believe it"; data.resize(options.block_size, '\0'); ASSERT_TRUE(writer->AddRawBlocks(50, data.data(), data.size())); ASSERT_TRUE(writer->Finalize()); ASSERT_TRUE(writer->Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading @@ -289,7 +289,7 @@ TEST_F(CowTest, Append) { std::string data2 = "More data!"; data2.resize(options.block_size, '\0'); ASSERT_TRUE(writer->AddRawBlocks(51, data2.data(), data2.size())); ASSERT_TRUE(writer->Finalize()); ASSERT_TRUE(writer->Flush()); ASSERT_EQ(lseek(cow_->fd, 0, SEEK_SET), 0); Loading
fs_mgr/libsnapshot/cow_snapuserd_test.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -227,7 +227,7 @@ void SnapuserdTest::CreateCowDevice(std::unique_ptr<TemporaryFile>& cow) { ASSERT_TRUE(writer.AddRawBlocks(blk_random2_replace_start, random_buffer_2_.get(), size_)); // Flush operations ASSERT_TRUE(writer.Finalize()); ASSERT_TRUE(writer.Flush()); ASSERT_EQ(lseek(cow->fd, 0, SEEK_SET), 0); } Loading
fs_mgr/libsnapshot/cow_writer.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -293,7 +293,7 @@ static void SHA256(const void*, size_t, uint8_t[]) { #endif } bool CowWriter::Finalize() { bool CowWriter::Flush() { header_.ops_size = ops_.size(); memset(header_.ops_checksum, 0, sizeof(uint8_t) * 32); Loading
fs_mgr/libsnapshot/estimate_cow_from_nonab_ota.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -375,7 +375,7 @@ bool NonAbEstimator::AnalyzePartition(const std::string& partition_name) { } } if (!writer->Finalize()) { if (!writer->Flush()) { return false; } Loading
fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h +2 −2 Original line number Diff line number Diff line Loading @@ -53,7 +53,7 @@ class ICowWriter { // Flush all pending writes. This must be called before closing the writer // to ensure that the correct headers and footers are written. virtual bool Finalize() = 0; virtual bool Flush() = 0; // Return number of bytes the cow image occupies on disk. virtual uint64_t GetCowSize() = 0; Loading Loading @@ -84,7 +84,7 @@ class CowWriter : public ICowWriter { bool Initialize(android::base::unique_fd&& fd, OpenMode mode = OpenMode::WRITE); bool Initialize(android::base::borrowed_fd fd, OpenMode mode = OpenMode::WRITE); bool Finalize() override; bool Flush() override; uint64_t GetCowSize() override; Loading