Removed $Id$ everywhere.
[virt-top.git] / virt-df / virt_df_linux_swap.ml
1 (* 'df' command for virtual domains.
2  *
3  * Support for Linux swap partitions.
4  *)
5
6 (* Int64 operators for convenience. *)
7 let (+^) = Int64.add
8 let (-^) = Int64.sub
9 let ( *^ ) = Int64.mul
10 let (/^) = Int64.div
11
12 let probe_swap target part_type fd start size =
13   Virt_df.Swap {
14     Virt_df.swap_name = "Linux swap";
15     swap_block_size = 4096L;            (* XXX *)
16     swap_blocks_total = size *^ 512L /^ 4096L;
17   }
18
19 (* Register with main code. *)
20 let () =
21   Virt_df.fs_register
22     [ 0x82 ]                            (* Partition type. *)
23     probe_swap