Merge "fs_mgr: Remove early prototype code."
This commit is contained in:
commit
881be58f41
|
@ -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<DmTargetLinear>(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<LogicalPartitionTable> LoadPartitionsFromDeviceTree() {
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
static bool CreateDmTable(const std::string& block_device, const LpMetadata& metadata,
|
||||
const LpMetadataPartition& partition, DmTable* table) {
|
||||
uint64_t sector = 0;
|
||||
|
|
|
@ -37,28 +37,6 @@
|
|||
namespace android {
|
||||
namespace fs_mgr {
|
||||
|
||||
struct LogicalPartition {
|
||||
std::string name;
|
||||
std::vector<android::dm::DmTargetLinear> extents;
|
||||
};
|
||||
|
||||
struct LogicalPartitionTable {
|
||||
// List of partitions in the partition table.
|
||||
std::vector<LogicalPartition> partitions;
|
||||
};
|
||||
|
||||
// Load a dm-linear table from the device tree if one is available; otherwise,
|
||||
// return null.
|
||||
std::unique_ptr<LogicalPartitionTable> 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-<N> where N is a sequential ID assigned by device-mapper.
|
||||
// /dev/block/dm-<name> where |name| is the partition name.
|
||||
//
|
||||
bool CreateLogicalPartitions(const LogicalPartitionTable& table);
|
||||
bool CreateLogicalPartitions(const std::string& block_device);
|
||||
|
||||
} // namespace fs_mgr
|
||||
|
|
|
@ -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<fstab, decltype(&fs_mgr_free_fstab)> device_tree_fstab_;
|
||||
std::unique_ptr<LogicalPartitionTable> dm_linear_table_;
|
||||
std::string lp_metadata_partition_;
|
||||
std::vector<fstab_rec*> mount_fstab_recs_;
|
||||
std::set<std::string> 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<DeviceHandler>(std::vector<Permissions>{}, std::vector<SysfsPermissions>{},
|
||||
|
@ -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_);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue