summaryrefslogtreecommitdiffstats
path: root/virt-df/virt_df_linux_swap.ml
diff options
context:
space:
mode:
authorRichard W.M. Jones <rjones@redhat.com>2007-09-27 18:59:54 +0100
committerRichard W.M. Jones <rjones@redhat.com>2007-09-27 18:59:54 +0100
commit5616e76a5a01656aa0dcc323fcd1fcd77764e638 (patch)
tree7e37726337d16b5b4a1d3216eaa97d18668d4bc6 /virt-df/virt_df_linux_swap.ml
parent3d742c162cbcb38663da580f1dff58db992f1a22 (diff)
downloadvirt-top-5616e76a5a01656aa0dcc323fcd1fcd77764e638.tar.gz
virt-top-5616e76a5a01656aa0dcc323fcd1fcd77764e638.tar.xz
virt-top-5616e76a5a01656aa0dcc323fcd1fcd77764e638.zip
* configure.ac: Changed version to 0.3.2.9.
* Makefile.in: Re-enable virt-df. * virt-df/virt_df*.ml: Mostly finished off the core of virt-df. Ext2/3 support. No LVM as yet. * virt-df/README: Added README file.
Diffstat (limited to 'virt-df/virt_df_linux_swap.ml')
-rw-r--r--virt-df/virt_df_linux_swap.ml24
1 files changed, 24 insertions, 0 deletions
diff --git a/virt-df/virt_df_linux_swap.ml b/virt-df/virt_df_linux_swap.ml
new file mode 100644
index 0000000..a1f759a
--- /dev/null
+++ b/virt-df/virt_df_linux_swap.ml
@@ -0,0 +1,24 @@
+(* 'df' command for virtual domains.
+ * $Id$
+ *
+ * Support for Linux swap partitions.
+ *)
+
+(* Int64 operators for convenience. *)
+let (+^) = Int64.add
+let (-^) = Int64.sub
+let ( *^ ) = Int64.mul
+let (/^) = Int64.div
+
+let probe_swap target part_type fd start size =
+ Virt_df.Swap {
+ Virt_df.swap_name = "Linux swap";
+ swap_block_size = 4096L; (* XXX *)
+ swap_blocks_total = size *^ 512L /^ 4096L;
+ }
+
+(* Register with main code. *)
+let () =
+ Virt_df.fs_register
+ [ 0x82 ] (* Partition type. *)
+ probe_swap