From 9b1e7a34b9fde78a86546d2c714f1f8fb4808592 Mon Sep 17 00:00:00 2001 From: Mark Salyzyn Date: Tue, 25 Sep 2018 10:12:26 -0700 Subject: [PATCH] init: IsDmLinearEnabled() replace with check if logical partitions present in fstab IsDmLinearEnabled() true if logical partitions present in fstab. Test: boot on logical device Bug: 109821005 Change-Id: Ic083b0b8d9f7e9511d78bdc05c9f848521f1feb5 --- init/first_stage_mount.cpp | 24 ++++++++---------------- 1 file changed, 8 insertions(+), 16 deletions(-) diff --git a/init/first_stage_mount.cpp b/init/first_stage_mount.cpp index 1f4bec1bd..c25c5265d 100644 --- a/init/first_stage_mount.cpp +++ b/init/first_stage_mount.cpp @@ -68,6 +68,7 @@ class FirstStageMount { bool CreateLogicalPartitions(); bool MountPartition(fstab_rec* fstab_rec); bool MountPartitions(); + bool IsDmLinearEnabled(); bool GetBackingDmLinearDevices(); virtual ListenerAction UeventCallback(const Uevent& uevent); @@ -130,22 +131,6 @@ static bool IsRecoveryMode() { return !force_normal_boot && access("/system/bin/recovery", F_OK) == 0; } -static inline bool IsDmLinearEnabled() { - static bool checked = false; - static bool enabled = false; - if (checked) { - return enabled; - } - import_kernel_cmdline(false, - [](const std::string& key, const std::string& value, bool in_qemu) { - if (key == "androidboot.logical_partitions" && value == "1") { - enabled = true; - } - }); - checked = true; - return enabled; -} - // Class Definitions // ----------------- FirstStageMount::FirstStageMount() @@ -194,6 +179,13 @@ bool FirstStageMount::InitDevices() { return GetBackingDmLinearDevices() && GetDmVerityDevices() && InitRequiredDevices(); } +bool FirstStageMount::IsDmLinearEnabled() { + for (auto fstab_rec : mount_fstab_recs_) { + if (fs_mgr_is_logical(fstab_rec)) return true; + } + return false; +} + bool FirstStageMount::GetBackingDmLinearDevices() { // Add any additional devices required for dm-linear mappings. if (!IsDmLinearEnabled()) {