mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
daemon/inspect_fs_windows.ml: Add debugging for MBR drive mappings
The function 'map_registry_disk_blob_gpt' immediately below this one has a debugging statement. Add the equivalent to the function 'map_registry_disk_blob_mbr'. The output looks like: map_registry_disk_blob_mbr: searching for MBR disk ID 31 32 33 34 map_registry_disk_blob_mbr: searching for MBR partition offset 00 00 00 10 00 00 00 00
This commit is contained in:
@@ -376,6 +376,10 @@ and map_registry_disk_blob_mbr devices blob =
|
||||
* disk with this disk ID.
|
||||
*)
|
||||
let diskid = String.sub blob 0 4 in
|
||||
if verbose () then
|
||||
eprintf "map_registry_disk_blob_mbr: searching for MBR disk ID %s\n%!"
|
||||
(hex_of_string diskid);
|
||||
|
||||
let device =
|
||||
List.find (
|
||||
fun dev ->
|
||||
@@ -388,6 +392,10 @@ and map_registry_disk_blob_mbr devices blob =
|
||||
* partition byte offset from Parted.part_list.
|
||||
*)
|
||||
let offset = String.sub blob 4 8 in
|
||||
if verbose () then
|
||||
eprintf "map_registry_disk_blob_mbr: searching for MBR partition offset \
|
||||
%s\n%!"
|
||||
(hex_of_string offset);
|
||||
let offset = int_of_le64 offset in
|
||||
let partitions = Parted.part_list device in
|
||||
let partition =
|
||||
|
||||
@@ -291,3 +291,7 @@ let parse_key_value_strings ?unquote lines =
|
||||
match unquote with
|
||||
| None -> lines
|
||||
| Some f -> List.map (fun (k, v) -> (k, f v)) lines
|
||||
|
||||
let hex_of_string s =
|
||||
let bytes = String.map_chars (fun c -> sprintf "%02x" (Char.code c)) s in
|
||||
String.concat " " bytes
|
||||
|
||||
@@ -121,5 +121,9 @@ val parse_key_value_strings : ?unquote:(string -> string) -> string list -> (str
|
||||
it is applied on the values as unquote function. Empty lines,
|
||||
or that start with a comment character [#], are ignored. *)
|
||||
|
||||
val hex_of_string : string -> string
|
||||
(** Return a string as a list of hex bytes.
|
||||
Use this for debugging msgs only. *)
|
||||
|
||||
(**/**)
|
||||
val get_verbose_flag : unit -> bool
|
||||
|
||||
Reference in New Issue
Block a user