Port MTD structures to use 64-bit byte offsets instead of sectors.

As per the discussion on issue 221745 we will be using 64-bit byte offsets
for the MTD partition table and converting to/from sectors internally in cgpt.
Existing interfaces do not change, eg sizes are still reported in sectors, only
the on-disk representation is affected.

BRANCH=none
BUG=chromium:221745
TEST=unit tests pass

Change-Id: Id312d42783acfdabe6eb8aea11dcbd298e00a100
Reviewed-on: https://gerrit.chromium.org/gerrit/60919
Commit-Queue: Albert Chaulk <achaulk@chromium.org>
Reviewed-by: Albert Chaulk <achaulk@chromium.org>
Tested-by: Albert Chaulk <achaulk@chromium.org>
This commit is contained in:
Albert Chaulk
2013-06-25 11:30:46 -07:00
committed by ChromeBot
parent 7d401c5cd5
commit 289b604f61
7 changed files with 119 additions and 75 deletions

View File

@@ -60,8 +60,8 @@ int MtdCreate(struct drive *drive, CgptCreateParams *params) {
// Prep basic parameters
memcpy(h->signature, MTD_DRIVE_SIGNATURE, sizeof(h->signature));
h->size = sizeof(*h);
h->first_lba = 0;
h->last_lba = drive->mtd.drive_sectors - 1;
h->first_offset = 0;
h->last_offset = (drive->mtd.drive_sectors * drive->mtd.sector_bytes) - 1;
h->crc32 = MtdHeaderCrc(h);
}