From e0384bbc69dea873757619f17e2ae19473444a5a Mon Sep 17 00:00:00 2001 From: David Anderson Date: Thu, 19 Jul 2018 12:27:21 -0700 Subject: [PATCH] fs_mgr: Remove early prototype code. This early code is no longer needed now that logical partitions can be created and flashed normally. Bug: 79173901 Test: N/A Change-Id: I393ef23b3d3ce1cd9c80833358051838d0e9f333 --- fs_mgr/fs_mgr_dm_linear.cpp | 27 --------------------------- fs_mgr/include/fs_mgr_dm_linear.h | 22 ---------------------- init/init_first_stage.cpp | 20 -------------------- 3 files changed, 69 deletions(-) diff --git a/fs_mgr/fs_mgr_dm_linear.cpp b/fs_mgr/fs_mgr_dm_linear.cpp index 5159b4cd4..28e910ba2 100644 --- a/fs_mgr/fs_mgr_dm_linear.cpp +++ b/fs_mgr/fs_mgr_dm_linear.cpp @@ -50,33 +50,6 @@ using DmTarget = android::dm::DmTarget; using DmTargetZero = android::dm::DmTargetZero; using DmTargetLinear = android::dm::DmTargetLinear; -static bool CreateDmDeviceForPartition(DeviceMapper& dm, const LogicalPartition& partition) { - DmTable table; - for (const auto& extent : partition.extents) { - table.AddTarget(std::make_unique(extent)); - } - if (!dm.CreateDevice(partition.name, table)) { - return false; - } - LINFO << "Created device-mapper device: " << partition.name; - return true; -} - -bool CreateLogicalPartitions(const LogicalPartitionTable& table) { - DeviceMapper& dm = DeviceMapper::Instance(); - for (const auto& partition : table.partitions) { - if (!CreateDmDeviceForPartition(dm, partition)) { - LOG(ERROR) << "could not create dm-linear device for partition: " << partition.name; - return false; - } - } - return true; -} - -std::unique_ptr LoadPartitionsFromDeviceTree() { - return nullptr; -} - static bool CreateDmTable(const std::string& block_device, const LpMetadata& metadata, const LpMetadataPartition& partition, DmTable* table) { uint64_t sector = 0; diff --git a/fs_mgr/include/fs_mgr_dm_linear.h b/fs_mgr/include/fs_mgr_dm_linear.h index 3b0c791bc..42af9d002 100644 --- a/fs_mgr/include/fs_mgr_dm_linear.h +++ b/fs_mgr/include/fs_mgr_dm_linear.h @@ -37,28 +37,6 @@ namespace android { namespace fs_mgr { -struct LogicalPartition { - std::string name; - std::vector extents; -}; - -struct LogicalPartitionTable { - // List of partitions in the partition table. - std::vector partitions; -}; - -// Load a dm-linear table from the device tree if one is available; otherwise, -// return null. -std::unique_ptr LoadPartitionsFromDeviceTree(); - -// Create device-mapper devices for the given partition table. -// -// On success, two devices nodes will be created for each partition, both -// pointing to the same device: -// /dev/block/dm- where N is a sequential ID assigned by device-mapper. -// /dev/block/dm- where |name| is the partition name. -// -bool CreateLogicalPartitions(const LogicalPartitionTable& table); bool CreateLogicalPartitions(const std::string& block_device); } // namespace fs_mgr diff --git a/init/init_first_stage.cpp b/init/init_first_stage.cpp index a24a9a239..0ee020384 100644 --- a/init/init_first_stage.cpp +++ b/init/init_first_stage.cpp @@ -40,7 +40,6 @@ #include "util.h" using android::base::Timer; -using android::fs_mgr::LogicalPartitionTable; namespace android { namespace init { @@ -75,7 +74,6 @@ class FirstStageMount { bool need_dm_verity_; std::unique_ptr device_tree_fstab_; - std::unique_ptr dm_linear_table_; std::string lp_metadata_partition_; std::vector mount_fstab_recs_; std::set required_devices_partition_names_; @@ -150,10 +148,6 @@ FirstStageMount::FirstStageMount() LOG(INFO) << "Failed to read fstab from device tree"; } - if (IsDmLinearEnabled()) { - dm_linear_table_ = android::fs_mgr::LoadPartitionsFromDeviceTree(); - } - auto boot_devices = fs_mgr_get_boot_devices(); device_handler_ = std::make_unique(std::vector{}, std::vector{}, @@ -195,15 +189,6 @@ bool FirstStageMount::GetBackingDmLinearDevices() { } required_devices_partition_names_.emplace(LP_METADATA_PARTITION_NAME); - - if (dm_linear_table_) { - for (const auto& partition : dm_linear_table_->partitions) { - for (const auto& extent : partition.extents) { - const std::string& partition_name = android::base::Basename(extent.block_device()); - required_devices_partition_names_.emplace(partition_name); - } - } - } return true; } @@ -272,11 +257,6 @@ bool FirstStageMount::CreateLogicalPartitions() { << LP_METADATA_PARTITION_NAME; return false; } - if (dm_linear_table_) { - if (!android::fs_mgr::CreateLogicalPartitions(*dm_linear_table_.get())) { - return false; - } - } return android::fs_mgr::CreateLogicalPartitions(lp_metadata_partition_); }