diff options
| author | Alejandro Sior <aho@sior.be> | 2022-06-21 10:38:45 +0200 |
|---|---|---|
| committer | Alejandro Sior <aho@sior.be> | 2022-06-21 10:38:45 +0200 |
| commit | c99646423f311c9238ace86be17caf531fe61c44 (patch) | |
| tree | b17f04f09ce6eb918e71983c8e7b1589eb0ec87f /header/header.ha | |
| parent | fd2f5a94d6ad595e8bed354eca168a82b882e8b4 (diff) | |
gptman: partition info
Diffstat (limited to 'header/header.ha')
| -rw-r--r-- | header/header.ha | 39 |
1 files changed, 0 insertions, 39 deletions
diff --git a/header/header.ha b/header/header.ha deleted file mode 100644 index 0e93842..0000000 --- a/header/header.ha +++ /dev/null @@ -1,39 +0,0 @@ -use fmt; -use io; - -use gpt; -use volume; - -export fn header(vol: str, args: []str) void = { - const vol = volume::openvol(vol); - const vol = match (gpt::from(vol)) { - case let g: *gpt::gpt => - yield g; - case gpt::nogpt => - fmt::fatalf("gpt.header: disk {} does not have valid gpt", args[0]); - case => - fmt::fatalf("gpt.header: could not access disk {}", args[0]); - }; - defer gpt::finish(vol); - - const header = vol.primary.header; - - fmt::printfln("revision: \t\t{}", header.revision)!; - fmt::printfln("header_size: \t\t{}", header.header_size)!; - fmt::printfln("header_crc32: \t\t{}", header.header_crc32)!; - fmt::printfln("header_lba: \t\t{}", header.header_lba)!; - fmt::printfln("backup_header_lba: \t{}", header.backup_header_lba)!; - fmt::printfln("first_lba: \t\t{}", header.first_lba)!; - fmt::printfln("last_lba: \t\t{}", header.last_lba)!; - fmt::printfln("disk_guid: \t\t[{},{}]", header.disk_guid[0], header.disk_guid[1])!; - fmt::printfln("entries_lba: \t\t{}", header.entries_lba)!; - fmt::printfln("entries_len: \t\t{}", header.entries_len)!; - fmt::printfln("entry_size: \t\t{}", header.entry_size)!; - fmt::printfln("entries_crc32: \t\t{}", header.entries_crc32)!; - - const primary_valid = gpt::header_crc32(header) == header.header_crc32 && gpt::entries_crc32(vol.primary.entries) == header.entries_crc32; - const backup_valid = gpt::header_crc32(vol.backup.header) == vol.backup.header.header_crc32 && gpt::entries_crc32(vol.backup.entries) == vol.backup.header.entries_crc32; - - fmt::printfln("primary_sane: \t\t{}", primary_valid)!; - fmt::printfln("backup_sane: \t\t{}", backup_valid)!; -}; |
