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

Commit b55281cb authored by Yifan Hong's avatar Yifan Hong Committed by android-build-merger
Browse files

Merge "libsnapshot: MapSnapshot: use device string for inner device"

am: 24815a49

Change-Id: I48c32c805c18c685640629c380b2ea497560a75c
parents 2a2389c8 24815a49
Loading
Loading
Loading
Loading
+7 −1
Original line number Original line Diff line number Diff line
@@ -362,12 +362,18 @@ bool SnapshotManager::MapSnapshot(LockedFile* lock, const std::string& name,
    }
    }


    if (linear_sectors) {
    if (linear_sectors) {
        std::string snap_dev;
        if (!dm.GetDeviceString(snap_name, &snap_dev)) {
            LOG(ERROR) << "Cannot determine major/minor for: " << snap_name;
            return false;
        }

        // Our stacking will looks like this:
        // Our stacking will looks like this:
        //     [linear, linear] ; to snapshot, and non-snapshot region of base device
        //     [linear, linear] ; to snapshot, and non-snapshot region of base device
        //     [snapshot-inner]
        //     [snapshot-inner]
        //     [base device]   [cow]
        //     [base device]   [cow]
        DmTable table;
        DmTable table;
        table.Emplace<DmTargetLinear>(0, snapshot_sectors, *dev_path, 0);
        table.Emplace<DmTargetLinear>(0, snapshot_sectors, snap_dev, 0);
        table.Emplace<DmTargetLinear>(snapshot_sectors, linear_sectors, base_device,
        table.Emplace<DmTargetLinear>(snapshot_sectors, linear_sectors, base_device,
                                      snapshot_sectors);
                                      snapshot_sectors);
        if (!dm.CreateDevice(name, table, dev_path, timeout_ms)) {
        if (!dm.CreateDevice(name, table, dev_path, timeout_ms)) {