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

Commit 24815a49 authored by Yifan Hong's avatar Yifan Hong Committed by Gerrit Code Review
Browse files

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

parents 878930be f4cd54e5
Loading
Loading
Loading
Loading
+7 −1
Original line number Diff line number Diff line
@@ -362,12 +362,18 @@ bool SnapshotManager::MapSnapshot(LockedFile* lock, const std::string& name,
    }

    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:
        //     [linear, linear] ; to snapshot, and non-snapshot region of base device
        //     [snapshot-inner]
        //     [base device]   [cow]
        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,
                                      snapshot_sectors);
        if (!dm.CreateDevice(name, table, dev_path, timeout_ms)) {