summaryrefslogtreecommitdiff
path: root/convert/convert.ha
blob: 10f73c7dd9a71a7f290f63d6a27774957556a1f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
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;
};