From 5eca00f7b8db381ce2584736e3589bec47e1d46f Mon Sep 17 00:00:00 2001 From: james Date: Sun, 7 Aug 2011 11:33:43 +0000 Subject: add support for repairing half a table --- src/header.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) (limited to 'src/header.c') diff --git a/src/header.c b/src/header.c index 22c255c..e4a7e15 100644 --- a/src/header.c +++ b/src/header.c @@ -193,5 +193,37 @@ headers_get (DISK * d) memcpy (&ret.alt_header, buf, sizeof (ret.alt_header)); + 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; } -- cgit v1.2.3