diff --git a/daemon/inspect_fs_windows.ml b/daemon/inspect_fs_windows.ml index 6537481e1..18893e866 100644 --- a/daemon/inspect_fs_windows.ml +++ b/daemon/inspect_fs_windows.ml @@ -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 = diff --git a/daemon/utils.ml b/daemon/utils.ml index 3b5c957cf..bfaab3b0c 100644 --- a/daemon/utils.ml +++ b/daemon/utils.ml @@ -296,3 +296,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 diff --git a/daemon/utils.mli b/daemon/utils.mli index e721f28f2..250f2f810 100644 --- a/daemon/utils.mli +++ b/daemon/utils.mli @@ -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