(** Handle struct list_head linked lists. *) (* 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. *) type t val create : Virt_mem_types.image -> Virt_mem_mmap.addr -> int -> t (** [create image head offset] creates a list_head handle. [head] is the address of the base [list_head] in kernel memory. [offset] is the offset of the [list_head] within the whole structure. Note that [head] may be an isolated [struct list_head] or it may be a member of a structure. In the case where the head is in a structure, the head structure is ignored (as is generally the case in kernel code too). If the memory might not have been loaded yet, you should call {!load} or {!load_all} immediately after this. *) val create_base : Virt_mem_types.image -> Virt_mem_mmap.addr -> int -> t (** Same as {!create} but the address passed in is the base address of the head structure {i not} the address of the list_head within that structure. *) val load : t -> (Virt_mem_types.image -> Virt_mem_mmap.addr -> Virt_mem_types.image) -> Virt_mem_types.image * t (** This call allows you to load the kernel memory for each structure in the list. You supply a function to do the loading, given the address of each structure in turn. This returns an updated memory map and {!t}. *) val load_all : t -> int -> Virt_mem_types.image * t (** More convenient version of {!load} where you specify the structure size, and this function does all the rest. *) val iter : t -> (Virt_mem_mmap.addr -> unit) -> unit (** [iter t f] applies function [f] to every element of the list [t]. *) val map : t -> (Virt_mem_mmap.addr -> 'a) -> 'a list (** [map t f] applies function [f] to every element of the list [t] and returns a list of the results. *) val fold : t -> 'a -> ('a -> Virt_mem_mmap.addr -> 'a) -> 'a (** [fold t b f] folds function [f] over every element of the list [t] with [b] as the base case. *)