Loading fs_mgr/libsnapshot/cow_writer.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,12 @@ bool ICowWriter::AddRawBlocks(uint64_t new_block_start, const void* data, size_t return EmitRawBlocks(new_block_start, data, size); } bool AddXorBlocks(uint32_t /*new_block_start*/, const void* /*data*/, size_t /*size*/, uint32_t /*old_block*/, uint16_t /*offset*/) { LOG(ERROR) << "AddXorBlocks not yet implemented"; return false; } bool ICowWriter::AddZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) { uint64_t last_block = new_block_start + num_blocks - 1; if (!ValidateNewBlock(last_block)) { Loading @@ -70,6 +76,11 @@ bool ICowWriter::AddLabel(uint64_t label) { return EmitLabel(label); } bool AddSequenceData(size_t /*num_ops*/, const uint32_t* /*data*/) { LOG(ERROR) << "AddSequenceData not yet implemented"; return false; } bool ICowWriter::ValidateNewBlock(uint64_t new_block) { if (options_.max_blocks && new_block >= options_.max_blocks.value()) { LOG(ERROR) << "New block " << new_block << " exceeds maximum block count " Loading fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h +7 −0 Original line number Diff line number Diff line Loading @@ -55,12 +55,19 @@ class ICowWriter { // Encode a sequence of raw blocks. |size| must be a multiple of the block size. bool AddRawBlocks(uint64_t new_block_start, const void* data, size_t size); // Add a sequence of xor'd blocks. |size| must be a multiple of the block size. bool AddXorBlocks(uint32_t new_block_start, const void* data, size_t size, uint32_t old_block, uint16_t offset); // Encode a sequence of zeroed blocks. |size| must be a multiple of the block size. bool AddZeroBlocks(uint64_t new_block_start, uint64_t num_blocks); // Add a label to the op sequence. bool AddLabel(uint64_t label); // Add sequence data for op merging. Data is a list of the destination block numbers. bool AddSequenceData(size_t num_ops, const uint32_t* data); // 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; Loading Loading
fs_mgr/libsnapshot/cow_writer.cpp +11 −0 Original line number Diff line number Diff line Loading @@ -58,6 +58,12 @@ bool ICowWriter::AddRawBlocks(uint64_t new_block_start, const void* data, size_t return EmitRawBlocks(new_block_start, data, size); } bool AddXorBlocks(uint32_t /*new_block_start*/, const void* /*data*/, size_t /*size*/, uint32_t /*old_block*/, uint16_t /*offset*/) { LOG(ERROR) << "AddXorBlocks not yet implemented"; return false; } bool ICowWriter::AddZeroBlocks(uint64_t new_block_start, uint64_t num_blocks) { uint64_t last_block = new_block_start + num_blocks - 1; if (!ValidateNewBlock(last_block)) { Loading @@ -70,6 +76,11 @@ bool ICowWriter::AddLabel(uint64_t label) { return EmitLabel(label); } bool AddSequenceData(size_t /*num_ops*/, const uint32_t* /*data*/) { LOG(ERROR) << "AddSequenceData not yet implemented"; return false; } bool ICowWriter::ValidateNewBlock(uint64_t new_block) { if (options_.max_blocks && new_block >= options_.max_blocks.value()) { LOG(ERROR) << "New block " << new_block << " exceeds maximum block count " Loading
fs_mgr/libsnapshot/include/libsnapshot/cow_writer.h +7 −0 Original line number Diff line number Diff line Loading @@ -55,12 +55,19 @@ class ICowWriter { // Encode a sequence of raw blocks. |size| must be a multiple of the block size. bool AddRawBlocks(uint64_t new_block_start, const void* data, size_t size); // Add a sequence of xor'd blocks. |size| must be a multiple of the block size. bool AddXorBlocks(uint32_t new_block_start, const void* data, size_t size, uint32_t old_block, uint16_t offset); // Encode a sequence of zeroed blocks. |size| must be a multiple of the block size. bool AddZeroBlocks(uint64_t new_block_start, uint64_t num_blocks); // Add a label to the op sequence. bool AddLabel(uint64_t label); // Add sequence data for op merging. Data is a list of the destination block numbers. bool AddSequenceData(size_t num_ops, const uint32_t* data); // 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; Loading