Better naming
This commit is contained in:
parent
c84535962f
commit
0156567918
2 changed files with 8 additions and 9 deletions
12
bin/main.ml
12
bin/main.ml
|
@ -1,6 +1,6 @@
|
||||||
let hex_dump file =
|
let query_manifest file =
|
||||||
Owee_buf.map_binary file
|
Owee_buf.map_binary file
|
||||||
|> Solo5_elftool.foo
|
|> Solo5_elftool.query_manifest
|
||||||
|> Result.iter (fun mft ->
|
|> Result.iter (fun mft ->
|
||||||
Fmt.pr "%a\n" Solo5_elftool.pp_mft mft)
|
Fmt.pr "%a\n" Solo5_elftool.pp_mft mft)
|
||||||
|
|
||||||
|
@ -9,11 +9,11 @@ let file =
|
||||||
Cmdliner.Arg.(required & pos 0 (some file) None &
|
Cmdliner.Arg.(required & pos 0 (some file) None &
|
||||||
info ~doc ~docv:"EXECUTABLE" [])
|
info ~doc ~docv:"EXECUTABLE" [])
|
||||||
|
|
||||||
let hex_dump_cmd =
|
let query_manifest_cmd =
|
||||||
let doc = "hexdump solo5 manifest" in
|
let doc = "query solo5 manifest" in
|
||||||
Cmdliner.Term.(
|
Cmdliner.Term.(
|
||||||
pure hex_dump $ file,
|
pure query_manifest $ file,
|
||||||
info ~doc "query-manifest")
|
info ~doc "query-manifest")
|
||||||
|
|
||||||
let () =
|
let () =
|
||||||
ignore (Cmdliner.Term.eval hex_dump_cmd)
|
ignore (Cmdliner.Term.eval query_manifest_cmd)
|
||||||
|
|
|
@ -77,7 +77,6 @@ let parse_mft buf =
|
||||||
in
|
in
|
||||||
assert (version = 1l);
|
assert (version = 1l);
|
||||||
let buf = Cstruct.shift buf 8 in
|
let buf = Cstruct.shift buf 8 in
|
||||||
Printf.printf "MFT%ld[%ld]\n" version entries;
|
|
||||||
let entries =
|
let entries =
|
||||||
Array.init (Int32.unsigned_to_int entries |> Option.get (* XXX: assume 64 bit *))
|
Array.init (Int32.unsigned_to_int entries |> Option.get (* XXX: assume 64 bit *))
|
||||||
(fun i -> parse_mft_entry (Cstruct.sub buf (i * sizeof_mft_entry) sizeof_mft_entry))
|
(fun i -> parse_mft_entry (Cstruct.sub buf (i * sizeof_mft_entry) sizeof_mft_entry))
|
||||||
|
@ -89,7 +88,7 @@ let ( let* ) = Result.bind
|
||||||
let mft_max_entries = 64
|
let mft_max_entries = 64
|
||||||
let mft1_note_name = "Solo5"
|
let mft1_note_name = "Solo5"
|
||||||
|
|
||||||
let foo buf =
|
let query_manifest buf =
|
||||||
let _header, sections = Owee_elf.read_elf buf in
|
let _header, sections = Owee_elf.read_elf buf in
|
||||||
let* section =
|
let* section =
|
||||||
Owee_elf.find_section sections ".note.solo5.manifest"
|
Owee_elf.find_section sections ".note.solo5.manifest"
|
||||||
|
@ -100,7 +99,7 @@ let foo buf =
|
||||||
let descsz =
|
let descsz =
|
||||||
Owee_elf_notes.read_desc_size cursor
|
Owee_elf_notes.read_desc_size cursor
|
||||||
~expected_owner:mft1_note_name
|
~expected_owner:mft1_note_name
|
||||||
~expected_type:0x3154464d
|
~expected_type:0x3154464d (* MFT1 *)
|
||||||
in
|
in
|
||||||
let desc = Owee_buf.Read.fixed_string cursor descsz in
|
let desc = Owee_buf.Read.fixed_string cursor descsz in
|
||||||
assert (Owee_buf.at_end cursor);
|
assert (Owee_buf.at_end cursor);
|
||||||
|
|
Loading…
Reference in a new issue