From 3ae952a58118e460981bb0750ab7e565ca2c1366 Mon Sep 17 00:00:00 2001 From: "Richard W.M. Jones" Date: Thu, 1 Jan 1970 00:00:00 +0000 Subject: [PATCH] Remove some unused fields in the segment structure. --- lib/diskimage.ml | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/lib/diskimage.ml b/lib/diskimage.ml index 42e02dc..807094a 100644 --- a/lib/diskimage.ml +++ b/lib/diskimage.ml @@ -309,10 +309,7 @@ type owner = | `PhysicalVolume of pv ] (* A segment describes the owner of a range of disk addresses. *) -type segment = - int63 * int63 * (* disk offset, size of segment *) - owner * (* owner *) - int63 (* owner offset *) +type segment = owner * int63 (* owner, owner offset *) type interval = int63 * int63 (* start point, end point (bytes) *) @@ -327,7 +324,10 @@ type ownership = (* List of owned segments before we build the segment tree. *) type ownership_list = (device * (* block_device (disk) *) - segment) list + (int63 * int63 * (* disk offset, size of segment *) + owner * int63 (* owner, owner offset *) + ) + ) list (* Ownership tables. *) let create_ownership machine = @@ -616,16 +616,15 @@ let create_ownership machine = let rec insert_segment tree segment = let start, size, owner, owner_offset = segment in let seginterval = start, start +^ size in - eprintf "inserting (%s,%s) ...\n" - (Int63.to_string (fst seginterval)) - (Int63.to_string (snd seginterval)); + let seg = owner, owner_offset in + match tree with (* Test if we should insert into this leaf or node: *) | Leaf (interval, segs) when interval <-< seginterval -> - Leaf (interval, segment :: segs) + Leaf (interval, seg :: segs) | Node (left, (interval, segs), right) when interval <-< seginterval -> - Node (left, (interval, segment :: segs), right) + Node (left, (interval, seg :: segs), right) | (Leaf _) as leaf -> leaf @@ -650,7 +649,7 @@ let create_ownership machine = let printer ((sp, ep), segments) = sprintf "[%s-%s] " (Int63.to_string sp) (Int63.to_string ep) ^ String.concat ";" - (List.map (fun (_, _, owner,_) -> string_of_owner owner) + (List.map (fun (owner,_) -> string_of_owner owner) segments) in print_binary_tree printer printer tree @@ -678,5 +677,5 @@ let get_owners_lookup machine ownership (disk : block_device) = let owners = query tree in List.map ( - fun (_, _, owner, owner_offset) -> (owner, offset -^ owner_offset) + fun (owner, owner_offset) -> (owner, offset -^ owner_offset) ) owners -- 1.8.3.1