diff options
author | Ben Chan <benchan@chromium.org> | 2018-01-31 11:39:14 -0800 |
---|---|---|
committer | chrome-bot <chrome-bot@chromium.org> | 2018-02-06 18:18:35 -0800 |
commit | a4a8c02ad5988bd4b6fd85f6e09e9e0e79d18feb (patch) | |
tree | a1cc5fb4923c3d5a990fb486debc7cb2fe261f04 /cgpt/cgpt_common.c | |
parent | 3585eb3d21da676db3d87e9e0490a0df92d597d2 (diff) | |
download | vboot-a4a8c02ad5988bd4b6fd85f6e09e9e0e79d18feb.tar.gz |
cgpt: add support for managing GPT platform required partition bit
Bit 0 in the GPT partition attributes is defined to indicate whether a
partition is required by the platform. This CL adds the support for
managing this bit to cgpt.
BUG=b:70807006
BRANCH=None
TEST=Run unit tests.
Change-Id: Iaf87c828438b3df6730de502ae420fcf4c61277b
Reviewed-on: https://chromium-review.googlesource.com/902196
Commit-Ready: Ben Chan <benchan@chromium.org>
Tested-by: Ben Chan <benchan@chromium.org>
Reviewed-by: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'cgpt/cgpt_common.c')
-rw-r--r-- | cgpt/cgpt_common.c | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/cgpt/cgpt_common.c b/cgpt/cgpt_common.c index 1a6bd3cb..f6108c1e 100644 --- a/cgpt/cgpt_common.c +++ b/cgpt/cgpt_common.c @@ -763,6 +763,20 @@ GptEntry *GetEntry(GptData *gpt, int secondary, uint32_t entry_index) { return (GptEntry*)(&entries[stride * entry_index]); } +void SetRequired(struct drive *drive, int secondary, uint32_t entry_index, + int required) { + require(required >= 0 && required <= CGPT_ATTRIBUTE_MAX_REQUIRED); + GptEntry *entry; + entry = GetEntry(&drive->gpt, secondary, entry_index); + SetEntryRequired(entry, required); +} + +int GetRequired(struct drive *drive, int secondary, uint32_t entry_index) { + GptEntry *entry; + entry = GetEntry(&drive->gpt, secondary, entry_index); + return GetEntryRequired(entry); +} + void SetLegacyBoot(struct drive *drive, int secondary, uint32_t entry_index, int legacy_boot) { require(legacy_boot >= 0 && legacy_boot <= CGPT_ATTRIBUTE_MAX_LEGACY_BOOT); |