Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 30dc8fab authored by Daniel Zheng's avatar Daniel Zheng Committed by Automerger Merge Worker
Browse files

Merge "Add CowOperationV2" into main am: a10bfe1d am: 445d13f7 am:...

Merge "Add CowOperationV2" into main am: a10bfe1d am: 445d13f7 am: 3820d877 am: 16dfc062 am: c22a2ba0

Original change: https://android-review.googlesource.com/c/platform/system/core/+/2736100



Change-Id: I1731712b31f2f70860b2a8bdd9659648516b67df
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents f3149b02 c22a2ba0
Loading
Loading
Loading
Loading
+36 −0
Original line number Diff line number Diff line
@@ -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;
+0 −1
Original line number Diff line number Diff line
@@ -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);