24ce3e747ed93192da5fa8501efe4dc02d79d3db
[virt-mem.git] / lib / virt_mem_types.mli
1 (** Common types. *)
2 (* Memory info command for virtual domains.
3    (C) Copyright 2008 Richard W.M. Jones, Red Hat Inc.
4    http://libvirt.org/
5
6    This program is free software; you can redistribute it and/or modify
7    it under the terms of the GNU General Public License as published by
8    the Free Software Foundation; either version 2 of the License, or
9    (at your option) any later version.
10
11    This program is distributed in the hope that it will be useful,
12    but WITHOUT ANY WARRANTY; without even the implied warranty of
13    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14    GNU General Public License for more details.
15
16    You should have received a copy of the GNU General Public License
17    along with this program; if not, write to the Free Software
18    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
19
20    Common types.
21  *)
22
23 type ksym = string
24   (** A kernel symbol. *)
25
26 module Ksymmap : sig
27   type key = String.t
28   type 'a t = 'a Map.Make(String).t
29   val empty : 'a t
30   val is_empty : 'a t -> bool
31   val add : key -> 'a -> 'a t -> 'a t
32   val find : key -> 'a t -> 'a
33   val remove : key -> 'a t -> 'a t
34   val mem : key -> 'a t -> bool
35   val iter : (key -> 'a -> unit) -> 'a t -> unit
36   val map : ('a -> 'b) -> 'a t -> 'b t
37   val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
38   val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
39   val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
40   val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
41 end
42   (** A map of kernel symbols to addresses. *)
43
44 type utsname = {
45   kernel_name : string;
46   nodename : string;
47   kernel_release : string;
48   kernel_version : string;
49   machine : string;
50   domainname : string;
51 }
52   (** Kernel version, from utsname structure in the kernel. *)
53
54 type image0 = {
55   dom : Libvirt.ro Libvirt.Domain.t option; (** Domain, if known. *)
56   domname : string;                     (** Domain name. *)
57   arch : Virt_mem_utils.architecture;   (** Architecture, eg. i386. *)
58   mem : ([`Wordsize], [`Endian], [`HasMapping]) Virt_mem_mmap.t;
59                                         (** Memory map. *)
60 }
61   (** A basic kernel image. *)
62
63 type image1 =
64     image0
65     * Virt_mem_mmap.addr Ksymmap.t      (* Kernel symbol map. *)
66   (** A kernel image, after finding kernel symbols. *)
67
68 type image2 =
69     image0
70     * Virt_mem_mmap.addr Ksymmap.t      (* Kernel symbol map. *)
71     * utsname option                    (* Kernel version, etc., if found. *)
72   (** A kernel image, after finding kernel version (like 'uname'). *)