diff options
Diffstat (limited to 'src/header.c')
-rw-r--r-- | src/header.c | 57 |
1 files changed, 31 insertions, 26 deletions
diff --git a/src/header.c b/src/header.c index e92fd5d..4e68934 100644 --- a/src/header.c +++ b/src/header.c @@ -59,7 +59,7 @@ header_calc_ent_crc (DISK * d, GPT_header * h) for (i = 0; i < h->n_partition_entries; ++i) { - e=entry_read(d,h,i); + e = entry_read (d, h, i); crc = crc32 (crc, &e, h->partition_entry_size); } @@ -68,46 +68,51 @@ header_calc_ent_crc (DISK * d, GPT_header * h) void -header_show (DISK *d,GPT_header *h) +header_show (DISK * d, GPT_header * h) { - GPT_header c=*h; + GPT_header c = *h; uint32_t crc; int i; - if (h->my_lba<h->alternate_lba) { - printf(" GPT:\n"); - } else { - printf(" ALTERNATE GPT:\n"); - } + if (h->my_lba < h->alternate_lba) + { + printf (" GPT:\n"); + } + else + { + printf (" ALTERNATE GPT:\n"); + } - c.header_crc=0; - crc=crc32(0,&c,sizeof(c)); + c.header_crc = 0; + crc = crc32 (0, &c, sizeof (c)); + + printf (" Signature %s, CRC %s\n", + (memcmp (h->signature, GPT_HEADER_SIGNATURE, sizeof (h->signature))) + ? "INVALID" : "valid", + (crc == h->header_crc) ? "matches" : "DOES NOT MATCH"); - printf(" Signature %s, CRC %s\n", - (memcmp(h->signature, GPT_HEADER_SIGNATURE,sizeof(h->signature))) ? "INVALID":"valid", - (crc==h->header_crc) ?"matches":"DOES NOT MATCH"); - printf (" rev=0x%08x lba=%lld alternate=%lld\n", - h->revision, - (long long) h->my_lba, (long long) h->alternate_lba); + h->revision, (long long) h->my_lba, (long long) h->alternate_lba); printf (" usable lbas %lld-%lld\n", (long long) h->first_usable_lba, (long long) h->last_usable_lba); printf (" DISK GUID: %s\n", guid_to_a (h->disk_guid)); - crc=header_calc_ent_crc(d,h); + crc = header_calc_ent_crc (d, h); printf (" patitions (at lba %lld) CRC %s:\n", (long long) h->partition_entry_lba, - (crc == h->partition_entry_crc) ? "matches":"DOES NOT MATCH"); - - for (i=0;i<h->n_partition_entries;++i) { - GPT_entry e=entry_read(d,h,i); - if (!entry_empty(&e)) { - printf(" %d:\n",i); - entry_show(&e); - } - } + (crc == h->partition_entry_crc) ? "matches" : "DOES NOT MATCH"); + + for (i = 0; i < h->n_partition_entries; ++i) + { + GPT_entry e = entry_read (d, h, i); + if (!entry_empty (&e)) + { + printf (" %d:\n", i); + entry_show (&e); + } + } } |