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

Commit 9603a829 authored by Yi-Yo Chiang's avatar Yi-Yo Chiang Committed by Gerrit Code Review
Browse files

Merge "fs_mgr: Refactor fs_mgr_overlayfs_already_mounted() to be more readable" into main

parents 7881073e 37467f36
Loading
Loading
Loading
Loading
+9 −6
Original line number Diff line number Diff line
@@ -733,15 +733,18 @@ bool fs_mgr_overlayfs_is_setup() {

bool fs_mgr_overlayfs_already_mounted(const std::string& mount_point, bool overlay_only) {
    Fstab fstab;
    if (!ReadFstabFromFile("/proc/mounts", &fstab)) {
    if (!ReadFstabFromProcMounts(&fstab)) {
        return false;
    }
    const auto lowerdir = kLowerdirOption + mount_point;
    for (const auto& entry : fstab) {
        if (overlay_only && "overlay" != entry.fs_type && "overlayfs" != entry.fs_type) continue;
        if (mount_point != entry.mount_point) continue;
        if (!overlay_only) return true;
        const auto options = android::base::Split(entry.fs_options, ",");
    for (const auto& entry : GetEntriesForMountPoint(&fstab, mount_point)) {
        if (!overlay_only) {
            return true;
        }
        if (entry->fs_type != "overlay" && entry->fs_type != "overlayfs") {
            continue;
        }
        const auto options = android::base::Split(entry->fs_options, ",");
        for (const auto& opt : options) {
            if (opt == lowerdir) {
                return true;