diff options
Diffstat (limited to 'convert/convert.ha')
| -rw-r--r-- | convert/convert.ha | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/convert/convert.ha b/convert/convert.ha new file mode 100644 index 0000000..10f73c7 --- /dev/null +++ b/convert/convert.ha @@ -0,0 +1,33 @@ +use fmt; + +use mbr; +use gpt; +use sector; + +use os; +use io; +use fs; +use strings; +use errors; + + +export fn convert(args: []str) void = { + if (len(args) < 2) { + fmt::fatalf("gptman.convert: needs disk"); + }; + + fmt::println(args[1])!; + let file = os::open(args[1], fs::flags::RDWR)!; + defer io::close(file)!; + + let vol = gpt::from(file)!; + gpt::mkbackup(vol); + defer { + gpt::chksums(vol); + gpt::commit(vol); + gpt::finish(vol); + }; + + vol.primary.header.disk_guid[0] = 0xcafebabe; + vol.primary.header.disk_guid[1] = 0xabababababababab; +}; |
