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

Commit 264b7dfa authored by Mark Salyzyn's avatar Mark Salyzyn
Browse files

fs_mgr: overlay: support non-DAP A/B devices

Loosen some tests and borrow logic from retrofit Dynamic Android
Partitions (DAP) A/B devices.  In non-DAP A/B device case
/mnt/scratch is used, backed by the system other partition.

Tested on taimen with CONFIG_OVERLAY_FS added to its pre 4.6 kernel,
and BOARD_EXT4_SHARE_DUP_BLOCKS := true added to board config. Also
tested on a retrofit DAP A/B device and an untouched taimen.

Test: adb_remount_test.sh
Bug: 120448575
Change-Id: I72aaf4d68db1c3ac380aba425346ab6443cadad3
parent 52490faa
Loading
Loading
Loading
Loading
+5 −5
Original line number Diff line number Diff line
@@ -642,7 +642,11 @@ std::string fs_mgr_overlayfs_scratch_device() {
        // Create from within single super device;
        auto& dm = DeviceMapper::Instance();
        const auto partition_name = android::base::Basename(kScratchMountPoint);
        if (!dm.GetDmDevicePathByName(partition_name, &path)) return "";
        if (!dm.GetDmDevicePathByName(partition_name, &path)) {
            // non-DAP A/B device?
            if (fs_mgr_access(super_device)) return "";
            path = kPhysicalDevice + "system" + (slot_number ? "_a" : "_b");
        }
    }
    return scratch_device_cache = path;
}
@@ -883,10 +887,6 @@ bool fs_mgr_overlayfs_setup(const char* backing, const char* mount_point, bool*
    for (const auto& overlay_mount_point : kOverlayMountPoints) {
        if (backing && backing[0] && (overlay_mount_point != backing)) continue;
        if (overlay_mount_point == kScratchMountPoint) {
            if (!fs_mgr_rw_access(fs_mgr_overlayfs_super_device(fs_mgr_overlayfs_slot_number())) ||
                !fs_mgr_overlayfs_has_logical(fstab)) {
                continue;
            }
            if (!fs_mgr_overlayfs_setup_scratch(fstab, change)) continue;
        } else {
            if (std::find_if(fstab.begin(), fstab.end(), [&overlay_mount_point](const auto& entry) {