Restructure library plug-ins again.
[virt-df.git] / lib / diskimage_ext2.ml
index ea020b5..ade7940 100644 (file)
@@ -22,7 +22,7 @@
 open Unix
 open Printf
 
-open Diskimage_utils
+open Diskimage_impl
 
 open Int63.Operators
 
@@ -31,11 +31,11 @@ let ( -* ) = Int32.sub
 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
 
@@ -127,7 +127,7 @@ let probe dev =
    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;
@@ -151,9 +151,13 @@ let probe dev =
   | { _ } ->
       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