summaryrefslogtreecommitdiff
path: root/convert
diff options
context:
space:
mode:
Diffstat (limited to 'convert')
-rw-r--r--convert/convert.ha9
1 files changed, 6 insertions, 3 deletions
diff --git a/convert/convert.ha b/convert/convert.ha
index 5404bd8..dbf4ef4 100644
--- a/convert/convert.ha
+++ b/convert/convert.ha
@@ -11,10 +11,11 @@ use strings;
use errors;
use rt;
+use volume;
-export fn convert(vol: io::file, args: []str) void = {
+export fn convert(vol: str, args: []str) void = {
if (len(args) < 2) {
- fmt::fatalf("gptman.convert: needs disk");
+ fmt::fatalf("convert: needs disk");
};
let source = os::open(args[1], fs::flags::RDONLY)!;
@@ -22,13 +23,15 @@ export fn convert(vol: io::file, args: []str) void = {
const source = mbr::from(source)!;
+ const vol = volume::openvol(vol);
let vol = gpt::from(vol)!;
defer {
gpt::chksums(vol);
gpt::commit(vol)!;
gpt::finish(vol);
};
-
+
+ rt::memcpy(vol.mbr, source.bootsector, size(mbr::bootsector));
for (let i = 0z; i < 4; i += 1) {
const entry = &source.bootsector.entries[i];
if (entry.lba_begin == 0 && entry.length == 0)