Skip to content

Commit 881be58

Browse files
Treehugger RobotGerrit Code Review
authored andcommitted
Merge "fs_mgr: Remove early prototype code."
2 parents b8a2fa7 + e0384bb commit 881be58

File tree

3 files changed

+0
-69
lines changed

3 files changed

+0
-69
lines changed

fs_mgr/fs_mgr_dm_linear.cpp

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -50,33 +50,6 @@ using DmTarget = android::dm::DmTarget;
5050
using DmTargetZero = android::dm::DmTargetZero;
5151
using DmTargetLinear = android::dm::DmTargetLinear;
5252

53-
static bool CreateDmDeviceForPartition(DeviceMapper& dm, const LogicalPartition& partition) {
54-
DmTable table;
55-
for (const auto& extent : partition.extents) {
56-
table.AddTarget(std::make_unique<DmTargetLinear>(extent));
57-
}
58-
if (!dm.CreateDevice(partition.name, table)) {
59-
return false;
60-
}
61-
LINFO << "Created device-mapper device: " << partition.name;
62-
return true;
63-
}
64-
65-
bool CreateLogicalPartitions(const LogicalPartitionTable& table) {
66-
DeviceMapper& dm = DeviceMapper::Instance();
67-
for (const auto& partition : table.partitions) {
68-
if (!CreateDmDeviceForPartition(dm, partition)) {
69-
LOG(ERROR) << "could not create dm-linear device for partition: " << partition.name;
70-
return false;
71-
}
72-
}
73-
return true;
74-
}
75-
76-
std::unique_ptr<LogicalPartitionTable> LoadPartitionsFromDeviceTree() {
77-
return nullptr;
78-
}
79-
8053
static bool CreateDmTable(const std::string& block_device, const LpMetadata& metadata,
8154
const LpMetadataPartition& partition, DmTable* table) {
8255
uint64_t sector = 0;

fs_mgr/include/fs_mgr_dm_linear.h

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -37,28 +37,6 @@
3737
namespace android {
3838
namespace fs_mgr {
3939

40-
struct LogicalPartition {
41-
std::string name;
42-
std::vector<android::dm::DmTargetLinear> extents;
43-
};
44-
45-
struct LogicalPartitionTable {
46-
// List of partitions in the partition table.
47-
std::vector<LogicalPartition> partitions;
48-
};
49-
50-
// Load a dm-linear table from the device tree if one is available; otherwise,
51-
// return null.
52-
std::unique_ptr<LogicalPartitionTable> LoadPartitionsFromDeviceTree();
53-
54-
// Create device-mapper devices for the given partition table.
55-
//
56-
// On success, two devices nodes will be created for each partition, both
57-
// pointing to the same device:
58-
// /dev/block/dm-<N> where N is a sequential ID assigned by device-mapper.
59-
// /dev/block/dm-<name> where |name| is the partition name.
60-
//
61-
bool CreateLogicalPartitions(const LogicalPartitionTable& table);
6240
bool CreateLogicalPartitions(const std::string& block_device);
6341

6442
} // namespace fs_mgr

init/init_first_stage.cpp

Lines changed: 0 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040
#include "util.h"
4141

4242
using android::base::Timer;
43-
using android::fs_mgr::LogicalPartitionTable;
4443

4544
namespace android {
4645
namespace init {
@@ -75,7 +74,6 @@ class FirstStageMount {
7574
bool need_dm_verity_;
7675

7776
std::unique_ptr<fstab, decltype(&fs_mgr_free_fstab)> device_tree_fstab_;
78-
std::unique_ptr<LogicalPartitionTable> dm_linear_table_;
7977
std::string lp_metadata_partition_;
8078
std::vector<fstab_rec*> mount_fstab_recs_;
8179
std::set<std::string> required_devices_partition_names_;
@@ -150,10 +148,6 @@ FirstStageMount::FirstStageMount()
150148
LOG(INFO) << "Failed to read fstab from device tree";
151149
}
152150

153-
if (IsDmLinearEnabled()) {
154-
dm_linear_table_ = android::fs_mgr::LoadPartitionsFromDeviceTree();
155-
}
156-
157151
auto boot_devices = fs_mgr_get_boot_devices();
158152
device_handler_ =
159153
std::make_unique<DeviceHandler>(std::vector<Permissions>{}, std::vector<SysfsPermissions>{},
@@ -195,15 +189,6 @@ bool FirstStageMount::GetBackingDmLinearDevices() {
195189
}
196190

197191
required_devices_partition_names_.emplace(LP_METADATA_PARTITION_NAME);
198-
199-
if (dm_linear_table_) {
200-
for (const auto& partition : dm_linear_table_->partitions) {
201-
for (const auto& extent : partition.extents) {
202-
const std::string& partition_name = android::base::Basename(extent.block_device());
203-
required_devices_partition_names_.emplace(partition_name);
204-
}
205-
}
206-
}
207192
return true;
208193
}
209194

@@ -272,11 +257,6 @@ bool FirstStageMount::CreateLogicalPartitions() {
272257
<< LP_METADATA_PARTITION_NAME;
273258
return false;
274259
}
275-
if (dm_linear_table_) {
276-
if (!android::fs_mgr::CreateLogicalPartitions(*dm_linear_table_.get())) {
277-
return false;
278-
}
279-
}
280260
return android::fs_mgr::CreateLogicalPartitions(lp_metadata_partition_);
281261
}
282262

0 commit comments

Comments
 (0)