aboutsummaryrefslogtreecommitdiffstats
path: root/src/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/header.c')
-rw-r--r--src/header.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/src/header.c b/src/header.c
new file mode 100644
index 0000000..d577837
--- /dev/null
+++ b/src/header.c
@@ -0,0 +1,36 @@
+#include "project.h"
+
+void header_print(uint8_t *buf)
+{
+GPT_header *h=(GPT_header *) buf;
+
+
+printf ("Signature %c%c%c%c%c%c%c%c\n",
+ h->signature[0],
+ h->signature[1],
+ h->signature[2],
+ h->signature[3],
+ h->signature[4],
+ h->signature[5],
+ h->signature[6],
+ h->signature[7]);
+
+printf("rev=0x%08x header_size=%d header_crc=0x%08x\n",
+ h->revision,h->header_size,h->header_crc);
+printf("my_lba=%lld alternate_lba=%lld first_lba=%lld last_lba=%lld\n",
+ (long long) h->my_lba, (long long) h->alternate_lba,
+ (long long) h->first_usable_lba,(long long) h->last_usable_lba);
+
+printf("guid=%s\n",guid_to_a(h->disk_guid));
+printf("partition_entry_lba=%lld n_entries=%d ent_size=%d ents_crc=%08x\n",
+ (long long) h->partition_entry_lba, h->n_partition_entries,
+ h->partition_entry_size,h->partition_entry_crc);
+
+printf("%x\n",crc32(0,buf,92));
+h->header_crc=0;
+printf("%x\n",crc32(0,buf,92));
+h->partition_entry_crc=0;
+printf("%x\n",crc32(0,buf,92));
+
+}
+