Merge "Add CowOperationV2" into main
This commit is contained in:
commit
a10bfe1d13
2 changed files with 36 additions and 1 deletions
|
@ -143,6 +143,42 @@ struct CowOperation {
|
|||
uint64_t source;
|
||||
} __attribute__((packed));
|
||||
|
||||
// The on disk format of cow (currently == CowOperation)
|
||||
struct CowOperationV2 {
|
||||
// The operation code (see the constants and structures below).
|
||||
uint8_t type;
|
||||
|
||||
// If this operation reads from the data section of the COW, this contains
|
||||
// the compression type of that data (see constants below).
|
||||
uint8_t compression;
|
||||
|
||||
// If this operation reads from the data section of the COW, this contains
|
||||
// the length.
|
||||
uint16_t data_length;
|
||||
|
||||
// The block of data in the new image that this operation modifies.
|
||||
uint64_t new_block;
|
||||
|
||||
// The value of |source| depends on the operation code.
|
||||
//
|
||||
// For copy operations, this is a block location in the source image.
|
||||
//
|
||||
// For replace operations, this is a byte offset within the COW's data
|
||||
// sections (eg, not landing within the header or metadata). It is an
|
||||
// absolute position within the image.
|
||||
//
|
||||
// For zero operations (replace with all zeroes), this is unused and must
|
||||
// be zero.
|
||||
//
|
||||
// For Label operations, this is the value of the applied label.
|
||||
//
|
||||
// For Cluster operations, this is the length of the following data region
|
||||
//
|
||||
// For Xor operations, this is the byte location in the source image.
|
||||
uint64_t source;
|
||||
} __attribute__((packed));
|
||||
|
||||
static_assert(sizeof(CowOperationV2) == sizeof(CowOperation));
|
||||
static_assert(sizeof(CowOperation) == sizeof(CowFooterOperation));
|
||||
|
||||
static constexpr uint8_t kCowCopyOp = 1;
|
||||
|
|
|
@ -165,7 +165,6 @@ class CowReader final : public ICowReader {
|
|||
void UpdateMergeOpsCompleted(int num_merge_ops) { header_.num_merge_ops += num_merge_ops; }
|
||||
|
||||
private:
|
||||
bool ParseOps(std::optional<uint64_t> label);
|
||||
bool PrepMergeOps();
|
||||
uint64_t FindNumCopyops();
|
||||
uint8_t GetCompressionType(const CowOperation* op);
|
||||
|
|
Loading…
Reference in a new issue