Loading fs_mgr/liblp/builder.cpp +6 −2 Original line number Original line Diff line number Diff line Loading @@ -212,7 +212,7 @@ void MetadataBuilder::OverrideABForTesting(bool ab_device) { sABOverrideValue = ab_device; sABOverrideValue = ab_device; } } MetadataBuilder::MetadataBuilder() : auto_slot_suffixing_(false) { MetadataBuilder::MetadataBuilder() : auto_slot_suffixing_(false), ignore_slot_suffixing_(false) { memset(&geometry_, 0, sizeof(geometry_)); memset(&geometry_, 0, sizeof(geometry_)); geometry_.magic = LP_METADATA_GEOMETRY_MAGIC; geometry_.magic = LP_METADATA_GEOMETRY_MAGIC; geometry_.struct_size = sizeof(geometry_); geometry_.struct_size = sizeof(geometry_); Loading Loading @@ -436,7 +436,7 @@ Partition* MetadataBuilder::AddPartition(const std::string& name, const std::str LERROR << "Could not find partition group: " << group_name; LERROR << "Could not find partition group: " << group_name; return nullptr; return nullptr; } } if (IsABDevice() && !auto_slot_suffixing_ && name != "scratch" && if (IsABDevice() && !auto_slot_suffixing_ && name != "scratch" && !ignore_slot_suffixing_ && GetPartitionSlotSuffix(name).empty()) { GetPartitionSlotSuffix(name).empty()) { LERROR << "Unsuffixed partition not allowed on A/B device: " << name; LERROR << "Unsuffixed partition not allowed on A/B device: " << name; return nullptr; return nullptr; Loading Loading @@ -972,6 +972,10 @@ void MetadataBuilder::SetAutoSlotSuffixing() { auto_slot_suffixing_ = true; auto_slot_suffixing_ = true; } } void MetadataBuilder::IgnoreSlotSuffixing() { ignore_slot_suffixing_ = true; } bool MetadataBuilder::IsABDevice() const { bool MetadataBuilder::IsABDevice() const { if (sABOverrideSet) { if (sABOverrideSet) { return sABOverrideValue; return sABOverrideValue; Loading fs_mgr/liblp/include/liblp/builder.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -248,6 +248,9 @@ class MetadataBuilder { // Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag. // Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag. void SetAutoSlotSuffixing(); void SetAutoSlotSuffixing(); // If set, checks for slot suffixes will be ignored internally. void IgnoreSlotSuffixing(); bool GetBlockDeviceInfo(const std::string& partition_name, BlockDeviceInfo* info) const; bool GetBlockDeviceInfo(const std::string& partition_name, BlockDeviceInfo* info) const; bool UpdateBlockDeviceInfo(const std::string& partition_name, const BlockDeviceInfo& info); bool UpdateBlockDeviceInfo(const std::string& partition_name, const BlockDeviceInfo& info); Loading Loading @@ -310,6 +313,7 @@ class MetadataBuilder { std::vector<std::unique_ptr<PartitionGroup>> groups_; std::vector<std::unique_ptr<PartitionGroup>> groups_; std::vector<LpMetadataBlockDevice> block_devices_; std::vector<LpMetadataBlockDevice> block_devices_; bool auto_slot_suffixing_; bool auto_slot_suffixing_; bool ignore_slot_suffixing_; }; }; // Read BlockDeviceInfo for a given block device. This always returns false // Read BlockDeviceInfo for a given block device. This always returns false Loading Loading
fs_mgr/liblp/builder.cpp +6 −2 Original line number Original line Diff line number Diff line Loading @@ -212,7 +212,7 @@ void MetadataBuilder::OverrideABForTesting(bool ab_device) { sABOverrideValue = ab_device; sABOverrideValue = ab_device; } } MetadataBuilder::MetadataBuilder() : auto_slot_suffixing_(false) { MetadataBuilder::MetadataBuilder() : auto_slot_suffixing_(false), ignore_slot_suffixing_(false) { memset(&geometry_, 0, sizeof(geometry_)); memset(&geometry_, 0, sizeof(geometry_)); geometry_.magic = LP_METADATA_GEOMETRY_MAGIC; geometry_.magic = LP_METADATA_GEOMETRY_MAGIC; geometry_.struct_size = sizeof(geometry_); geometry_.struct_size = sizeof(geometry_); Loading Loading @@ -436,7 +436,7 @@ Partition* MetadataBuilder::AddPartition(const std::string& name, const std::str LERROR << "Could not find partition group: " << group_name; LERROR << "Could not find partition group: " << group_name; return nullptr; return nullptr; } } if (IsABDevice() && !auto_slot_suffixing_ && name != "scratch" && if (IsABDevice() && !auto_slot_suffixing_ && name != "scratch" && !ignore_slot_suffixing_ && GetPartitionSlotSuffix(name).empty()) { GetPartitionSlotSuffix(name).empty()) { LERROR << "Unsuffixed partition not allowed on A/B device: " << name; LERROR << "Unsuffixed partition not allowed on A/B device: " << name; return nullptr; return nullptr; Loading Loading @@ -972,6 +972,10 @@ void MetadataBuilder::SetAutoSlotSuffixing() { auto_slot_suffixing_ = true; auto_slot_suffixing_ = true; } } void MetadataBuilder::IgnoreSlotSuffixing() { ignore_slot_suffixing_ = true; } bool MetadataBuilder::IsABDevice() const { bool MetadataBuilder::IsABDevice() const { if (sABOverrideSet) { if (sABOverrideSet) { return sABOverrideValue; return sABOverrideValue; Loading
fs_mgr/liblp/include/liblp/builder.h +4 −0 Original line number Original line Diff line number Diff line Loading @@ -248,6 +248,9 @@ class MetadataBuilder { // Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag. // Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag. void SetAutoSlotSuffixing(); void SetAutoSlotSuffixing(); // If set, checks for slot suffixes will be ignored internally. void IgnoreSlotSuffixing(); bool GetBlockDeviceInfo(const std::string& partition_name, BlockDeviceInfo* info) const; bool GetBlockDeviceInfo(const std::string& partition_name, BlockDeviceInfo* info) const; bool UpdateBlockDeviceInfo(const std::string& partition_name, const BlockDeviceInfo& info); bool UpdateBlockDeviceInfo(const std::string& partition_name, const BlockDeviceInfo& info); Loading Loading @@ -310,6 +313,7 @@ class MetadataBuilder { std::vector<std::unique_ptr<PartitionGroup>> groups_; std::vector<std::unique_ptr<PartitionGroup>> groups_; std::vector<LpMetadataBlockDevice> block_devices_; std::vector<LpMetadataBlockDevice> block_devices_; bool auto_slot_suffixing_; bool auto_slot_suffixing_; bool ignore_slot_suffixing_; }; }; // Read BlockDeviceInfo for a given block device. This always returns false // Read BlockDeviceInfo for a given block device. This always returns false Loading