(* (C) Copyright 2007-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. *) (**/**) val debug : bool ref (** {2 Device model} *) class virtual device : object method virtual name : string method virtual size : int64 method close : unit -> unit method virtual read : int64 -> int -> string method read_bitstring : int64 -> int -> Bitmatch.bitstring end class block_device : string -> object method name : string method size : int64 method close : unit -> unit method read : int64 -> int -> string method read_bitstring : int64 -> int -> Bitmatch.bitstring end class offset_device : string -> int64 -> int64 -> device -> object method name : string method size : int64 method close : unit -> unit method read : int64 -> int -> string method read_bitstring : int64 -> int -> Bitmatch.bitstring end val null_device : device type machine = { m_name : string; m_disks : disk list; m_lv_filesystems : (lv * filesystem) list; } and disk = { d_name : string; d_dev : device; d_content : disk_content; } and disk_content = [ `Filesystem of filesystem | `Partitions of partitions | `PhysicalVolume of pv | `Unknown ] and partitions = { parts_plugin_id : parts_plugin_id; parts : partition list; } and partition = { part_status : partition_status; part_type : int; part_dev : device; part_content : partition_content; } and partition_status = Bootable | Nonbootable | Malformed | NullEntry and partition_content = [ `Filesystem of filesystem | `PhysicalVolume of pv | `Unknown ] and filesystem = { fs_plugin_id : fs_plugin_id; fs_block_size : int64; fs_blocks_total : int64; fs_is_swap : bool; fs_blocks_reserved : int64; fs_blocks_avail : int64; fs_blocks_used : int64; fs_inodes_total : int64; fs_inodes_reserved : int64; fs_inodes_avail : int64; fs_inodes_used : int64; } and pv = { lvm_plugin_id : lvm_plugin_id; pv_uuid : string; } and lv = { lv_dev : device; } and parts_plugin_id = string and fs_plugin_id = string and lvm_plugin_id = string (** {2 Internal functions used by the plug-ins} *) val canonical_uuid : string -> string (** Convert a UUID which may contain '-' characters to canonical form. *) val group_by : ?cmp:('a -> 'a -> int) -> ('a * 'b) list -> ('a * 'b list) list (** Group a sorted list of pairs by the first element of the pair. *) val range : int -> int -> int list (** [range a b] returns the list of integers [a <= i < b]. If [a >= b] then the empty list is returned. *) val ( +* ) : int32 -> int32 -> int32 val ( -* ) : int32 -> int32 -> int32 val ( ** ) : int32 -> int32 -> int32 val ( /* ) : int32 -> int32 -> int32 val ( +^ ) : int64 -> int64 -> int64 val ( -^ ) : int64 -> int64 -> int64 val ( *^ ) : int64 -> int64 -> int64 val ( /^ ) : int64 -> int64 -> int64 (** int32 and int64 infix operators for convenience. *)