Get rid of lookup_ksym function, replace with a map.
[virt-mem.git] / lib / virt_mem_types.mli
diff --git a/lib/virt_mem_types.mli b/lib/virt_mem_types.mli
new file mode 100644 (file)
index 0000000..24ce3e7
--- /dev/null
@@ -0,0 +1,72 @@
+(** Common types. *)
+(* Memory info command for virtual domains.
+   (C) Copyright 2008 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.
+
+   Common types.
+ *)
+
+type ksym = string
+  (** A kernel symbol. *)
+
+module Ksymmap : sig
+  type key = String.t
+  type 'a t = 'a Map.Make(String).t
+  val empty : 'a t
+  val is_empty : 'a t -> bool
+  val add : key -> 'a -> 'a t -> 'a t
+  val find : key -> 'a t -> 'a
+  val remove : key -> 'a t -> 'a t
+  val mem : key -> 'a t -> bool
+  val iter : (key -> 'a -> unit) -> 'a t -> unit
+  val map : ('a -> 'b) -> 'a t -> 'b t
+  val mapi : (key -> 'a -> 'b) -> 'a t -> 'b t
+  val fold : (key -> 'a -> 'b -> 'b) -> 'a t -> 'b -> 'b
+  val compare : ('a -> 'a -> int) -> 'a t -> 'a t -> int
+  val equal : ('a -> 'a -> bool) -> 'a t -> 'a t -> bool
+end
+  (** A map of kernel symbols to addresses. *)
+
+type utsname = {
+  kernel_name : string;
+  nodename : string;
+  kernel_release : string;
+  kernel_version : string;
+  machine : string;
+  domainname : string;
+}
+  (** Kernel version, from utsname structure in the kernel. *)
+
+type image0 = {
+  dom : Libvirt.ro Libvirt.Domain.t option; (** Domain, if known. *)
+  domname : string;                    (** Domain name. *)
+  arch : Virt_mem_utils.architecture;  (** Architecture, eg. i386. *)
+  mem : ([`Wordsize], [`Endian], [`HasMapping]) Virt_mem_mmap.t;
+                                        (** Memory map. *)
+}
+  (** A basic kernel image. *)
+
+type image1 =
+    image0
+    * Virt_mem_mmap.addr Ksymmap.t     (* Kernel symbol map. *)
+  (** A kernel image, after finding kernel symbols. *)
+
+type image2 =
+    image0
+    * Virt_mem_mmap.addr Ksymmap.t     (* Kernel symbol map. *)
+    * utsname option                   (* Kernel version, etc., if found. *)
+  (** A kernel image, after finding kernel version (like 'uname'). *)