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

Commit 4ba68b64 authored by David Anderson's avatar David Anderson
Browse files

liblp: Add a VIRTUAL_AB_DEVICE flag for LpMetadataHeader.

Bug: 134949511
Test: liblp_test gtests
Change-Id: I8b376d0980e1372086ed15b980209f3726ef651a
parent 48d3b1e1
Loading
Loading
Loading
Loading
+5 −0
Original line number Original line Diff line number Diff line
@@ -1125,6 +1125,11 @@ void MetadataBuilder::SetAutoSlotSuffixing() {
    auto_slot_suffixing_ = true;
    auto_slot_suffixing_ = true;
}
}


void MetadataBuilder::SetVirtualABDeviceFlag() {
    RequireExpandedMetadataHeader();
    header_.flags |= LP_HEADER_FLAG_VIRTUAL_AB_DEVICE;
}

bool MetadataBuilder::IsABDevice() {
bool MetadataBuilder::IsABDevice() {
    return !IPropertyFetcher::GetInstance()->GetProperty("ro.boot.slot_suffix", "").empty();
    return !IPropertyFetcher::GetInstance()->GetProperty("ro.boot.slot_suffix", "").empty();
}
}
+2 −0
Original line number Original line Diff line number Diff line
@@ -318,6 +318,8 @@ class MetadataBuilder {


    // Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag.
    // Set the LP_METADATA_AUTO_SLOT_SUFFIXING flag.
    void SetAutoSlotSuffixing();
    void SetAutoSlotSuffixing();
    // Set the LP_HEADER_FLAG_VIRTUAL_AB_DEVICE flag.
    void SetVirtualABDeviceFlag();


    // If set, checks for slot suffixes will be ignored internally.
    // If set, checks for slot suffixes will be ignored internally.
    void IgnoreSlotSuffixing();
    void IgnoreSlotSuffixing();
+5 −2
Original line number Original line Diff line number Diff line
@@ -224,8 +224,6 @@ typedef struct LpMetadataHeader {
    /* 128: See LP_HEADER_FLAG_ constants for possible values. Header flags are
    /* 128: See LP_HEADER_FLAG_ constants for possible values. Header flags are
     * independent of the version number and intended to be informational only.
     * independent of the version number and intended to be informational only.
     * New flags can be added without bumping the version.
     * New flags can be added without bumping the version.
     *
     * (Note there are no flags currently defined.)
     */
     */
    uint32_t flags;
    uint32_t flags;


@@ -233,6 +231,11 @@ typedef struct LpMetadataHeader {
    uint8_t reserved[124];
    uint8_t reserved[124];
} __attribute__((packed)) LpMetadataHeader;
} __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
/* This struct defines a logical partition entry, similar to what would be
 * present in a GUID Partition Table.
 * present in a GUID Partition Table.
 */
 */