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

Commit 5aa52d91 authored by Tianjie Xu's avatar Tianjie Xu Committed by Yifan Hong
Browse files

Revert "libsnapshot: Partially implement OpenSnapshotWriter."

Revert "Link to libsnapshot_cow everywhere libsnapshot is linked."

Revert submission 1433573-vab-libsnapshot-linkage

Reason for revert: b/169981170, update crash for droidfooders.
Reverted Changes:
Ie75bba98c:Link to libsnapshot_cow where libsnapshot is linke...
Ieedfadc55:libsnapshot: Partially implement OpenSnapshotWrite...
I28a5d4a88:Link to libsnapshot_cow everywhere libsnapshot is ...

Exempt-From-Owner-Approval: Revert to unblock dogfood
Change-Id: I0677df77672aca9fd54d94e009ac0be7c88a1a9d
parent ad583f2a
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -147,7 +147,6 @@ cc_binary {
    static_libs: [
        "libgtest_prod",
        "libhealthhalutils",
        "libsnapshot_cow",
        "libsnapshot_nobinder",
        "update_metadata-protos",
    ],
+0 −4
Original line number Diff line number Diff line
@@ -77,7 +77,6 @@ filegroup {
        "snapshot_stats.cpp",
        "snapshot_stub.cpp",
        "snapshot_metadata_updater.cpp",
        "snapshot_writer.cpp",
        "partition_cow_creator.cpp",
        "return.cpp",
        "utility.cpp",
@@ -216,7 +215,6 @@ cc_defaults {
        "libgmock",
        "liblp",
        "libsnapshot",
        "libsnapshot_cow",
        "libsnapshot_test_helpers",
        "libsparse",
    ],
@@ -251,7 +249,6 @@ cc_binary {
    static_libs: [
        "libfstab",
        "libsnapshot",
        "libsnapshot_cow",
        "update_metadata-protos",
    ],
    shared_libs: [
@@ -315,7 +312,6 @@ cc_defaults {
        "libgmock", // from libsnapshot_test_helpers
        "liblog",
        "liblp",
        "libsnapshot_cow",
        "libsnapshot_test_helpers",
        "libprotobuf-mutator",
    ],
+3 −6
Original line number Diff line number Diff line
@@ -32,9 +32,6 @@ namespace snapshot {

static_assert(sizeof(off_t) == sizeof(uint64_t));

using android::base::borrowed_fd;
using android::base::unique_fd;

bool ICowWriter::AddCopy(uint64_t new_block, uint64_t old_block) {
    if (!ValidateNewBlock(new_block)) {
        return false;
@@ -101,12 +98,12 @@ bool CowWriter::ParseOptions() {
    return true;
}

bool CowWriter::Initialize(unique_fd&& fd, OpenMode mode) {
bool CowWriter::Initialize(android::base::unique_fd&& fd, OpenMode mode) {
    owned_fd_ = std::move(fd);
    return Initialize(borrowed_fd{owned_fd_}, mode);
    return Initialize(android::base::borrowed_fd{owned_fd_}, mode);
}

bool CowWriter::Initialize(borrowed_fd fd, OpenMode mode) {
bool CowWriter::Initialize(android::base::borrowed_fd fd, OpenMode mode) {
    fd_ = fd;

    if (!ParseOptions()) {
+0 −3
Original line number Diff line number Diff line
@@ -58,9 +58,6 @@ class ICowWriter {
    // Return number of bytes the cow image occupies on disk.
    virtual uint64_t GetCowSize() = 0;

    // Returns true if AddCopy() operations are supported.
    virtual bool SupportsCopyOperation() const { return true; }

    const CowOptions& options() { return options_; }

  protected:
+3 −1
Original line number Diff line number Diff line
@@ -38,7 +38,9 @@ class MockSnapshotManager : public ISnapshotManager {
                (const android::fs_mgr::CreateLogicalPartitionParams& params,
                 std::string* snapshot_path),
                (override));
    MOCK_METHOD(std::unique_ptr<ISnapshotWriter>, OpenSnapshotWriter,
    MOCK_METHOD(std::unique_ptr<ICowWriter>, OpenSnapshotWriter,
                (const android::fs_mgr::CreateLogicalPartitionParams& params), (override));
    MOCK_METHOD(std::unique_ptr<FileDescriptor>, OpenSnapshotReader,
                (const android::fs_mgr::CreateLogicalPartitionParams& params), (override));
    MOCK_METHOD(bool, UnmapUpdateSnapshot, (const std::string& target_partition_name), (override));
    MOCK_METHOD(bool, NeedSnapshotsInFirstStageMount, (), (override));
Loading