From: Richard W.M. Jones <"Richard W.M. Jones "> Date: Wed, 7 May 2008 09:01:35 +0000 (+0100) Subject: Generate uniquifier so that private data functions will work. X-Git-Url: http://git.annexia.org/?a=commitdiff_plain;h=65163f9e553f391a9189721485d0998edbdd7b6e;p=virt-df.git Generate uniquifier so that private data functions will work. --- diff --git a/lib/diskimage_ext2.ml b/lib/diskimage_ext2.ml index ade7940..09c7c58 100644 --- a/lib/diskimage_ext2.ml +++ b/lib/diskimage_ext2.ml @@ -127,7 +127,7 @@ let rec probe dev = let fs_dev = new blocksize_overlay block_size dev in { - fs_cb = callbacks; + fs_cb = callbacks (); fs_dev = fs_dev; fs_blocksize = block_size; @@ -153,11 +153,14 @@ let rec probe dev = and offset_is_free _ _ = false -and callbacks = { - fs_cb_name = id; - fs_cb_printable_name = "Linux ext2/3"; - fs_cb_offset_is_free = offset_is_free; -} +and callbacks = + let i = ref 0 in + fun () -> { + fs_cb_uq = (incr i; !i); + fs_cb_name = id; + fs_cb_printable_name = "Linux ext2/3"; + fs_cb_offset_is_free = offset_is_free; + } (* Register the plugin. *) let () = register_plugin ~filesystem:probe id diff --git a/lib/diskimage_linux_swap.ml b/lib/diskimage_linux_swap.ml index a3c1b23..072e4e6 100644 --- a/lib/diskimage_linux_swap.ml +++ b/lib/diskimage_linux_swap.ml @@ -40,7 +40,7 @@ let rec probe dev = let fs_dev = new blocksize_overlay blocksize dev in { - fs_cb = callbacks; + fs_cb = callbacks (); fs_dev = fs_dev; fs_blocksize = blocksize; @@ -65,11 +65,14 @@ let rec probe dev = *) and offset_is_free _ offset = offset >= blocksize -and callbacks = { - fs_cb_name = id; - fs_cb_printable_name = "Linux swap"; - fs_cb_offset_is_free = offset_is_free; -} +and callbacks = + let i = ref 0 in + fun () -> { + fs_cb_uq = (incr i; !i); + fs_cb_name = id; + fs_cb_printable_name = "Linux swap"; + fs_cb_offset_is_free = offset_is_free; + } (* Register the plugin. *) let () = register_plugin ~filesystem:probe id diff --git a/lib/diskimage_linux_swsuspend.ml b/lib/diskimage_linux_swsuspend.ml index 4fec7b3..93da753 100644 --- a/lib/diskimage_linux_swsuspend.ml +++ b/lib/diskimage_linux_swsuspend.ml @@ -40,7 +40,7 @@ let rec probe dev = let fs_dev = new blocksize_overlay blocksize dev in { - fs_cb = callbacks; + fs_cb = callbacks (); fs_dev = fs_dev; fs_blocksize = blocksize; @@ -65,11 +65,14 @@ let rec probe dev = *) and offset_is_free _ _ = false -and callbacks = { - fs_cb_name = id; - fs_cb_printable_name = "Linux s/w suspend"; - fs_cb_offset_is_free = offset_is_free; -} +and callbacks = + let i = ref 0 in + fun () -> { + fs_cb_uq = (incr i; !i); + fs_cb_name = id; + fs_cb_printable_name = "Linux s/w suspend"; + fs_cb_offset_is_free = offset_is_free; + } (* Register the plugin. *) let () = register_plugin ~filesystem:probe id diff --git a/lib/diskimage_lvm2.ml b/lib/diskimage_lvm2.ml index 2c2fa60..da61600 100644 --- a/lib/diskimage_lvm2.ml +++ b/lib/diskimage_lvm2.ml @@ -107,7 +107,7 @@ let rec probe dev = let uuid, _ = read_pv_label dev in if !debug then eprintf "LVM2 detected PV UUID %s\n%!" uuid; - { pv_cb = callbacks; pv_uuid = uuid; pv_dev = dev } + { pv_cb = callbacks (); pv_uuid = uuid; pv_dev = dev } with exn -> if !debug then prerr_endline (Printexc.to_string exn); raise Not_found @@ -423,7 +423,7 @@ and list_lvs pvs = (* Finally we can set up devices for the LVs. *) let lvs = List.map ( - fun (vgname, (pvuuid, vgmeta, pvdevs, extent_size, lvs)) -> + fun (vgname, (pvuuids, vgmeta, pvdevs, extent_size, lvs)) -> try List.map ( fun (lvname, segments) -> @@ -456,11 +456,14 @@ and list_lvs pvs = *) and offset_is_free _ _ = false -and callbacks = { - lvm_cb_name = id; - lvm_cb_list_lvs = list_lvs; - lvm_cb_offset_is_free = offset_is_free; -} +and callbacks = + let i = ref 0 in + fun () -> { + lvm_cb_uq = (incr i; !i); + lvm_cb_name = id; + lvm_cb_list_lvs = list_lvs; + lvm_cb_offset_is_free = offset_is_free; + } (* Register the plugin. *) let () = register_plugin ~lvm:probe id