From fd2f5a94d6ad595e8bed354eca168a82b882e8b4 Mon Sep 17 00:00:00 2001 From: Alejandro Sior Date: Sat, 18 Jun 2022 14:43:46 +0200 Subject: gptman: change the way of how args are passed to subcommands --- convert/convert.ha | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'convert/convert.ha') 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) -- cgit v1.2.3