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

Commit cd22e3a6 authored by David Anderson's avatar David Anderson Committed by Gerrit Code Review
Browse files

Merge "fs_mgr: Remove the timeout parameter to DestroyLogicalPartition."

parents c9b797ac 470fe2b5
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -61,7 +61,7 @@ bool OpenLogicalPartition(FastbootDevice* device, const std::string& partition_n
        LOG(ERROR) << "Could not map partition: " << partition_name;
        return false;
    }
    auto closer = [partition_name]() -> void { DestroyLogicalPartition(partition_name, 5s); };
    auto closer = [partition_name]() -> void { DestroyLogicalPartition(partition_name); };
    *handle = PartitionHandle(dm_path, std::move(closer));
    return true;
}
+1 −1
Original line number Diff line number Diff line
@@ -1331,7 +1331,7 @@ int fs_mgr_umount_all(android::fs_mgr::Fstab* fstab) {
                continue;
            }
        } else if ((current_entry.fs_mgr_flags.verify)) {
            if (!fs_mgr_teardown_verity(&current_entry, true /* wait */)) {
            if (!fs_mgr_teardown_verity(&current_entry)) {
                LERROR << "Failed to tear down verified partition on mount point: "
                       << current_entry.mount_point;
                ret |= FsMgrUmountStatus::ERROR_VERITY;
+3 −11
Original line number Diff line number Diff line
@@ -184,24 +184,16 @@ bool CreateLogicalPartition(const std::string& block_device, uint32_t metadata_s
                                  timeout_ms, path);
}

bool UnmapDevice(const std::string& name, const std::chrono::milliseconds& timeout_ms) {
bool UnmapDevice(const std::string& name) {
    DeviceMapper& dm = DeviceMapper::Instance();
    std::string path;
    if (timeout_ms > std::chrono::milliseconds::zero()) {
        dm.GetDmDevicePathByName(name, &path);
    }
    if (!dm.DeleteDevice(name)) {
        return false;
    }
    if (!path.empty() && !WaitForFileDeleted(path, timeout_ms)) {
        LERROR << "Timed out waiting for device path to unlink: " << path;
        return false;
    }
    return true;
}

bool DestroyLogicalPartition(const std::string& name, const std::chrono::milliseconds& timeout_ms) {
    if (!UnmapDevice(name, timeout_ms)) {
bool DestroyLogicalPartition(const std::string& name) {
    if (!UnmapDevice(name)) {
        return false;
    }
    LINFO << "Unmapped logical partition " << name;
+3 −3
Original line number Diff line number Diff line
@@ -444,7 +444,7 @@ bool fs_mgr_overlayfs_teardown_scratch(const std::string& overlay, bool* change)
    auto metadata = builder->Export();
    if (metadata && UpdatePartitionTable(super_device, *metadata.get(), slot_number)) {
        if (change) *change = true;
        if (!DestroyLogicalPartition(partition_name, 0s)) return false;
        if (!DestroyLogicalPartition(partition_name)) return false;
    } else {
        LERROR << "delete partition " << overlay;
        return false;
@@ -844,7 +844,7 @@ static void TruncatePartitionsWithSuffix(MetadataBuilder* builder, const std::st
            if (!android::base::EndsWith(name, suffix)) {
                continue;
            }
            if (dm.GetState(name) != DmDeviceState::INVALID && !DestroyLogicalPartition(name, 2s)) {
            if (dm.GetState(name) != DmDeviceState::INVALID && !DestroyLogicalPartition(name)) {
                continue;
            }
            builder->ResizePartition(builder->FindPartition(name), 0);
@@ -918,7 +918,7 @@ bool fs_mgr_overlayfs_create_scratch(const Fstab& fstab, std::string* scratch_de
                        return false;
                    }
                }
                if (!partition_create) DestroyLogicalPartition(partition_name, 10s);
                if (!partition_create) DestroyLogicalPartition(partition_name);
                changed = true;
                *partition_exists = false;
            }
+2 −2
Original line number Diff line number Diff line
@@ -97,10 +97,10 @@ bool is_dt_compatible();
bool fs_mgr_is_ext4(const std::string& blk_device);
bool fs_mgr_is_f2fs(const std::string& blk_device);

bool fs_mgr_teardown_verity(android::fs_mgr::FstabEntry* fstab, bool wait);
bool fs_mgr_teardown_verity(android::fs_mgr::FstabEntry* fstab);

namespace android {
namespace fs_mgr {
bool UnmapDevice(const std::string& name, const std::chrono::milliseconds& timeout_ms);
bool UnmapDevice(const std::string& name);
}  // namespace fs_mgr
}  // namespace android
Loading