summaryrefslogtreecommitdiffstats
path: root/virt-df/virt_df_linux_swap.ml
blob: a1f759a6ddf1e3f2482600f1ca02062a86e31cd5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
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