Initial, non-working FAT32 support.
[virt-df.git] / lib / diskimage_fat.ml
diff --git a/lib/diskimage_fat.ml b/lib/diskimage_fat.ml
new file mode 100644 (file)
index 0000000..1fbeac4
--- /dev/null
@@ -0,0 +1,48 @@
+(* 'df' command for virtual domains.
+   (C) Copyright 2007 Richard W.M. Jones, Red Hat Inc.
+   http://libvirt.org/
+
+   This program is free software; you can redistribute it and/or modify
+   it under the terms of the GNU General Public License as published by
+   the Free Software Foundation; either version 2 of the License, or
+   (at your option) any later version.
+
+   This program is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+   GNU General Public License for more details.
+
+   You should have received a copy of the GNU General Public License
+   along with this program; if not, write to the Free Software
+   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+
+   Support for FAT32.
+*)
+
+open Unix
+open Printf
+
+open Diskimage_impl
+
+(* Private data functions. *)
+let attach_private_data, get_private_data =
+  private_data_functions (fun {fs_cb = {fs_cb_uq = u}} -> u)
+
+let id = "fat"
+
+let rec probe dev =
+  raise Not_found                      (* XXX *)
+
+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 = "DOS/Windows";
+    fs_cb_offset_is_free = offset_is_free;
+  }
+
+(* Register the plugin. *)
+let () = register_plugin ~filesystem:probe id