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

Commit 5b5a98fb authored by Daniel Zheng's avatar Daniel Zheng Committed by Automerger Merge Worker
Browse files

Merge changes Ibe310d58,If88dceda into main am: dd3d34ff am: 4ff08008 am:...

Merge changes Ibe310d58,If88dceda into main am: dd3d34ff am: 4ff08008 am: 55d95f02 am: e8060852

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



Change-Id: I4b52cd1f2cf4165dd2c815a4946a15ada1b06f49
Signed-off-by: default avatarAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>
parents ce651280 e8060852
Loading
Loading
Loading
Loading
+12 −0
Original line number Original line Diff line number Diff line
@@ -91,6 +91,18 @@ struct CowHeader {


    // Scratch space used during merge
    // Scratch space used during merge
    uint32_t buffer_size;
    uint32_t buffer_size;

} __attribute__((packed));

struct CowHeaderV3 : public CowHeader {
    // Location of sequence buffer in COW.
    uint64_t sequence_buffer_offset;
    // Size, in bytes, of the CowResumePoint buffer.
    uint32_t resume_buffer_size;
    // Size, in bytes, of the CowOperation buffer.
    uint32_t op_buffer_size;
    // Compression Algorithm
    uint32_t compression_algorithm;
} __attribute__((packed));
} __attribute__((packed));


// This structure is the same size of a normal Operation, but is repurposed for the footer.
// This structure is the same size of a normal Operation, but is repurposed for the footer.
+0 −1
Original line number Original line Diff line number Diff line
@@ -63,7 +63,6 @@ class CowWriterBase : public ICowWriter {
    bool ValidateNewBlock(uint64_t new_block);
    bool ValidateNewBlock(uint64_t new_block);


    CowOptions options_;
    CowOptions options_;
    CowHeader header_{};


    android::base::unique_fd fd_;
    android::base::unique_fd fd_;
    bool is_dev_null_ = false;
    bool is_dev_null_ = false;
+2 −2
Original line number Original line Diff line number Diff line
@@ -243,7 +243,7 @@ bool CowWriterV2::OpenForWrite() {


    // Headers are not complete, but this ensures the file is at the right
    // Headers are not complete, but this ensures the file is at the right
    // position.
    // position.
    if (!android::base::WriteFully(fd_, &header_, sizeof(header_))) {
    if (!android::base::WriteFully(fd_, &header_, sizeof(CowHeader))) {
        PLOG(ERROR) << "write failed";
        PLOG(ERROR) << "write failed";
        return false;
        return false;
    }
    }
@@ -262,7 +262,7 @@ bool CowWriterV2::OpenForWrite() {
        return false;
        return false;
    }
    }


    if (lseek(fd_.get(), sizeof(header_) + header_.buffer_size, SEEK_SET) < 0) {
    if (lseek(fd_.get(), sizeof(CowHeader) + header_.buffer_size, SEEK_SET) < 0) {
        PLOG(ERROR) << "lseek failed";
        PLOG(ERROR) << "lseek failed";
        return false;
        return false;
    }
    }
+1 −0
Original line number Original line Diff line number Diff line
@@ -63,6 +63,7 @@ class CowWriterV2 : public CowWriterBase {


  private:
  private:
    CowFooter footer_{};
    CowFooter footer_{};
    CowHeader header_{};
    CowCompression compression_;
    CowCompression compression_;
    // in the case that we are using one thread for compression, we can store and re-use the same
    // in the case that we are using one thread for compression, we can store and re-use the same
    // compressor
    // compressor