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 close : unit -> unit
30 method virtual read : int64 -> int -> string
31 method read_bitstring : int64 -> int -> Bitmatch.bitstring
34 class block_device : string ->
38 method close : unit -> unit
39 method read : int64 -> int -> string
40 method read_bitstring : int64 -> int -> Bitmatch.bitstring
43 class offset_device : string -> int64 -> int64 -> device ->
47 method close : unit -> unit
48 method read : int64 -> int -> string
49 method read_bitstring : int64 -> int -> Bitmatch.bitstring
52 val null_device : device
58 (lv * filesystem) list;
64 d_content : disk_content;
68 [ `Filesystem of filesystem
69 | `Partitions of partitions
70 | `PhysicalVolume of pv
75 parts_plugin_id : parts_plugin_id;
76 parts : partition list;
79 part_status : partition_status;
82 part_content : partition_content;
85 and partition_status = Bootable | Nonbootable | Malformed | NullEntry
86 and partition_content =
87 [ `Filesystem of filesystem
88 | `PhysicalVolume of pv
93 fs_plugin_id : fs_plugin_id;
94 fs_block_size : int64;
95 fs_blocks_total : int64;
97 fs_blocks_reserved : int64;
98 fs_blocks_avail : int64;
99 fs_blocks_used : int64;
100 fs_inodes_total : int64;
101 fs_inodes_reserved : int64;
102 fs_inodes_avail : int64;
103 fs_inodes_used : int64;
107 lvm_plugin_id : lvm_plugin_id;
114 and parts_plugin_id = string
115 and fs_plugin_id = string
116 and lvm_plugin_id = string
118 (** {2 Internal functions used by the plug-ins} *)
120 val canonical_uuid : string -> string
121 (** Convert a UUID which may contain '-' characters to canonical form. *)
123 val group_by : ?cmp:('a -> 'a -> int) -> ('a * 'b) list -> ('a * 'b list) list
124 (** Group a sorted list of pairs by the first element of the pair. *)
126 val range : int -> int -> int list
127 (** [range a b] returns the list of integers [a <= i < b].
128 If [a >= b] then the empty list is returned.
131 val ( +* ) : int32 -> int32 -> int32
132 val ( -* ) : int32 -> int32 -> int32
133 val ( ** ) : int32 -> int32 -> int32
134 val ( /* ) : int32 -> int32 -> int32
136 val ( +^ ) : int64 -> int64 -> int64
137 val ( -^ ) : int64 -> int64 -> int64
138 val ( *^ ) : int64 -> int64 -> int64
139 val ( /^ ) : int64 -> int64 -> int64
140 (** int32 and int64 infix operators for convenience. *)