mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-11-24 02:05:01 +00:00
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:
@@ -63,10 +63,9 @@
|
||||
|
||||
|
||||
typedef struct {
|
||||
uint32_t starting_lba;
|
||||
uint32_t ending_lba;
|
||||
uint64_t starting_offset;
|
||||
uint64_t ending_offset;
|
||||
uint32_t flags;
|
||||
uint32_t reserved;
|
||||
} __attribute__((packed)) MtdDiskPartition;
|
||||
|
||||
typedef struct {
|
||||
@@ -77,15 +76,15 @@ typedef struct {
|
||||
*/
|
||||
uint32_t crc32;
|
||||
uint32_t size;
|
||||
uint32_t first_lba;
|
||||
uint32_t last_lba;
|
||||
uint64_t first_offset;
|
||||
uint64_t last_offset;
|
||||
MtdDiskPartition partitions[MTD_MAX_PARTITIONS];
|
||||
} __attribute__((packed)) MtdDiskLayout;
|
||||
|
||||
#define MTD_DRIVE_V1_SIZE (24 + 16*16)
|
||||
#define MTD_DRIVE_V1_SIZE (32 + 16*20)
|
||||
|
||||
#define MTDENTRY_EXPECTED_SIZE (16)
|
||||
#define MTDLAYOUT_EXPECTED_SIZE (24 + 16 * MTDENTRY_EXPECTED_SIZE)
|
||||
#define MTDENTRY_EXPECTED_SIZE (20)
|
||||
#define MTDLAYOUT_EXPECTED_SIZE (32 + 16 * MTDENTRY_EXPECTED_SIZE)
|
||||
|
||||
|
||||
typedef struct {
|
||||
@@ -135,6 +134,12 @@ void MtdSetEntryPriority(MtdDiskPartition *e, int priority);
|
||||
void MtdSetEntryTries(MtdDiskPartition *e, int tries);
|
||||
void MtdSetEntryType(MtdDiskPartition *e, int type);
|
||||
|
||||
void MtdGetPartitionSize(const MtdDiskPartition *e,
|
||||
uint64_t *start, uint64_t *end, uint64_t *size);
|
||||
|
||||
void MtdGetPartitionSizeInSectors(const MtdDiskPartition *e, uint64_t *start,
|
||||
uint64_t *end, uint64_t *size);
|
||||
|
||||
void MtdModified(MtdData *mtd);
|
||||
int MtdGptInit(MtdData *mtd);
|
||||
int MtdIsPartitionValid(const MtdDiskPartition *part);
|
||||
|
||||
Reference in New Issue
Block a user