1 (* (C) Copyright 2007-2008 Richard W.M. Jones, Red Hat Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
23 (** {2 Device model} *)
25 class virtual device :
27 method virtual name : string
28 method virtual size : int64
29 method read : int64 -> int -> string
30 method read_bitstring : int64 -> int -> Bitmatch.bitstring
31 method virtual blocksize : int
32 method virtual mapblock : int64 -> (device * int64) list
35 class block_device : string -> int ->
39 method read : int64 -> int -> string
40 method read_bitstring : int64 -> int -> Bitmatch.bitstring
41 method blocksize : int
42 method mapblock : int64 -> (device * int64) list
43 method close : unit -> unit
46 class offset_device : string -> int64 -> int64 -> int -> device ->
50 method read : int64 -> int -> string
51 method read_bitstring : int64 -> int -> Bitmatch.bitstring
52 method blocksize : int
53 method mapblock : int64 -> (device * int64) list
56 class blocksize_overlay : int -> device ->
60 method read : int64 -> int -> string
61 method read_bitstring : int64 -> int -> Bitmatch.bitstring
62 method blocksize : int
63 method mapblock : int64 -> (device * int64) list
66 val null_device : device
72 (lv * filesystem) list;
78 d_content : disk_content;
82 [ `Filesystem of filesystem
83 | `Partitions of partitions
84 | `PhysicalVolume of pv
89 parts_plugin_id : parts_plugin_id;
90 parts : partition list;
93 part_status : partition_status;
96 part_content : partition_content;
99 and partition_status = Bootable | Nonbootable | Malformed | NullEntry
100 and partition_content =
101 [ `Filesystem of filesystem
102 | `PhysicalVolume of pv
107 fs_plugin_id : fs_plugin_id;
110 fs_blocks_total : int64;
112 fs_blocks_reserved : int64;
113 fs_blocks_avail : int64;
114 fs_blocks_used : int64;
115 fs_inodes_total : int64;
116 fs_inodes_reserved : int64;
117 fs_inodes_avail : int64;
118 fs_inodes_used : int64;
122 lvm_plugin_id : lvm_plugin_id;
129 and parts_plugin_id = string
130 and fs_plugin_id = string
131 and lvm_plugin_id = string
133 (** {2 Internal functions used by the plug-ins} *)
135 val canonical_uuid : string -> string
136 (** Convert a UUID which may contain '-' characters to canonical form. *)
138 val group_by : ?cmp:('a -> 'a -> int) -> ('a * 'b) list -> ('a * 'b list) list
139 (** Group a sorted list of pairs by the first element of the pair. *)
141 val range : int -> int -> int list
142 (** [range a b] returns the list of integers [a <= i < b].
143 If [a >= b] then the empty list is returned.
146 val ( +* ) : int32 -> int32 -> int32
147 val ( -* ) : int32 -> int32 -> int32
148 val ( ** ) : int32 -> int32 -> int32
149 val ( /* ) : int32 -> int32 -> int32
151 val ( +^ ) : int64 -> int64 -> int64
152 val ( -^ ) : int64 -> int64 -> int64
153 val ( *^ ) : int64 -> int64 -> int64
154 val ( /^ ) : int64 -> int64 -> int64
155 (** int32 and int64 infix operators for convenience. *)