X-Git-Url: http://git.annexia.org/?a=blobdiff_plain;f=lib%2Fdiskimage_linux_swsuspend.ml;h=93da753a42d6f3ba5b391c79630f3f43ccb73548;hb=554b96246db7b4db7972a0aa50eb33d4d6039ab6;hp=5f29286e074eff33552ce8f9487609daa19b8ab7;hpb=091ddc2dd90ad9985aca308657d8120781defc11;p=virt-df.git diff --git a/lib/diskimage_linux_swsuspend.ml b/lib/diskimage_linux_swsuspend.ml index 5f29286..93da753 100644 --- a/lib/diskimage_linux_swsuspend.ml +++ b/lib/diskimage_linux_swsuspend.ml @@ -20,14 +20,14 @@ Support for Linux software suspend partitions. *) -open Diskimage_utils +open Diskimage_impl open Int63.Operators -let plugin_id = "linux_swsuspend" +let id = "linux_swsuspend" let blocksize = ~^4096 (* XXX *) -let probe dev = +let rec probe dev = (* Load the "superblock" (ie. first 0x1000 bytes). *) let bits = dev#read_bitstring ~^0 ~^0x1000 in @@ -40,7 +40,7 @@ let probe dev = let fs_dev = new blocksize_overlay blocksize dev in { - fs_plugin_id = plugin_id; + fs_cb = callbacks (); fs_dev = fs_dev; fs_blocksize = blocksize; @@ -59,3 +59,20 @@ let probe dev = | { _ } -> raise Not_found (* Not Linux software suspend. *) + +(* Linux software suspend image is never free. + * Compare diskimage_linux_swap.ml + *) +and offset_is_free _ _ = false + +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