Support for Linux swap partitions.
*)
-open Diskimage_utils
+open Diskimage_impl
open Int63.Operators
-let plugin_id = "linux_swap"
+let id = "linux_swap"
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
let fs_dev = new blocksize_overlay blocksize dev in
{
- fs_plugin_id = plugin_id;
+ fs_cb = callbacks;
fs_dev = fs_dev;
fs_blocksize = blocksize;
(* Linux swap space is always 'free', apart from the superblock.
* Compare diskimage_linux_swsuspend.ml
*)
-let offset_is_free _ offset = offset >= blocksize
+and offset_is_free _ offset = offset >= blocksize
-let callbacks = {
- fs_cb_probe = probe;
+and callbacks = {
+ 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