aboutsummaryrefslogtreecommitdiffstats
path: root/src/fixup.c
diff options
context:
space:
mode:
authorjames <james>2011-08-07 11:33:43 +0000
committerjames <james>2011-08-07 11:33:43 +0000
commit5eca00f7b8db381ce2584736e3589bec47e1d46f (patch)
tree6fbe1673e67e5759be56b4d8b263d0a5a4075e44 /src/fixup.c
parente2d7e909efa62075d6322df2427b03f4d2ba7024 (diff)
downloadgpt-5eca00f7b8db381ce2584736e3589bec47e1d46f.tar.gz
gpt-5eca00f7b8db381ce2584736e3589bec47e1d46f.tar.bz2
gpt-5eca00f7b8db381ce2584736e3589bec47e1d46f.zip
add support for repairing half a table
Diffstat (limited to 'src/fixup.c')
-rw-r--r--src/fixup.c38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/fixup.c b/src/fixup.c
new file mode 100644
index 0000000..af7b6d6
--- /dev/null
+++ b/src/fixup.c
@@ -0,0 +1,38 @@
+#include "project.h"
+
+
+
+int
+fixup (DISK * d)
+{
+ GPT_headers h;
+ int i;
+
+ h = headers_get_one (d);
+
+
+
+
+ for (i = 0; i < h.header.n_partition_entries; ++i)
+ {
+
+
+ GPT_entry e = entry_read (d, &h.header, i);
+
+
+ entry_write (d, &h.header, i, &e);
+
+ entry_write (d, &h.alt_header, i, &e);
+ }
+
+
+ header_redo_ent_crc (d, &h.header);
+ header_write (d, &h.header);
+
+ header_redo_ent_crc (d, &h.alt_header);
+ header_write (d, &h.alt_header);
+
+
+
+ return 0;
+}