summaryrefslogtreecommitdiff
path: root/cgpt/cmd_show.c
diff options
context:
space:
mode:
authorvbendeb <vbendeb@chromium.org>2010-06-21 08:44:16 -0700
committervbendeb <vbendeb@chromium.org>2010-06-21 08:44:16 -0700
commitf7a45cc01d7e4056482b2cdc23080bfabbbffc76 (patch)
tree15e826191fb3359c621903be6dd5405c90199c04 /cgpt/cmd_show.c
parent6216f5abe9901e9c47789d55ae90243c6cc50aeb (diff)
downloadvboot-f7a45cc01d7e4056482b2cdc23080bfabbbffc76.tar.gz
Reduce attributes size to comply with msc limitations.
It turned out that shared verified boot library fails to work properly when compiled by msc in BIOS environment. The culprit was identified as failing 64 bit logical operations by preprocessor. It is probably possible to come up with a certain compile flag set to fix the operations, but it is not easy to modify and control the BIOS compilation environment. The alternative solution is to limit the size of the field in question to 16 bits (especially since this is the only part of the attributes field which is supposed to be altered by firmware. A union is being introduced in firmware/lib/cgptlib/include/gpt.h:GptEntry to allow accessing the field both as a 64 bit entity and a top 16 bit field. All places where this field is used are being modified appropriately. tests/Makefile is being fixed to allow controlling test run from the top level directory. Tested by building everything and running tests. All tests pass. Review URL: http://codereview.chromium.org/2799019
Diffstat (limited to 'cgpt/cmd_show.c')
-rw-r--r--cgpt/cmd_show.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/cgpt/cmd_show.c b/cgpt/cmd_show.c
index 91461490..6ab537dc 100644
--- a/cgpt/cmd_show.c
+++ b/cgpt/cmd_show.c
@@ -132,12 +132,15 @@ void EntryDetails(GptEntry *entry, int index, int raw) {
GuidToStr(&entry->unique, unique);
printf(PARTITION_MORE, "UUID: ", unique);
if (!memcmp(&guid_chromeos_kernel, &entry->type, sizeof(Guid))) {
- int tries = (entry->attributes & CGPT_ATTRIBUTE_TRIES_MASK) >>
- CGPT_ATTRIBUTE_TRIES_OFFSET;
- int successful = (entry->attributes & CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >>
- CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET;
- int priority = (entry->attributes & CGPT_ATTRIBUTE_PRIORITY_MASK) >>
- CGPT_ATTRIBUTE_PRIORITY_OFFSET;
+ int tries = (entry->attrs.fields.gpt_att &
+ CGPT_ATTRIBUTE_TRIES_MASK) >>
+ CGPT_ATTRIBUTE_TRIES_OFFSET;
+ int successful = (entry->attrs.fields.gpt_att &
+ CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >>
+ CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET;
+ int priority = (entry->attrs.fields.gpt_att &
+ CGPT_ATTRIBUTE_PRIORITY_MASK) >>
+ CGPT_ATTRIBUTE_PRIORITY_OFFSET;
snprintf(contents, sizeof(contents),
"priority=%d tries=%d successful=%d",
priority, tries, successful);
@@ -155,7 +158,7 @@ void EntryDetails(GptEntry *entry, int index, int raw) {
printf(PARTITION_MORE, "Type: ", type);
GuidToStr(&entry->unique, unique);
printf(PARTITION_MORE, "UUID: ", unique);
- snprintf(contents, sizeof(contents), "[%" PRIx64 "]", entry->attributes);
+ snprintf(contents, sizeof(contents), "[%x]", entry->attrs.fields.gpt_att);
printf(PARTITION_MORE, "Attr: ", contents);
}
}
@@ -299,7 +302,7 @@ int cmd_show(int argc, char *argv[]) {
printf("%d\n", GetPriority(&drive.gpt, PRIMARY, index));
break;
case 'A':
- printf("0x%" PRIx64 "\n", entry->attributes);
+ printf("0x%x\n", entry->attrs.fields.gpt_att);
break;
}
} else {