Loading fastboot/device/commands.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -470,7 +470,7 @@ PartitionBuilder::PartitionBuilder(FastbootDevice* device, const std::string& pa : device_(device) { std::string slot_suffix = GetSuperSlotSuffix(device, partition_name); slot_number_ = android::fs_mgr::SlotNumberForSlotSuffix(slot_suffix); auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number_)); auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!super_device) { return; } Loading fastboot/device/utility.cpp +11 −25 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ bool OpenLogicalPartition(FastbootDevice* device, const std::string& partition_n PartitionHandle* handle) { std::string slot_suffix = GetSuperSlotSuffix(device, partition_name); uint32_t slot_number = SlotNumberForSlotSuffix(slot_suffix); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number)); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -117,7 +117,7 @@ static const LpMetadataPartition* FindLogicalPartition(const LpMetadata& metadat bool LogicalPartitionExists(FastbootDevice* device, const std::string& name, bool* is_zero_length) { std::string slot_suffix = GetSuperSlotSuffix(device, name); uint32_t slot_number = SlotNumberForSlotSuffix(slot_suffix); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number)); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -164,33 +164,19 @@ std::vector<std::string> ListPartitions(FastbootDevice* device) { } } // Find metadata in each super partition (on retrofit devices, there will // be two). std::vector<std::unique_ptr<LpMetadata>> metadata_list; uint32_t current_slot = SlotNumberForSlotSuffix(device->GetCurrentSlot()); std::string super_name = fs_mgr_get_super_partition_name(current_slot); if (auto metadata = ReadMetadata(super_name, current_slot)) { metadata_list.emplace_back(std::move(metadata)); } uint32_t other_slot = (current_slot == 0) ? 1 : 0; std::string other_super = fs_mgr_get_super_partition_name(other_slot); if (super_name != other_super) { if (auto metadata = ReadMetadata(other_super, other_slot)) { metadata_list.emplace_back(std::move(metadata)); } std::string super_name = fs_mgr_get_super_partition_name(); auto metadata = ReadMetadata(super_name, current_slot); if (!metadata) { return {}; } for (const auto& metadata : metadata_list) { for (const auto& partition : metadata->partitions) { std::string partition_name = GetPartitionName(partition); if (std::find(partitions.begin(), partitions.end(), partition_name) == partitions.end()) { if (std::find(partitions.begin(), partitions.end(), partition_name) == partitions.end()) { partitions.emplace_back(partition_name); } } } return partitions; } Loading Loading @@ -218,7 +204,7 @@ std::string GetSuperSlotSuffix(FastbootDevice* device, const std::string& partit // retrofit device, and we should take the current slot. std::string current_slot_suffix = device->GetCurrentSlot(); uint32_t current_slot_number = SlotNumberForSlotSuffix(current_slot_suffix); std::string super_partition = fs_mgr_get_super_partition_name(current_slot_number); std::string super_partition = fs_mgr_get_super_partition_name(); if (GetPartitionSlotSuffix(super_partition).empty()) { return current_slot_suffix; } Loading fastboot/device/variables.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -451,10 +451,9 @@ bool GetHardwareRevision(FastbootDevice* /* device */, const std::vector<std::st return true; } bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string>& /* args */, bool GetSuperPartitionName(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, std::string* message) { uint32_t slot_number = SlotNumberForSlotSuffix(device->GetCurrentSlot()); *message = fs_mgr_get_super_partition_name(slot_number); *message = fs_mgr_get_super_partition_name(); return true; } Loading fs_mgr/fs_mgr.cpp +2 −13 Original line number Diff line number Diff line Loading @@ -2248,7 +2248,7 @@ bool fs_mgr_verity_is_check_at_most_once(const android::fs_mgr::FstabEntry& entr return hashtree_info->check_at_most_once; } std::string fs_mgr_get_super_partition_name(int slot) { std::string fs_mgr_get_super_partition_name() { // Devices upgrading to dynamic partitions are allowed to specify a super // partition name. This includes cuttlefish, which is a non-A/B device. std::string super_partition; Loading @@ -2256,19 +2256,8 @@ std::string fs_mgr_get_super_partition_name(int slot) { return super_partition; } if (fs_mgr_get_boot_config("super_partition", &super_partition)) { if (fs_mgr_get_slot_suffix().empty()) { return super_partition; } std::string suffix; if (slot == 0) { suffix = "_a"; } else if (slot == 1) { suffix = "_b"; } else if (slot == -1) { suffix = fs_mgr_get_slot_suffix(); } return super_partition + suffix; } return LP_METADATA_DEFAULT_PARTITION_NAME; } Loading fs_mgr/include/fs_mgr.h +2 −4 Original line number Diff line number Diff line Loading @@ -99,10 +99,8 @@ int fs_mgr_do_format(const android::fs_mgr::FstabEntry& entry); #define FS_MGR_SETUP_VERITY_SUCCESS 0 int fs_mgr_setup_verity(android::fs_mgr::FstabEntry* fstab, bool wait_for_verity_dev); // Return the name of the super partition if it exists. If a slot number is // specified, the super partition for the corresponding metadata slot will be // returned. Otherwise, it will use the current slot. std::string fs_mgr_get_super_partition_name(int slot = -1); // Return the name of the super partition if it exists. std::string fs_mgr_get_super_partition_name(); // Set readonly for the block device bool fs_mgr_set_blk_ro(const std::string& blockdev, bool readonly = true); Loading Loading
fastboot/device/commands.cpp +1 −1 Original line number Diff line number Diff line Loading @@ -470,7 +470,7 @@ PartitionBuilder::PartitionBuilder(FastbootDevice* device, const std::string& pa : device_(device) { std::string slot_suffix = GetSuperSlotSuffix(device, partition_name); slot_number_ = android::fs_mgr::SlotNumberForSlotSuffix(slot_suffix); auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number_)); auto super_device = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!super_device) { return; } Loading
fastboot/device/utility.cpp +11 −25 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ bool OpenLogicalPartition(FastbootDevice* device, const std::string& partition_n PartitionHandle* handle) { std::string slot_suffix = GetSuperSlotSuffix(device, partition_name); uint32_t slot_number = SlotNumberForSlotSuffix(slot_suffix); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number)); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -117,7 +117,7 @@ static const LpMetadataPartition* FindLogicalPartition(const LpMetadata& metadat bool LogicalPartitionExists(FastbootDevice* device, const std::string& name, bool* is_zero_length) { std::string slot_suffix = GetSuperSlotSuffix(device, name); uint32_t slot_number = SlotNumberForSlotSuffix(slot_suffix); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name(slot_number)); auto path = FindPhysicalPartition(fs_mgr_get_super_partition_name()); if (!path) { return false; } Loading Loading @@ -164,33 +164,19 @@ std::vector<std::string> ListPartitions(FastbootDevice* device) { } } // Find metadata in each super partition (on retrofit devices, there will // be two). std::vector<std::unique_ptr<LpMetadata>> metadata_list; uint32_t current_slot = SlotNumberForSlotSuffix(device->GetCurrentSlot()); std::string super_name = fs_mgr_get_super_partition_name(current_slot); if (auto metadata = ReadMetadata(super_name, current_slot)) { metadata_list.emplace_back(std::move(metadata)); } uint32_t other_slot = (current_slot == 0) ? 1 : 0; std::string other_super = fs_mgr_get_super_partition_name(other_slot); if (super_name != other_super) { if (auto metadata = ReadMetadata(other_super, other_slot)) { metadata_list.emplace_back(std::move(metadata)); } std::string super_name = fs_mgr_get_super_partition_name(); auto metadata = ReadMetadata(super_name, current_slot); if (!metadata) { return {}; } for (const auto& metadata : metadata_list) { for (const auto& partition : metadata->partitions) { std::string partition_name = GetPartitionName(partition); if (std::find(partitions.begin(), partitions.end(), partition_name) == partitions.end()) { if (std::find(partitions.begin(), partitions.end(), partition_name) == partitions.end()) { partitions.emplace_back(partition_name); } } } return partitions; } Loading Loading @@ -218,7 +204,7 @@ std::string GetSuperSlotSuffix(FastbootDevice* device, const std::string& partit // retrofit device, and we should take the current slot. std::string current_slot_suffix = device->GetCurrentSlot(); uint32_t current_slot_number = SlotNumberForSlotSuffix(current_slot_suffix); std::string super_partition = fs_mgr_get_super_partition_name(current_slot_number); std::string super_partition = fs_mgr_get_super_partition_name(); if (GetPartitionSlotSuffix(super_partition).empty()) { return current_slot_suffix; } Loading
fastboot/device/variables.cpp +2 −3 Original line number Diff line number Diff line Loading @@ -451,10 +451,9 @@ bool GetHardwareRevision(FastbootDevice* /* device */, const std::vector<std::st return true; } bool GetSuperPartitionName(FastbootDevice* device, const std::vector<std::string>& /* args */, bool GetSuperPartitionName(FastbootDevice* /* device */, const std::vector<std::string>& /* args */, std::string* message) { uint32_t slot_number = SlotNumberForSlotSuffix(device->GetCurrentSlot()); *message = fs_mgr_get_super_partition_name(slot_number); *message = fs_mgr_get_super_partition_name(); return true; } Loading
fs_mgr/fs_mgr.cpp +2 −13 Original line number Diff line number Diff line Loading @@ -2248,7 +2248,7 @@ bool fs_mgr_verity_is_check_at_most_once(const android::fs_mgr::FstabEntry& entr return hashtree_info->check_at_most_once; } std::string fs_mgr_get_super_partition_name(int slot) { std::string fs_mgr_get_super_partition_name() { // Devices upgrading to dynamic partitions are allowed to specify a super // partition name. This includes cuttlefish, which is a non-A/B device. std::string super_partition; Loading @@ -2256,19 +2256,8 @@ std::string fs_mgr_get_super_partition_name(int slot) { return super_partition; } if (fs_mgr_get_boot_config("super_partition", &super_partition)) { if (fs_mgr_get_slot_suffix().empty()) { return super_partition; } std::string suffix; if (slot == 0) { suffix = "_a"; } else if (slot == 1) { suffix = "_b"; } else if (slot == -1) { suffix = fs_mgr_get_slot_suffix(); } return super_partition + suffix; } return LP_METADATA_DEFAULT_PARTITION_NAME; } Loading
fs_mgr/include/fs_mgr.h +2 −4 Original line number Diff line number Diff line Loading @@ -99,10 +99,8 @@ int fs_mgr_do_format(const android::fs_mgr::FstabEntry& entry); #define FS_MGR_SETUP_VERITY_SUCCESS 0 int fs_mgr_setup_verity(android::fs_mgr::FstabEntry* fstab, bool wait_for_verity_dev); // Return the name of the super partition if it exists. If a slot number is // specified, the super partition for the corresponding metadata slot will be // returned. Otherwise, it will use the current slot. std::string fs_mgr_get_super_partition_name(int slot = -1); // Return the name of the super partition if it exists. std::string fs_mgr_get_super_partition_name(); // Set readonly for the block device bool fs_mgr_set_blk_ro(const std::string& blockdev, bool readonly = true); Loading