diff options
author | Nam T. Nguyen <namnguyen@chromium.org> | 2014-08-28 10:58:47 -0700 |
---|---|---|
committer | chrome-internal-fetch <chrome-internal-fetch@google.com> | 2014-08-29 21:56:20 +0000 |
commit | 88458d9b5281aca162821a369707781ac9abb44e (patch) | |
tree | f6cab5e07a797941a52c9e72b75a5665a2a442b0 /firmware | |
parent | c0777be638d0cb69caa4e6a8d1573c78435f1865 (diff) | |
download | vboot-88458d9b5281aca162821a369707781ac9abb44e.tar.gz |
vboot_reference: Rename *_SECTOR to *_SECTORS
This CL renames GPT_PMBR_SECTOR to GPT_PMBR_SECTORS and GPT_HEADER_SECTOR to
GPT_HEADER_SECTORS to better indicate that these are constants for sizes, not
location.
BRANCH=None
BUG=None
TEST=unittest
Change-Id: I26ed6d45d77dcb1eb714135edbb9e4124b54e953
Reviewed-on: https://chromium-review.googlesource.com/214830
Reviewed-by: Bill Richardson <wfrichar@chromium.org>
Tested-by: Nam Nguyen <namnguyen@chromium.org>
Commit-Queue: Nam Nguyen <namnguyen@chromium.org>
Diffstat (limited to 'firmware')
-rw-r--r-- | firmware/lib/cgptlib/cgptlib_internal.c | 12 | ||||
-rw-r--r-- | firmware/lib/cgptlib/include/cgptlib_internal.h | 4 | ||||
-rw-r--r-- | firmware/lib/vboot_kernel.c | 4 |
3 files changed, 10 insertions, 10 deletions
diff --git a/firmware/lib/cgptlib/cgptlib_internal.c b/firmware/lib/cgptlib/cgptlib_internal.c index 510a11fb..38ca7d92 100644 --- a/firmware/lib/cgptlib/cgptlib_internal.c +++ b/firmware/lib/cgptlib/cgptlib_internal.c @@ -88,12 +88,12 @@ int CheckHeader(GptHeader *h, int is_secondary, uint64_t drive_sectors) * secondary is at the end of the drive, preceded by its entries. */ if (is_secondary) { - if (h->my_lba != drive_sectors - GPT_HEADER_SECTOR) + if (h->my_lba != drive_sectors - GPT_HEADER_SECTORS) return 1; if (h->entries_lba != h->my_lba - GPT_ENTRIES_SECTORS) return 1; } else { - if (h->my_lba != GPT_PMBR_SECTOR) + if (h->my_lba != GPT_PMBR_SECTORS) return 1; if (h->entries_lba < h->my_lba + 1) return 1; @@ -296,8 +296,8 @@ void GptRepair(GptData *gpt) if (MASK_PRIMARY == gpt->valid_headers) { /* Primary is good, secondary is bad */ Memcpy(header2, header1, sizeof(GptHeader)); - header2->my_lba = gpt->drive_sectors - GPT_HEADER_SECTOR; - header2->alternate_lba = GPT_PMBR_SECTOR; /* Second sector. */ + header2->my_lba = gpt->drive_sectors - GPT_HEADER_SECTORS; + header2->alternate_lba = GPT_PMBR_SECTORS; /* Second sector. */ header2->entries_lba = header2->my_lba - GPT_ENTRIES_SECTORS; header2->header_crc32 = HeaderCrc(header2); gpt->modified |= GPT_MODIFIED_HEADER2; @@ -305,8 +305,8 @@ void GptRepair(GptData *gpt) else if (MASK_SECONDARY == gpt->valid_headers) { /* Secondary is good, primary is bad */ Memcpy(header1, header2, sizeof(GptHeader)); - header1->my_lba = GPT_PMBR_SECTOR; /* Second sector. */ - header1->alternate_lba = gpt->drive_sectors - GPT_HEADER_SECTOR; + header1->my_lba = GPT_PMBR_SECTORS; /* Second sector. */ + header1->alternate_lba = gpt->drive_sectors - GPT_HEADER_SECTORS; /* TODO (namnguyen): Preserve (header, entries) padding. */ header1->entries_lba = header1->my_lba + 1; header1->header_crc32 = HeaderCrc(header1); diff --git a/firmware/lib/cgptlib/include/cgptlib_internal.h b/firmware/lib/cgptlib/include/cgptlib_internal.h index b2691419..e9e63cad 100644 --- a/firmware/lib/cgptlib/include/cgptlib_internal.h +++ b/firmware/lib/cgptlib/include/cgptlib_internal.h @@ -55,8 +55,8 @@ #define MAX_NUMBER_OF_ENTRIES 512 /* Defines GPT sizes */ -#define GPT_PMBR_SECTOR 1 /* size (in sectors) of PMBR */ -#define GPT_HEADER_SECTOR 1 +#define GPT_PMBR_SECTORS 1 /* size (in sectors) of PMBR */ +#define GPT_HEADER_SECTORS 1 /* * Entries sectors assumes sector size if 512 bytes; then (TOTAL_ENTRIES_SIZE / * 512) = 32 diff --git a/firmware/lib/vboot_kernel.c b/firmware/lib/vboot_kernel.c index 99bf93b3..df32fc08 100644 --- a/firmware/lib/vboot_kernel.c +++ b/firmware/lib/vboot_kernel.c @@ -90,7 +90,7 @@ int WriteAndFreeGptData(VbExDiskHandle_t disk_handle, GptData *gptdata) * TODO(namnguyen): Preserve padding between primary GPT header and * its entries. */ - uint64_t entries_lba = GPT_PMBR_SECTOR + GPT_HEADER_SECTOR; + uint64_t entries_lba = GPT_PMBR_SECTORS + GPT_HEADER_SECTORS; if (gptdata->primary_header) { GptHeader *h = (GptHeader *)(gptdata->primary_header); entries_lba = h->entries_lba; @@ -133,7 +133,7 @@ int WriteAndFreeGptData(VbExDiskHandle_t disk_handle, GptData *gptdata) } entries_lba = (gptdata->drive_sectors - entries_sectors - - GPT_HEADER_SECTOR); + GPT_HEADER_SECTORS); if (gptdata->secondary_header) { GptHeader *h = (GptHeader *)(gptdata->secondary_header); entries_lba = h->entries_lba; |