open Unix
open Printf
-open Diskimage_utils
+open Diskimage_impl
open Int63.Operators
let ( ** ) = Int32.mul
let ( /* ) = Int32.div
-let plugin_id = "ext2"
+let id = "ext2"
let superblock_offset = ~^1024
let superblock_len = ~^1024
-let probe dev =
+let rec probe dev =
(* Load the superblock. *)
let bits = dev#read_bitstring superblock_offset superblock_len in
let fs_dev = new blocksize_overlay block_size dev in
{
- fs_plugin_id = plugin_id;
+ fs_cb = callbacks;
fs_dev = fs_dev;
fs_blocksize = block_size;
| { _ } ->
raise Not_found (* Not an EXT2/3 superblock. *)
-let offset_is_free _ _ = false
+and offset_is_free _ _ = false
-let callbacks = {
- fs_cb_probe = probe;
+and callbacks = {
+ 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