mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
Successful partitions are never marked bad by cgptlib.
Change-Id: I70e54f59b540e9115bb6bd77ae51f49a1f4ab671 BUG=chromeos-partner:1029 TEST=make && make runtests Review URL: http://codereview.chromium.org/3315014
This commit is contained in:
@@ -129,10 +129,12 @@ int GptUpdateKernelEntry(GptData* gpt, uint32_t update_type) {
|
|||||||
}
|
}
|
||||||
case GPT_UPDATE_ENTRY_BAD: {
|
case GPT_UPDATE_ENTRY_BAD: {
|
||||||
/* Giving up on this partition entirely. */
|
/* Giving up on this partition entirely. */
|
||||||
|
if (!GetEntrySuccessful(e)) {
|
||||||
|
/* Only clear tries and priority if the successful bit is not set. */
|
||||||
e->attrs.fields.gpt_att = previous_attr & ~(
|
e->attrs.fields.gpt_att = previous_attr & ~(
|
||||||
CGPT_ATTRIBUTE_SUCCESSFUL_MASK |
|
|
||||||
CGPT_ATTRIBUTE_TRIES_MASK |
|
CGPT_ATTRIBUTE_TRIES_MASK |
|
||||||
CGPT_ATTRIBUTE_PRIORITY_MASK);
|
CGPT_ATTRIBUTE_PRIORITY_MASK);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -1 +1 @@
|
|||||||
char* VbootVersion = "VBOOv=c4585ee1";
|
char* VbootVersion = "VBOOv=77bb4724";
|
||||||
|
|||||||
@@ -1068,17 +1068,12 @@ static int GptUpdateTest() {
|
|||||||
EXPECT(4 == GetEntryPriority(e + KERNEL_A));
|
EXPECT(4 == GetEntryPriority(e + KERNEL_A));
|
||||||
EXPECT(0 == GetEntryTries(e + KERNEL_A));
|
EXPECT(0 == GetEntryTries(e + KERNEL_A));
|
||||||
EXPECT(0 == gpt->modified);
|
EXPECT(0 == gpt->modified);
|
||||||
/* Marking it bad does, though */
|
/* Marking it bad also does not update it. */
|
||||||
EXPECT(GPT_SUCCESS == GptUpdateKernelEntry(gpt, GPT_UPDATE_ENTRY_BAD));
|
EXPECT(GPT_SUCCESS == GptUpdateKernelEntry(gpt, GPT_UPDATE_ENTRY_BAD));
|
||||||
EXPECT(0 == GetEntrySuccessful(e + KERNEL_A));
|
EXPECT(1 == GetEntrySuccessful(e + KERNEL_A));
|
||||||
EXPECT(0 == GetEntryPriority(e + KERNEL_A));
|
EXPECT(4 == GetEntryPriority(e + KERNEL_A));
|
||||||
EXPECT(0 == GetEntryTries(e + KERNEL_A));
|
EXPECT(0 == GetEntryTries(e + KERNEL_A));
|
||||||
/* Which affects both copies of the partition entries */
|
EXPECT(0 == gpt->modified);
|
||||||
EXPECT(0 == GetEntrySuccessful(e2 + KERNEL_A));
|
|
||||||
EXPECT(0 == GetEntryPriority(e2 + KERNEL_A));
|
|
||||||
EXPECT(0 == GetEntryTries(e2 + KERNEL_A));
|
|
||||||
/* And that's caused the GPT to need updating */
|
|
||||||
EXPECT(0x0F == gpt->modified);
|
|
||||||
|
|
||||||
/* Kernel with tries */
|
/* Kernel with tries */
|
||||||
EXPECT(GPT_SUCCESS == GptNextKernelEntry(gpt, &start, &size));
|
EXPECT(GPT_SUCCESS == GptNextKernelEntry(gpt, &start, &size));
|
||||||
@@ -1091,6 +1086,12 @@ static int GptUpdateTest() {
|
|||||||
EXPECT(0 == GetEntrySuccessful(e + KERNEL_B));
|
EXPECT(0 == GetEntrySuccessful(e + KERNEL_B));
|
||||||
EXPECT(0 == GetEntryPriority(e + KERNEL_B));
|
EXPECT(0 == GetEntryPriority(e + KERNEL_B));
|
||||||
EXPECT(0 == GetEntryTries(e + KERNEL_B));
|
EXPECT(0 == GetEntryTries(e + KERNEL_B));
|
||||||
|
/* Which affects both copies of the partition entries */
|
||||||
|
EXPECT(0 == GetEntrySuccessful(e2 + KERNEL_B));
|
||||||
|
EXPECT(0 == GetEntryPriority(e2 + KERNEL_B));
|
||||||
|
EXPECT(0 == GetEntryTries(e2 + KERNEL_B));
|
||||||
|
/* And that's caused the GPT to need updating */
|
||||||
|
EXPECT(0x0F == gpt->modified);
|
||||||
|
|
||||||
/* Another kernel with tries */
|
/* Another kernel with tries */
|
||||||
EXPECT(GPT_SUCCESS == GptNextKernelEntry(gpt, &start, &size));
|
EXPECT(GPT_SUCCESS == GptNextKernelEntry(gpt, &start, &size));
|
||||||
|
|||||||
Reference in New Issue
Block a user