aboutsummaryrefslogtreecommitdiffstats
path: root/src/header.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/header.c')
-rw-r--r--src/header.c32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/header.c b/src/header.c
index 22c255c..e4a7e15 100644
--- a/src/header.c
+++ b/src/header.c
@@ -195,3 +195,35 @@ headers_get (DISK * d)
return ret;
}
+
+GPT_headers
+headers_get_one (DISK * d)
+{
+ GPT_headers ret;
+ uint8_t buf[512];
+ uint64_t lbas;
+ int table_size;
+
+
+
+ lbas = disk_lbas (d);
+
+ disk_read (d, buf, 1, 1);
+ memcpy (&ret.header, buf, sizeof (ret.header));
+
+ table_size=ret.header.first_usable_lba;
+
+ ret.header.last_usable_lba=lbas-table_size;
+
+ ret.alt_header=ret.header;
+
+ ret.header.alternate_lba=lbas-1;
+
+ ret.alt_header.alternate_lba=1;
+ ret.alt_header.my_lba=lbas-1;
+ ret.alt_header.partition_entry_lba = (lbas - table_size)+1;
+
+
+
+ return ret;
+}