Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43ad6362 authored by David Anderson's avatar David Anderson Committed by Gerrit Code Review
Browse files

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

parents 42c86c76 4ba68b64
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -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();
}
+2 −0
Original line number Diff line number Diff line
@@ -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();
+5 −2
Original line number Diff line number Diff line
@@ -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.
 */