summaryrefslogtreecommitdiff
path: root/cgpt
diff options
context:
space:
mode:
authorMike Frysinger <vapier@chromium.org>2019-08-29 00:43:51 -0400
committerCommit Bot <commit-bot@chromium.org>2019-09-01 20:03:45 +0000
commit54b83adf45d2b2433084b8ee1785a80c5a13e2dd (patch)
tree379709baf75b30cdf93612c042536b3c8a655d6f /cgpt
parentb90e507556283b02b5dffb7191cb99ea22dea087 (diff)
downloadvboot-54b83adf45d2b2433084b8ee1785a80c5a13e2dd.tar.gz
cgpt: show: dump drive details in verbose/debug mode
The drive details are the only place where block sizes are tracked, so make sure we display them so the user knows the bytes-per-block. Might as well dump all the other drive details while we're here. BUG=None TEST=CQ passes BRANCH=None Change-Id: I2f2546feec2d58a295ce69c2bfe89a5ecf392f46 Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/vboot_reference/+/1773966 Reviewed-by: Julius Werner <jwerner@chromium.org> Tested-by: Mike Frysinger <vapier@chromium.org> Commit-Queue: Mike Frysinger <vapier@chromium.org>
Diffstat (limited to 'cgpt')
-rw-r--r--cgpt/cgpt_show.c19
1 files changed, 18 insertions, 1 deletions
diff --git a/cgpt/cgpt_show.c b/cgpt/cgpt_show.c
index af4d88fa..0a956130 100644
--- a/cgpt/cgpt_show.c
+++ b/cgpt/cgpt_show.c
@@ -73,7 +73,7 @@ static void HeaderDetails(GptHeader *header, GptEntry *entries,
PrintSignature(indent, header->signature, sizeof(header->signature), raw);
printf("%sRev: 0x%08x\n", indent, header->revision);
- printf("%sSize: %d\n", indent, header->size);
+ printf("%sSize: %d (blocks)\n", indent, header->size);
printf("%sHeader CRC: 0x%08x %s\n", indent, header->header_crc32,
(HeaderCrc(header) != header->header_crc32) ? "(INVALID)" : "");
printf("%sMy LBA: %lld\n", indent, (long long)header->my_lba);
@@ -269,6 +269,23 @@ static int GptShow(struct drive *drive, CgptShowParams *params) {
} else { // show all partitions
GptEntry *entries;
+ if (params->debug || params->verbose) {
+ printf("Drive details:\n");
+ printf(" Total Size (bytes): %" PRIu64 "\n", drive->size);
+ printf(" LBA Size (bytes): %d\n", drive->gpt.sector_bytes);
+ if (drive->gpt.flags & GPT_FLAG_EXTERNAL) {
+ printf(" Drive (where GPT lives) Size (blocks): %" PRIu64 "\n",
+ drive->gpt.gpt_drive_sectors);
+ printf(" Drive (where partitions live) Size (blocks): %" PRIu64 "\n",
+ drive->gpt.streaming_drive_sectors);
+ } else {
+ // We know gpt_drive_sectors == streaming_drive_sectors here.
+ printf(" Drive Size (blocks): %" PRIu64 "\n",
+ drive->gpt.gpt_drive_sectors);
+ }
+ printf("\n");
+ }
+
if (CGPT_OK != ReadPMBR(drive)) {
Error("Unable to read PMBR\n");
return CGPT_FAILED;