Merge "liblp: Add a VIRTUAL_AB_DEVICE flag for LpMetadataHeader."

This commit is contained in:
David Anderson 2019-12-18 15:42:44 +00:00 committed by Gerrit Code Review
commit 43ad6362da
3 changed files with 12 additions and 2 deletions

View File

@ -1125,6 +1125,11 @@ void MetadataBuilder::SetAutoSlotSuffixing() {
auto_slot_suffixing_ = true;
}
void MetadataBuilder::SetVirtualABDeviceFlag() {
RequireExpandedMetadataHeader();
header_.flags |= LP_HEADER_FLAG_VIRTUAL_AB_DEVICE;
}
bool MetadataBuilder::IsABDevice() {
return !IPropertyFetcher::GetInstance()->GetProperty("ro.boot.slot_suffix", "").empty();
}

View File

@ -318,6 +318,8 @@ class MetadataBuilder {
// Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag.
void SetAutoSlotSuffixing();
// Set the LP_HEADER_FLAG_VIRTUAL_AB_DEVICE flag.
void SetVirtualABDeviceFlag();
// If set, checks for slot suffixes will be ignored internally.
void IgnoreSlotSuffixing();

View File

@ -224,8 +224,6 @@ typedef struct LpMetadataHeader {
/* 128: See LP_HEADER_FLAG_ constants for possible values. Header flags are
* independent of the version number and intended to be informational only.
* New flags can be added without bumping the version.
*
* (Note there are no flags currently defined.)
*/
uint32_t flags;
@ -233,6 +231,11 @@ typedef struct LpMetadataHeader {
uint8_t reserved[124];
} __attribute__((packed)) LpMetadataHeader;
/* This device uses Virtual A/B. Note that on retrofit devices, the expanded
* header may not be present.
*/
#define LP_HEADER_FLAG_VIRTUAL_AB_DEVICE 0x1
/* This struct defines a logical partition entry, similar to what would be
* present in a GUID Partition Table.
*/