2 * Copyright (C) 2010 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 along
15 * with this program; if not, write to the Free Software Foundation, Inc.,
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19 (** General-purpose utility code used everywhere. *)
21 val (+^) : int64 -> int64 -> int64
22 val (-^) : int64 -> int64 -> int64
23 val ( *^ ) : int64 -> int64 -> int64
24 val (/^) : int64 -> int64 -> int64
25 (** Int64 arithmetic operators. *)
27 type ('a, 'b) either = Left of 'a | Right of 'b
28 (** A value which is either an ['a] or a ['b], just like Haskell's
31 val (//) : string -> string -> string
32 (** Concatenate two paths. *)
34 val verbose : unit -> bool
35 val set_verbose_flag : unit -> unit
36 (** If this contains [true] then {!debug} will send debugging
37 messages to stderr, else debugging messages are dropped.
39 This is set through the --verbose command line option. *)
41 val debug : ('a, unit, string, unit) format4 -> 'a
42 (** A printf-like function for writing debugging messages. *)
44 val failwith : ('a, unit, string, 'b) format4 -> 'a
45 (** Replacement for standard OCaml [failwith] function. This can
46 take a printf-like argument list, and also logs errors on stderr
47 when verbose is enabled. *)
49 val trace : unit -> bool
50 val set_trace_flag : unit -> unit
51 (** If this contains [true] then calls to libguestfs are traced.
53 This is set through the [-x] command line option. *)
55 val connect_uri : unit -> string option
56 val set_connect_uri : string option -> unit
57 (** The libvirt connection URI.
59 This is set through the [--connect] command line option. *)
61 val utf8_rarrow : string (** UTF-8 RIGHTWARDS ARROW *)
63 val human_size : int64 -> string
64 (** Convert a number of bytes into a human readable string. *)
66 val human_size_1k : int64 -> string
67 (** Same as {!human_size} but the argument is 1KB blocks (used for
70 val unique : unit -> int
71 (** Return a new integer each time called. *)
73 val mklabel : string -> GObj.widget
74 (** Convenience function to make a label containing some text. It is
75 returned as a generic widget. *)
77 val markup_escape : string -> string
78 (** Call g_markup_escape. *)
80 val libguestfs_version_string : unit -> string
81 (** Return the version of libguestfs as a string. *)
83 val libvirt_version_string : unit -> string
84 (** Return the version of libvirt as a string. *)
86 val is_socket : int64 -> bool
87 val is_symlink : int64 -> bool
88 val is_regular_file : int64 -> bool
89 val is_block : int64 -> bool
90 val is_directory : int64 -> bool
91 val is_char : int64 -> bool
92 val is_fifo : int64 -> bool
93 (** File type tests. *)
95 val is_suid : int64 -> bool
96 val is_sgid : int64 -> bool
97 val is_svtx : int64 -> bool
98 (** File setuid, setgid, sticky bit tests. *)
100 val is_ru : int64 -> bool
101 val is_wu : int64 -> bool
102 val is_xu : int64 -> bool
103 val is_rg : int64 -> bool
104 val is_wg : int64 -> bool
105 val is_xg : int64 -> bool
106 val is_ro : int64 -> bool
107 val is_wo : int64 -> bool
108 val is_xo : int64 -> bool