Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(173)

Side by Side Diff: cgpt/cgpt_common.c

Issue 2799019: Modify the size of the attributes field to comply with msc limitations. (Closed) Base URL: ssh://git@chromiumos-git/vboot_reference.git
Patch Set: Fix the attribute field to allow compilation in the BIOS environment. Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | cgpt/cmd_add.c » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved. 1 /* Copyright (c) 2010 The Chromium OS Authors. All rights reserved.
2 * Use of this source code is governed by a BSD-style license that can be 2 * Use of this source code is governed by a BSD-style license that can be
3 * found in the LICENSE file. 3 * found in the LICENSE file.
4 * 4 *
5 * Utility for ChromeOS-specific GPT partitions, Please see corresponding .c 5 * Utility for ChromeOS-specific GPT partitions, Please see corresponding .c
6 * files for more details. 6 * files for more details.
7 */ 7 */
8 8
9 #include "cgpt.h" 9 #include "cgpt.h"
10 10
(...skipping 504 matching lines...) Expand 10 before | Expand all | Expand 10 after
515 } 515 }
516 516
517 return (GptEntry*)(&entries[stride * entry_index]); 517 return (GptEntry*)(&entries[stride * entry_index]);
518 } 518 }
519 519
520 void SetPriority(GptData *gpt, int secondary, int entry_index, int priority) { 520 void SetPriority(GptData *gpt, int secondary, int entry_index, int priority) {
521 GptEntry *entry; 521 GptEntry *entry;
522 entry = GetEntry(gpt, secondary, entry_index); 522 entry = GetEntry(gpt, secondary, entry_index);
523 523
524 assert(priority >= 0 && priority <= CGPT_ATTRIBUTE_MAX_PRIORITY); 524 assert(priority >= 0 && priority <= CGPT_ATTRIBUTE_MAX_PRIORITY);
525 entry->attributes &= ~CGPT_ATTRIBUTE_PRIORITY_MASK; 525 entry->attrs.fields.gpt_att &= ~CGPT_ATTRIBUTE_PRIORITY_MASK;
526 entry->attributes |= (uint64_t)priority << CGPT_ATTRIBUTE_PRIORITY_OFFSET; 526 entry->attrs.fields.gpt_att |= priority << CGPT_ATTRIBUTE_PRIORITY_OFFSET;
527 } 527 }
528 528
529 int GetPriority(GptData *gpt, int secondary, int entry_index) { 529 int GetPriority(GptData *gpt, int secondary, int entry_index) {
530 GptEntry *entry; 530 GptEntry *entry;
531 entry = GetEntry(gpt, secondary, entry_index); 531 entry = GetEntry(gpt, secondary, entry_index);
532 return (entry->attributes & CGPT_ATTRIBUTE_PRIORITY_MASK) >> 532 return (entry->attrs.fields.gpt_att & CGPT_ATTRIBUTE_PRIORITY_MASK) >>
533 CGPT_ATTRIBUTE_PRIORITY_OFFSET; 533 CGPT_ATTRIBUTE_PRIORITY_OFFSET;
534 } 534 }
535 535
536 void SetTries(GptData *gpt, int secondary, int entry_index, int tries) { 536 void SetTries(GptData *gpt, int secondary, int entry_index, int tries) {
537 GptEntry *entry; 537 GptEntry *entry;
538 entry = GetEntry(gpt, secondary, entry_index); 538 entry = GetEntry(gpt, secondary, entry_index);
539 539
540 assert(tries >= 0 && tries <= CGPT_ATTRIBUTE_MAX_TRIES); 540 assert(tries >= 0 && tries <= CGPT_ATTRIBUTE_MAX_TRIES);
541 entry->attributes &= ~CGPT_ATTRIBUTE_TRIES_MASK; 541 entry->attrs.fields.gpt_att &= ~CGPT_ATTRIBUTE_TRIES_MASK;
542 entry->attributes |= (uint64_t)tries << CGPT_ATTRIBUTE_TRIES_OFFSET; 542 entry->attrs.fields.gpt_att |= tries << CGPT_ATTRIBUTE_TRIES_OFFSET;
543 } 543 }
544 544
545 int GetTries(GptData *gpt, int secondary, int entry_index) { 545 int GetTries(GptData *gpt, int secondary, int entry_index) {
546 GptEntry *entry; 546 GptEntry *entry;
547 entry = GetEntry(gpt, secondary, entry_index); 547 entry = GetEntry(gpt, secondary, entry_index);
548 return (entry->attributes & CGPT_ATTRIBUTE_TRIES_MASK) >> 548 return (entry->attrs.fields.gpt_att & CGPT_ATTRIBUTE_TRIES_MASK) >>
549 CGPT_ATTRIBUTE_TRIES_OFFSET; 549 CGPT_ATTRIBUTE_TRIES_OFFSET;
550 } 550 }
551 551
552 void SetSuccessful(GptData *gpt, int secondary, int entry_index, int success) { 552 void SetSuccessful(GptData *gpt, int secondary, int entry_index, int success) {
553 GptEntry *entry; 553 GptEntry *entry;
554 entry = GetEntry(gpt, secondary, entry_index); 554 entry = GetEntry(gpt, secondary, entry_index);
555 555
556 assert(success >= 0 && success <= CGPT_ATTRIBUTE_MAX_SUCCESSFUL); 556 assert(success >= 0 && success <= CGPT_ATTRIBUTE_MAX_SUCCESSFUL);
557 entry->attributes &= ~CGPT_ATTRIBUTE_SUCCESSFUL_MASK; 557 entry->attrs.fields.gpt_att &= ~CGPT_ATTRIBUTE_SUCCESSFUL_MASK;
558 entry->attributes |= (uint64_t)success << CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET; 558 entry->attrs.fields.gpt_att |= success << CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET;
559 } 559 }
560 560
561 int GetSuccessful(GptData *gpt, int secondary, int entry_index) { 561 int GetSuccessful(GptData *gpt, int secondary, int entry_index) {
562 GptEntry *entry; 562 GptEntry *entry;
563 entry = GetEntry(gpt, secondary, entry_index); 563 entry = GetEntry(gpt, secondary, entry_index);
564 return (entry->attributes & CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >> 564 return (entry->attrs.fields.gpt_att & CGPT_ATTRIBUTE_SUCCESSFUL_MASK) >>
565 CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET; 565 CGPT_ATTRIBUTE_SUCCESSFUL_OFFSET;
566 } 566 }
567 567
568 568
569 #define TOSTRING(A) #A 569 #define TOSTRING(A) #A
570 const char *GptError(int errnum) { 570 const char *GptError(int errnum) {
571 const char *error_string[] = { 571 const char *error_string[] = {
572 TOSTRING(GPT_SUCCESS), 572 TOSTRING(GPT_SUCCESS),
573 TOSTRING(GPT_ERROR_NO_VALID_KERNEL), 573 TOSTRING(GPT_ERROR_NO_VALID_KERNEL),
574 TOSTRING(GPT_ERROR_INVALID_HEADERS), 574 TOSTRING(GPT_ERROR_INVALID_HEADERS),
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
717 void PMBRToStr(struct pmbr *pmbr, char *str) { 717 void PMBRToStr(struct pmbr *pmbr, char *str) {
718 char buf[256]; 718 char buf[256];
719 if (IsZero(&pmbr->boot_guid)) { 719 if (IsZero(&pmbr->boot_guid)) {
720 sprintf(str, "PMBR"); 720 sprintf(str, "PMBR");
721 } else { 721 } else {
722 GuidToStr(&pmbr->boot_guid, buf); 722 GuidToStr(&pmbr->boot_guid, buf);
723 sprintf(str, "PMBR (Boot GUID: %s)", buf); 723 sprintf(str, "PMBR (Boot GUID: %s)", buf);
724 } 724 }
725 } 725 }
726 726
OLDNEW
« no previous file with comments | « no previous file | cgpt/cmd_add.c » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698